From 332aa4d48873b2283c7dd1ddee18d03bbee1bb58 Mon Sep 17 00:00:00 2001 From: David Dykstal Date: Mon, 10 Apr 2006 21:11:07 +0000 Subject: [PATCH] initial population --- rse/plugins/org.eclipse.rse.ui/.classpath | 13 + rse/plugins/org.eclipse.rse.ui/.cvsignore | 1 + rse/plugins/org.eclipse.rse.ui/.project | 28 + .../org.eclipse.rse.ui/HelpContexts.xml | 946 +++ .../org.eclipse.rse.ui/META-INF/MANIFEST.MF | 56 + .../rse/internal/ui/view/SystemView.java | 5846 +++++++++++++++++ .../org/eclipse/rse/ui/AbstractElement.java | 40 + .../org/eclipse/rse/ui/GenericMessages.java | 73 + .../eclipse/rse/ui/GenericMessages.properties | 56 + .../rse/ui/IRemoteSelectionAddListener.java | 67 + .../rse/ui/ISystemConnectionFormCaller.java | 38 + .../rse/ui/ISystemContextMenuConstants.java | 296 + .../eclipse/rse/ui/ISystemDeleteTarget.java | 43 + .../eclipse/rse/ui/ISystemIconConstants.java | 447 ++ .../org/eclipse/rse/ui/ISystemMassager.java | 38 + .../org/eclipse/rse/ui/ISystemMessages.java | 454 ++ .../rse/ui/ISystemPageCompleteListener.java | 34 + .../rse/ui/ISystemPreferencesConstants.java | 93 + .../eclipse/rse/ui/ISystemRenameTarget.java | 41 + .../rse/ui/ISystemStringsInputAction.java | 28 + .../eclipse/rse/ui/ISystemThemeConstants.java | 37 + .../eclipse/rse/ui/ISystemVerifyListener.java | 33 + .../org/eclipse/rse/ui/MassagerAddQuotes.java | 86 + .../org/eclipse/rse/ui/MassagerFoldCase.java | 110 + .../rse/ui/MassagerFoldCaseOutsideQuotes.java | 197 + .../rse/ui/MassagerFoldCaseUnlessQuoted.java | 95 + .../eclipse/rse/ui/MassagerRemoveQuotes.java | 192 + .../UI/org/eclipse/rse/ui/Mnemonics.java | 578 ++ .../UI/org/eclipse/rse/ui/SystemBaseForm.java | 303 + .../eclipse/rse/ui/SystemConnectionForm.java | 1306 ++++ .../org/eclipse/rse/ui/SystemMenuManager.java | 359 + .../org/eclipse/rse/ui/SystemProfileForm.java | 263 + .../rse/ui/SystemPropertyResources.java | 51 + .../rse/ui/SystemPropertyResources.properties | 34 + .../org/eclipse/rse/ui/SystemResources.java | 1227 ++++ .../eclipse/rse/ui/SystemResources.properties | 1410 ++++ .../rse/ui/SystemSortableSelection.java | 132 + .../eclipse/rse/ui/SystemTabFolderLayout.java | 61 + .../eclipse/rse/ui/SystemWidgetHelpers.java | 1408 ++++ .../rse/ui/actions/DisplayDialogAction.java | 60 + .../actions/DisplaySystemMessageAction.java | 64 + .../eclipse/rse/ui/actions/ISystemAction.java | 111 + .../ISystemCopyTargetSelectionCallback.java | 33 + .../rse/ui/actions/ISystemDialogAction.java | 57 + .../ISystemDynamicPopupMenuExtension.java | 44 + ...ystemDynamicPopupMenuExtensionManager.java | 23 + .../rse/ui/actions/ISystemWizardAction.java | 25 + ...ystemAbstractPopupMenuExtensionAction.java | 393 ++ .../rse/ui/actions/SystemBaseAction.java | 818 +++ .../rse/ui/actions/SystemBaseCopyAction.java | 439 ++ .../ui/actions/SystemBaseDialogAction.java | 360 + .../rse/ui/actions/SystemBaseDummyAction.java | 31 + .../ui/actions/SystemBaseSubMenuAction.java | 475 ++ .../ui/actions/SystemBaseWizardAction.java | 280 + .../SystemCascadingBrowseWithAction.java | 49 + .../SystemCascadingCompareWithAction.java | 49 + .../SystemCascadingExpandToAction.java | 49 + .../ui/actions/SystemCascadingGoToAction.java | 81 + .../actions/SystemCascadingGotoActionOLD.java | 48 + .../ui/actions/SystemCascadingNewAction.java | 48 + .../SystemCascadingOpenWithAction.java | 49 + .../SystemCascadingPreferencesAction.java | 85 + .../SystemCascadingPulldownMenuAction.java | 105 + ...SystemCascadingRemoteServerBaseAction.java | 138 + .../SystemCascadingRemoteServersAction.java | 96 + .../SystemCascadingReplaceWithAction.java | 49 + ...temCascadingUserIdPerSystemTypeAction.java | 69 + .../ui/actions/SystemCascadingViewAction.java | 47 + .../SystemCascadingWorkWithAction.java | 48 + .../SystemClearAllPasswordsAction.java | 115 + .../ui/actions/SystemClearPasswordAction.java | 99 + .../rse/ui/actions/SystemCollapseAction.java | 101 + .../ui/actions/SystemCollapseAllAction.java | 81 + .../ui/actions/SystemCommonDeleteAction.java | 205 + .../ui/actions/SystemCommonRenameAction.java | 236 + .../actions/SystemCommonSelectAllAction.java | 72 + .../rse/ui/actions/SystemConnectAction.java | 75 + .../SystemConnectAllSubSystemsAction.java | 112 + .../actions/SystemCopyConnectionAction.java | 248 + .../actions/SystemCopyToClipboardAction.java | 234 + .../ui/actions/SystemDisconnectAction.java | 71 + .../SystemDisconnectAllSubSystemsAction.java | 75 + ...ystemDynamicPopupMenuExtensionManager.java | 73 + .../rse/ui/actions/SystemExpandAction.java | 101 + .../actions/SystemMoveConnectionAction.java | 256 + .../SystemMoveDownConnectionAction.java | 108 + .../actions/SystemMoveUpConnectionAction.java | 109 + .../ui/actions/SystemNewConnectionAction.java | 198 + ...onnectionFromExistingConnectionAction.java | 41 + .../ui/actions/SystemNewProfileAction.java | 111 + .../SystemOpenExplorerPerspectiveAction.java | 130 + .../SystemOpenRSEPerspectiveAction.java | 42 + .../SystemPasteFromClipboardAction.java | 350 + ...referenceQualifyConnectionNamesAction.java | 73 + .../SystemPreferenceRestoreStateAction.java | 72 + ...SystemPreferenceShowFilterPoolsAction.java | 72 + ...emPreferenceUserIdPerSystemTypeAction.java | 83 + .../actions/SystemProfileNameCopyAction.java | 224 + .../SystemProfileNameSelectAction.java | 59 + .../rse/ui/actions/SystemRefreshAction.java | 98 + .../ui/actions/SystemRefreshAllAction.java | 102 + .../actions/SystemRemotePropertiesAction.java | 162 + .../SystemRemoteServerStartAction.java | 59 + .../actions/SystemRemoteServerStopAction.java | 59 + .../SystemResolveFilterStringAction.java | 76 + .../rse/ui/actions/SystemRunAction.java | 94 + .../actions/SystemSelectConnectionAction.java | 187 + .../rse/ui/actions/SystemSeparatorAction.java | 58 + .../ui/actions/SystemShowInMonitorAction.java | 103 + .../ui/actions/SystemShowInTableAction.java | 102 + .../SystemShowPreferencesPageAction.java | 217 + ...SystemStartCommunicationsDaemonAction.java | 92 + .../ui/actions/SystemStringPromptAction.java | 97 + .../rse/ui/actions/SystemSubMenuManager.java | 403 ++ .../SystemSubMenuManagerForTesting.java | 180 + .../ui/actions/SystemTablePrintAction.java | 523 ++ .../ui/actions/SystemTeamReloadAction.java | 76 + .../actions/SystemTestFilterStringAction.java | 102 + .../actions/SystemUpdateConnectionAction.java | 75 + .../actions/SystemViewExpandToAllAction.java | 52 + .../actions/SystemViewExpandToBaseAction.java | 99 + .../ui/actions/SystemWorkOfflineAction.java | 129 + .../actions/SystemWorkWithProfilesAction.java | 56 + .../rse/ui/actions/TestPopupMenuAction1.java | 43 + .../EnvironmentVariablesPromptDialog.java | 248 + .../rse/ui/dialogs/ISignonValidator.java | 48 + .../dialogs/ISystemPasswordPromptDialog.java | 100 + .../rse/ui/dialogs/ISystemPromptDialog.java | 57 + .../rse/ui/dialogs/ISystemTypedObject.java | 42 + .../ui/dialogs/SystemControlEnableState.java | 155 + .../ui/dialogs/SystemCopyProfileDialog.java | 280 + .../rse/ui/dialogs/SystemDeleteDialog.java | 293 + .../ui/dialogs/SystemDeleteTableProvider.java | 173 + .../rse/ui/dialogs/SystemDeleteTableRow.java | 202 + .../ui/dialogs/SystemFilterTableDialog.java | 417 ++ .../SystemPasswordPersistancePrompt.java | 338 + .../dialogs/SystemPasswordPromptDialog.java | 524 ++ .../rse/ui/dialogs/SystemPromptDialog.java | 1709 +++++ .../dialogs/SystemRemoteResourceDialog.java | 256 + .../rse/ui/dialogs/SystemRenameDialog.java | 688 ++ .../ui/dialogs/SystemRenameSingleDialog.java | 715 ++ .../ui/dialogs/SystemRenameTableProvider.java | 216 + .../rse/ui/dialogs/SystemRenameTableRow.java | 212 + .../SystemResolveFilterStringDialog.java | 111 + .../dialogs/SystemSelectAnythingDialog.java | 91 + .../dialogs/SystemSelectConnectionDialog.java | 365 + .../dialogs/SystemSelectFileTypesDialog.java | 468 ++ .../dialogs/SystemSimpleContentElement.java | 331 + .../dialogs/SystemSimpleContentProvider.java | 159 + .../ui/dialogs/SystemSimpleCopyDialog.java | 277 + .../ui/dialogs/SystemSimpleSelectDialog.java | 490 ++ .../dialogs/SystemTestFilterStringDialog.java | 211 + .../dialogs/SystemUpdateConnectionDialog.java | 141 + .../SystemUserIdPerSystemTypeDialog.java | 243 + .../rse/ui/dialogs/SystemWizardDialog.java | 192 + .../dialogs/SystemWorkWithHistoryDialog.java | 346 + ...ystemChangeFilterPaneEditPaneSupplier.java | 33 + .../ISystemFilterStringEditPaneListener.java | 44 + .../ui/filters/SystemChangeFilterPane.java | 1437 ++++ .../ui/filters/SystemFilterDialogInputs.java | 31 + .../filters/SystemFilterDialogInterface.java | 35 + .../ui/filters/SystemFilterDialogOutputs.java | 33 + .../filters/SystemFilterPoolDialogInputs.java | 44 + .../SystemFilterPoolDialogInterface.java | 40 + .../SystemFilterPoolDialogOutputs.java | 36 + .../SystemFilterPoolManagerUIProvider.java | 26 + .../filters/SystemFilterStringEditPane.java | 704 ++ .../rse/ui/filters/SystemFilterUIHelpers.java | 170 + ...emFilterWorkWithFilterPoolsTreeViewer.java | 190 + .../ISystemNewFilterActionConfigurator.java | 40 + .../actions/SystemChangeFilterAction.java | 252 + .../SystemChangeFilterActionCopyString.java | 68 + .../SystemChangeFilterActionDeleteString.java | 69 + ...ystemChangeFilterActionMoveStringDown.java | 68 + .../SystemChangeFilterActionMoveStringUp.java | 68 + .../SystemChangeFilterActionPasteString.java | 67 + .../SystemFilterAbstractFilterAction.java | 232 + .../SystemFilterAbstractFilterPoolAction.java | 495 ++ ...mFilterAbstractFilterPoolWizardAction.java | 87 + ...ystemFilterAbstractFilterWizardAction.java | 85 + ...CascadingNewFilterPoolReferenceAction.java | 135 + ...dingNewFilterPoolReferenceFPMgrAction.java | 127 + .../actions/SystemFilterCopyFilterAction.java | 364 + .../SystemFilterCopyFilterPoolAction.java | 325 + .../SystemFilterCopyFilterStringAction.java | 496 ++ .../SystemFilterMoveDownFilterAction.java | 153 + ...lterMoveDownFilterPoolReferenceAction.java | 141 + .../actions/SystemFilterMoveFilterAction.java | 372 ++ .../SystemFilterMoveFilterPoolAction.java | 371 ++ .../SystemFilterMoveFilterStringAction.java | 487 ++ .../SystemFilterMoveUpFilterAction.java | 157 + ...FilterMoveUpFilterPoolReferenceAction.java | 141 + .../SystemFilterNewFilterPoolAction.java | 174 + ...SystemFilterPoolReferenceSelectAction.java | 85 + ...FilterRemoveFilterPoolReferenceAction.java | 94 + .../SystemFilterSelectFilterPoolsAction.java | 268 + ...SystemFilterWorkWithFilterPoolsAction.java | 199 + ...erWorkWithFilterPoolsRefreshAllAction.java | 82 + .../actions/SystemNewFilterAction.java | 492 ++ .../filters/dialogs/ISystemFilterWizard.java | 26 + .../ISystemNewFilterWizardConfigurator.java | 121 + .../dialogs/SystemChangeFilterDialog.java | 365 + .../SystemFilterNewFilterPoolWizard.java | 197 + ...terNewFilterPoolWizardDefaultMainPage.java | 374 ++ ...rNewFilterPoolWizardMainPageInterface.java | 71 + .../dialogs/SystemFilterPoolWizardDialog.java | 83 + .../SystemFilterPoolWizardInterface.java | 27 + .../dialogs/SystemFilterWizardDialog.java | 75 + ...SystemFilterWorkWithFilterPoolsDialog.java | 657 ++ .../dialogs/SystemNewFilterWizard.java | 697 ++ .../SystemNewFilterWizardConfigurator.java | 240 + .../SystemNewFilterWizardInfoPage.java | 116 + .../SystemNewFilterWizardMainPage.java | 259 + .../SystemNewFilterWizardNamePage.java | 482 ++ .../dialogs/SystemUnNamedFilterDialog.java | 215 + .../rse/ui/messages/ISystemMessageLine.java | 90 + .../ui/messages/ISystemMessageLineTarget.java | 33 + .../ui/messages/StatusLineManagerAdapter.java | 123 + .../messages/SystemDialogPageMessageLine.java | 391 ++ .../rse/ui/messages/SystemMessageDialog.java | 727 ++ .../rse/ui/messages/SystemMessageLine.java | 657 ++ .../rse/ui/messages/SystemMessageStatus.java | 153 + .../rse/ui/messages/SystemUIMessage.java | 93 + .../rse/ui/messages/SystemUIMessageFile.java | 52 + .../rse/ui/open/ISystemQuickOpenPage.java | 50 + .../open/ISystemQuickOpenPageContainer.java | 46 + .../open/SystemOpenQuickOpenDialogAction.java | 126 + .../rse/ui/open/SystemQuickOpenDialog.java | 802 +++ .../open/SystemQuickOpenPageDescriptor.java | 186 + .../rse/ui/open/SystemQuickOpenUI.java | 50 + .../rse/ui/open/SystemQuickOpenUtil.java | 120 + .../ui/operations/ISystemRunnableContext.java | 41 + .../org/eclipse/rse/ui/operations/Policy.java | 121 + .../ui/operations/SystemFetchOperation.java | 270 + .../operations/SystemJobRunnableContext.java | 283 + .../SystemProgressDialogRunnableContext.java | 200 + .../ui/operations/SystemSchedulingRule.java | 46 + ...ctSystemSubSystemPropertyPageCoreForm.java | 221 + .../ISystemConnectionWizardErrorUpdater.java | 28 + .../ISystemConnectionWizardPropertyPage.java | 32 + .../ISystemSubSystemPropertyPageCoreForm.java | 48 + .../RemoteSystemsPreferencePage.java | 681 ++ .../ServerConnectionSecurityPropertyPage.java | 144 + .../ServerLauncherPropertyPage.java | 184 + .../propertypages/ServicesPropertyPage.java | 137 + .../propertypages/SignonPreferencePage.java | 399 ++ ...emAbstractPropertyPageExtensionAction.java | 250 + .../propertypages/SystemBasePropertyPage.java | 536 ++ .../SystemBooleanFieldEditor.java | 109 + .../SystemChangeFilterPropertyPage.java | 316 + .../SystemComboBoxFieldEditor.java | 497 ++ .../SystemCommunicationsPreferencePage.java | 134 + .../SystemConnectionPropertyPage.java | 168 + ...ystemConnectionSubSystemsPropertyPage.java | 391 ++ .../SystemConnectorServicesPropertyPage.java | 88 + .../SystemFilterPoolPropertyPage.java | 126 + ...SystemFilterPoolReferencePropertyPage.java | 117 + .../SystemFilterPropertyPage.java | 135 + .../SystemFilterStringPropertyPage.java | 340 + .../SystemKeyValueFieldEditor.java | 640 ++ .../SystemLoggingPreferencePage.java | 35 + .../SystemPreferenceInitializer.java | 41 + .../SystemRemotePropertyPageNode.java | 90 + .../SystemStringFieldEditor.java | 371 ++ .../SystemSubSystemPropertyPageCore.java | 89 + .../SystemSubSystemPropertyPageCoreForm.java | 404 ++ .../SystemTeamViewCategoryPropertyPage.java | 110 + .../SystemTeamViewProfilePropertyPage.java | 114 + ...mTeamViewSubSystemFactoryPropertyPage.java | 145 + .../propertypages/SystemTypeFieldEditor.java | 515 ++ .../rse/ui/validators/ISystemValidator.java | 52 + .../ISystemValidatorUniqueString.java | 45 + .../validators/IValidatorRemoteSelection.java | 40 + .../SystemNumericVerifyListener.java | 46 + .../ui/validators/ValidatorArchiveName.java | 72 + .../ValidatorCompileCommandLabel.java | 131 + .../validators/ValidatorConnectionName.java | 97 + .../rse/ui/validators/ValidatorFileName.java | 140 + .../ui/validators/ValidatorFilterName.java | 101 + .../validators/ValidatorFilterPoolName.java | 98 + .../ui/validators/ValidatorFilterString.java | 155 + .../ui/validators/ValidatorFolderName.java | 142 + .../ui/validators/ValidatorIntegerInput.java | 163 + .../ValidatorIntegerRangeInput.java | 115 + .../rse/ui/validators/ValidatorLocalPath.java | 95 + .../rse/ui/validators/ValidatorLongInput.java | 162 + .../validators/ValidatorLongRangeInput.java | 113 + .../rse/ui/validators/ValidatorPathName.java | 124 + .../rse/ui/validators/ValidatorPortInput.java | 79 + .../ui/validators/ValidatorProfileName.java | 89 + .../validators/ValidatorRemoteSelection.java | 39 + .../validators/ValidatorServerPortInput.java | 65 + .../ui/validators/ValidatorSourceType.java | 110 + .../ui/validators/ValidatorSpecialChar.java | 206 + .../ui/validators/ValidatorSystemName.java | 119 + .../ui/validators/ValidatorUniqueString.java | 365 + .../ValidatorUserActionCommand.java | 120 + .../ValidatorUserActionComment.java | 120 + .../validators/ValidatorUserActionName.java | 133 + .../rse/ui/validators/ValidatorUserId.java | 51 + .../ui/validators/ValidatorUserTypeName.java | 106 + .../ui/validators/ValidatorUserTypeTypes.java | 120 + .../AbstractSystemRemoteAdapterFactory.java | 47 + .../ui/view/AbstractSystemViewAdapter.java | 1808 +++++ .../org/eclipse/rse/ui/view/IRSEViewPart.java | 24 + .../rse/ui/view/ISystemDragDropAdapter.java | 117 + .../ui/view/ISystemEditableRemoteObject.java | 159 + .../ISystemLongRunningRequestListener.java | 33 + .../rse/ui/view/ISystemMementoConstants.java | 50 + .../rse/ui/view/ISystemPropertyConstants.java | 107 + .../ui/view/ISystemRemoteElementAdapter.java | 160 + .../ui/view/ISystemRemoveElementAdapter.java | 42 + .../rse/ui/view/ISystemSelectAllTarget.java | 43 + ...emSelectRemoteObjectAPIProviderCaller.java | 39 + .../rse/ui/view/ISystemShellProvider.java | 27 + .../org/eclipse/rse/ui/view/ISystemTree.java | 99 + .../rse/ui/view/ISystemViewActionFilter.java | 52 + .../ui/view/ISystemViewDropDestination.java | 34 + .../ui/view/ISystemViewElementAdapter.java | 346 + .../rse/ui/view/ISystemViewInputProvider.java | 97 + .../ui/view/ISystemViewRunnableObject.java | 29 + .../rse/ui/view/SubsystemFactoryAdapter.java | 1440 ++++ .../view/SubsystemFactoryAdapterFactory.java | 59 + .../ui/view/SystemAbstractAPIProvider.java | 215 + .../rse/ui/view/SystemActionViewerFilter.java | 190 + .../rse/ui/view/SystemComboBoxCellEditor.java | 207 + .../SystemComboBoxPropertyDescriptor.java | 89 + .../ui/view/SystemDNDTransferRunnable.java | 618 ++ .../view/SystemDecoratingLabelProvider.java | 58 + .../rse/ui/view/SystemDropActionDelegate.java | 161 + .../view/SystemEmptyListAPIProviderImpl.java | 111 + .../view/SystemInheritablePropertyData.java | 173 + .../view/SystemInheritableTextCellEditor.java | 517 ++ ...stemInheritableTextPropertyDescriptor.java | 113 + .../view/SystemLongRunningRequestEvent.java | 34 + .../rse/ui/view/SystemPerspectiveLayout.java | 91 + .../rse/ui/view/SystemPropertySheetForm.java | 227 + ...temResolveFilterStringAPIProviderImpl.java | 50 + .../ui/view/SystemResourceSelectionForm.java | 610 ++ .../SystemResourceSelectionInputProvider.java | 115 + ...stemSelectRemoteObjectAPIProviderImpl.java | 634 ++ .../rse/ui/view/SystemTableTreeView.java | 1839 ++++++ .../ui/view/SystemTableTreeViewProvider.java | 343 + .../eclipse/rse/ui/view/SystemTableView.java | 1905 ++++++ .../ui/view/SystemTableViewColumnManager.java | 146 + .../rse/ui/view/SystemTableViewFilter.java | 81 + .../rse/ui/view/SystemTableViewPart.java | 1839 ++++++ .../rse/ui/view/SystemTableViewProvider.java | 354 + .../rse/ui/view/SystemTableViewSorter.java | 184 + ...SystemTestFilterStringAPIProviderImpl.java | 175 + .../org/eclipse/rse/ui/view/SystemView.java | 5846 +++++++++++++++++ .../SystemViewAPIProviderForConnections.java | 106 + .../SystemViewAPIProviderForFilterPools.java | 128 + ...SystemViewAPIProviderForFilterStrings.java | 201 + .../view/SystemViewAPIProviderForFilters.java | 258 + .../SystemViewAPIProviderForSubSystems.java | 107 + .../rse/ui/view/SystemViewAdapterFactory.java | 353 + .../view/SystemViewCompositeActionGroup.java | 104 + .../ui/view/SystemViewConnectionAdapter.java | 646 ++ ...mViewConnectionSelectionInputProvider.java | 151 + .../ui/view/SystemViewDataDragAdapter.java | 341 + .../ui/view/SystemViewDataDropAdapter.java | 346 + .../rse/ui/view/SystemViewDummyObject.java | 47 + .../rse/ui/view/SystemViewFilterAdapter.java | 560 ++ .../ui/view/SystemViewFilterPoolAdapter.java | 286 + .../SystemViewFilterPoolReferenceAdapter.java | 366 ++ .../SystemViewFilterReferenceAdapter.java | 960 +++ .../view/SystemViewFilterStringAdapter.java | 285 + .../eclipse/rse/ui/view/SystemViewForm.java | 579 ++ .../SystemViewLabelAndContentProvider.java | 464 ++ .../rse/ui/view/SystemViewMenuListener.java | 152 + .../rse/ui/view/SystemViewMessageAdapter.java | 197 + .../SystemViewNewConnectionPromptAdapter.java | 38 + .../eclipse/rse/ui/view/SystemViewPart.java | 1903 ++++++ .../ui/view/SystemViewPartFrameSource.java | 55 + .../view/SystemViewPartGotoActionGroup.java | 109 + .../ui/view/SystemViewPromptableAdapter.java | 198 + .../rse/ui/view/SystemViewResources.java | 250 + .../ui/view/SystemViewResources.properties | 212 + .../ui/view/SystemViewRootInputAdapter.java | 226 + .../ui/view/SystemViewScratchpadAdapter.java | 274 + .../ui/view/SystemViewSubSystemAdapter.java | 728 ++ .../rse/ui/view/monitor/BrowseAction.java | 54 + .../rse/ui/view/monitor/ClearAction.java | 52 + .../ui/view/monitor/ClearSelectedAction.java | 58 + .../rse/ui/view/monitor/MonitorViewPage.java | 568 ++ .../ui/view/monitor/MonitorViewWorkbook.java | 277 + .../rse/ui/view/monitor/SystemMonitorUI.java | 78 + .../view/monitor/SystemMonitorViewPart.java | 1034 +++ .../rse/ui/view/monitor/TabFolderLayout.java | 61 + .../rse/ui/view/scratchpad/BrowseAction.java | 53 + .../rse/ui/view/scratchpad/ClearAction.java | 57 + .../view/scratchpad/ClearSelectedAction.java | 86 + .../view/scratchpad/SystemScratchpadView.java | 1453 ++++ .../scratchpad/SystemScratchpadViewPart.java | 388 ++ .../SystemScratchpadViewProvider.java | 181 + .../SystemSearchClearHistoryAction.java | 51 + .../SystemSearchCopyToClipboardAction.java | 56 + .../search/SystemSearchHistoryAction.java | 61 + .../SystemSearchRemoveAllMatchesAction.java | 52 + ...stemSearchRemoveSelectedMatchesAction.java | 52 + .../ui/view/search/SystemSearchTableView.java | 374 ++ .../search/SystemSearchTableViewProvider.java | 45 + .../rse/ui/view/search/SystemSearchUI.java | 73 + .../SystemSearchViewContentProvider.java | 183 + .../search/SystemSearchViewLabelProvider.java | 94 + .../ui/view/search/SystemSearchViewPart.java | 1282 ++++ .../team/SystemResourceAdaptableProfile.java | 35 + .../rse/ui/view/team/SystemTeamView.java | 267 + .../SystemTeamViewActiveProfileAction.java | 88 + .../team/SystemTeamViewCategoryAdapter.java | 273 + .../view/team/SystemTeamViewCategoryNode.java | 152 + .../team/SystemTeamViewContentProvider.java | 234 + .../team/SystemTeamViewInputProvider.java | 169 + .../team/SystemTeamViewLabelProvider.java | 212 + ...SystemTeamViewMakeActiveProfileAction.java | 91 + ...stemTeamViewMakeInActiveProfileAction.java | 93 + .../rse/ui/view/team/SystemTeamViewPart.java | 1560 +++++ .../team/SystemTeamViewProfileAdapter.java | 412 ++ .../team/SystemTeamViewRefreshAllAction.java | 76 + .../SystemTeamViewResourceAdapterFactory.java | 68 + ...SystemTeamViewSubSystemFactoryAdapter.java | 309 + .../SystemTeamViewSubSystemFactoryNode.java | 191 + .../ui/widgets/EnvironmentVariablesForm.java | 608 ++ .../org/eclipse/rse/ui/widgets/GridUtil.java | 68 + .../ui/widgets/IBMBaseServerLauncherForm.java | 114 + .../rse/ui/widgets/IBMServerLauncherForm.java | 561 ++ .../rse/ui/widgets/IServerLauncherForm.java | 61 + .../rse/ui/widgets/ISystemAddListener.java | 47 + .../ISystemCollapsableSectionListener.java | 31 + .../eclipse/rse/ui/widgets/ISystemCombo.java | 96 + .../rse/ui/widgets/ISystemEditPaneStates.java | 53 + .../eclipse/rse/ui/widgets/InheritButton.java | 240 + .../rse/ui/widgets/InheritControl.java | 217 + .../rse/ui/widgets/InheritControlLayout.java | 44 + .../rse/ui/widgets/InheritableEntryField.java | 345 + .../org/eclipse/rse/ui/widgets/SSLForm.java | 94 + .../widgets/ServerConnectionSecurityForm.java | 87 + .../ui/widgets/SystemCollapsableSection.java | 441 ++ .../widgets/SystemEditPaneStateMachine.java | 451 ++ .../rse/ui/widgets/SystemHistoryCombo.java | 696 ++ .../rse/ui/widgets/SystemHostCombo.java | 1121 ++++ .../rse/ui/widgets/SystemPortPrompt.java | 366 ++ .../widgets/SystemSelectConnectionForm.java | 508 ++ .../services/ConnectorServiceElement.java | 109 + .../services/ConnectorServicesForm.java | 172 + .../services/FactoryServiceElement.java | 138 + .../ui/widgets/services/PropertyElement.java | 114 + .../services/PropertySetServiceElement.java | 218 + .../services/RSEModelServiceElement.java | 149 + .../widgets/services/RootServiceElement.java | 106 + ...erverLauncherPropertiesServiceElement.java | 75 + .../ui/widgets/services/ServiceElement.java | 88 + .../services/ServiceServiceElement.java | 103 + .../services/ServiceTableContentProvider.java | 67 + .../services/ServiceTableLabelProvider.java | 91 + .../rse/ui/widgets/services/ServicesForm.java | 313 + ...AbstractSystemNewConnectionWizardPage.java | 131 + .../rse/ui/wizards/AbstractSystemWizard.java | 454 ++ .../ui/wizards/AbstractSystemWizardPage.java | 518 ++ .../ISubSystemPropertiesWizardPage.java | 24 + .../ISystemNewConnectionWizardMainPage.java | 84 + .../ISystemNewConnectionWizardPage.java | 50 + .../eclipse/rse/ui/wizards/ISystemWizard.java | 105 + .../rse/ui/wizards/ISystemWizardPage.java | 53 + .../wizards/SubSystemServiceWizardPage.java | 188 + .../ui/wizards/SystemNewConnectionWizard.java | 520 ++ ...temNewConnectionWizardDefaultMainPage.java | 356 + ...mNewConnectionWizardRenameProfilePage.java | 166 + .../ui/wizards/SystemNewProfileWizard.java | 104 + .../SystemNewProfileWizardMainPage.java | 208 + .../SystemSubSystemsPropertiesWizardPage.java | 252 + rse/plugins/org.eclipse.rse.ui/about.html | 22 + .../org.eclipse.rse.ui/build.properties | 33 + .../eclipse/rse/filters/ISystemFilter.java | 653 ++ .../rse/filters/ISystemFilterConstants.java | 41 + .../rse/filters/ISystemFilterContainer.java | 111 + .../ISystemFilterContainerReference.java | 81 + .../filters/ISystemFilterNamingPolicy.java | 68 + .../rse/filters/ISystemFilterPool.java | 343 + .../rse/filters/ISystemFilterPoolManager.java | 634 ++ .../ISystemFilterPoolManagerProvider.java | 132 + .../filters/ISystemFilterPoolReference.java | 81 + .../ISystemFilterPoolReferenceManager.java | 268 + ...temFilterPoolReferenceManagerProvider.java | 94 + .../ISystemFilterPoolSelectionValidator.java | 40 + .../rse/filters/ISystemFilterPoolWrapper.java | 33 + .../ISystemFilterPoolWrapperInformation.java | 51 + .../rse/filters/ISystemFilterReference.java | 101 + .../filters/ISystemFilterSavePolicies.java | 46 + .../rse/filters/ISystemFilterString.java | 101 + .../filters/ISystemFilterStringReference.java | 58 + .../rse/filters/SystemFilterPoolWrapper.java | 59 + .../SystemFilterPoolWrapperInformation.java | 124 + .../rse/filters/SystemFilterReference.java | 490 ++ .../rse/filters/SystemFilterSimple.java | 503 ++ .../rse/filters/SystemFilterStartHere.java | 109 + .../rse/internal/filters/SystemFilter.java | 1399 ++++ .../SystemFilterContainerCommonMethods.java | 570 ++ ...FilterContainerReferenceCommonMethods.java | 255 + .../filters/SystemFilterNamingPolicy.java | 150 + .../internal/filters/SystemFilterPool.java | 1397 ++++ .../filters/SystemFilterPoolManager.java | 1949 ++++++ .../filters/SystemFilterPoolReference.java | 235 + .../SystemFilterPoolReferenceManager.java | 1099 ++++ .../internal/filters/SystemFilterString.java | 296 + .../filters/SystemFilterStringReference.java | 189 + .../icons/full/ctool16/new.gif | Bin 0 -> 612 bytes .../icons/full/ctool16/newconnection_wiz.gif | Bin 0 -> 328 bytes .../icons/full/ctool16/newfile_wiz.gif | Bin 0 -> 353 bytes .../icons/full/ctool16/newfilter_wiz.gif | Bin 0 -> 227 bytes .../icons/full/ctool16/newfilterpool_wiz.gif | Bin 0 -> 348 bytes .../full/ctool16/newfilterpoolref_wiz.gif | Bin 0 -> 354 bytes .../icons/full/ctool16/newfolder_wiz.gif | Bin 0 -> 350 bytes .../icons/full/ctool16/newprofile_wiz.gif | Bin 0 -> 586 bytes .../icons/full/cview16/commands_view.gif | Bin 0 -> 347 bytes .../icons/full/cview16/editor.gif | Bin 0 -> 591 bytes .../icons/full/cview16/errorlist_view.gif | Bin 0 -> 604 bytes .../icons/full/cview16/resourceRef_obj.gif | Bin 0 -> 365 bytes .../icons/full/cview16/system_persp.gif | Bin 0 -> 606 bytes .../icons/full/cview16/system_view.gif | Bin 0 -> 362 bytes .../icons/full/cview16/team_view.gif | Bin 0 -> 139 bytes .../icons/full/dlcl16/cancelshell.gif | Bin 0 -> 151 bytes .../icons/full/dlcl16/clear.gif | Bin 0 -> 328 bytes .../icons/full/dlcl16/clearall.gif | Bin 0 -> 187 bytes .../icons/full/dlcl16/clearselected.gif | Bin 0 -> 159 bytes .../icons/full/dlcl16/combine_tsk.gif | Bin 0 -> 220 bytes .../icons/full/dlcl16/compile.gif | Bin 0 -> 241 bytes .../icons/full/dlcl16/convertarchive_tsk.gif | Bin 0 -> 332 bytes .../icons/full/dlcl16/deletereference.gif | Bin 0 -> 205 bytes .../icons/full/dlcl16/down.gif | Bin 0 -> 152 bytes .../icons/full/dlcl16/editfilter.gif | Bin 0 -> 203 bytes .../icons/full/dlcl16/exportshellhistory.gif | Bin 0 -> 242 bytes .../icons/full/dlcl16/exportshelloutput.gif | Bin 0 -> 377 bytes .../icons/full/dlcl16/lock.gif | Bin 0 -> 322 bytes .../icons/full/dlcl16/makeProfileActive.gif | Bin 0 -> 596 bytes .../icons/full/dlcl16/makeprofileinactive.gif | Bin 0 -> 388 bytes .../icons/full/dlcl16/monitor_view.gif | Bin 0 -> 334 bytes .../icons/full/dlcl16/move.gif | Bin 0 -> 111 bytes .../icons/full/dlcl16/removeshell.gif | Bin 0 -> 342 bytes .../icons/full/dlcl16/rename.gif | Bin 0 -> 211 bytes .../icons/full/dlcl16/run.gif | Bin 0 -> 359 bytes .../icons/full/dlcl16/searchremovealll.gif | Bin 0 -> 187 bytes .../full/dlcl16/searchremoveselected.gif | Bin 0 -> 159 bytes .../icons/full/dlcl16/selectpool.gif | Bin 0 -> 209 bytes .../icons/full/dlcl16/selectprofile.gif | Bin 0 -> 337 bytes .../icons/full/dlcl16/stop.gif | Bin 0 -> 148 bytes .../icons/full/dlcl16/systemprofile.gif | Bin 0 -> 362 bytes .../icons/full/dlcl16/up.gif | Bin 0 -> 152 bytes .../icons/full/dlcl16/workwithcompilecmds.gif | Bin 0 -> 211 bytes .../icons/full/dlcl16/workwithfilterpools.gif | Bin 0 -> 217 bytes .../icons/full/dlcl16/workwithnamedtypes.gif | Bin 0 -> 217 bytes .../icons/full/dlcl16/workwithuseractions.gif | Bin 0 -> 207 bytes .../icons/full/dlcl16/xtrctarchv_tsk.gif | Bin 0 -> 344 bytes .../icons/full/dlcl16/xtrctarchvto_tsk.gif | Bin 0 -> 346 bytes .../icons/full/dtool16/export_wiz.gif | Bin 0 -> 230 bytes .../icons/full/dtool16/import_wiz.gif | Bin 0 -> 232 bytes .../icons/full/dtool16/new.gif | Bin 0 -> 354 bytes .../icons/full/dtool16/newconnection_wiz.gif | Bin 0 -> 202 bytes .../icons/full/dtool16/newfile_wiz.gif | Bin 0 -> 219 bytes .../icons/full/dtool16/newfilter_wiz.gif | Bin 0 -> 153 bytes .../icons/full/dtool16/newfilterpool_wiz.gif | Bin 0 -> 205 bytes .../full/dtool16/newfilterpoolref_wiz.gif | Bin 0 -> 220 bytes .../icons/full/dtool16/newfolder_wiz.gif | Bin 0 -> 225 bytes .../icons/full/dtool16/newprofile_wiz.gif | Bin 0 -> 573 bytes .../icons/full/dtool16/rmotejar_expt.gif | Bin 0 -> 331 bytes .../icons/full/dtool16/rmotejar_impt.gif | Bin 0 -> 332 bytes .../icons/full/dtool16/rmtarchv_exp.gif | Bin 0 -> 221 bytes .../icons/full/dtool16/rmtarchv_imp.gif | Bin 0 -> 218 bytes .../icons/full/dtool16/rmtexp.gif | Bin 0 -> 130 bytes .../icons/full/dtool16/rmtimp.gif | Bin 0 -> 131 bytes .../icons/full/dtool16/systemshowintable.gif | Bin 0 -> 338 bytes .../icons/full/elcl16/cancelshell.gif | Bin 0 -> 219 bytes .../icons/full/elcl16/clear.gif | Bin 0 -> 545 bytes .../icons/full/elcl16/clearall.gif | Bin 0 -> 204 bytes .../icons/full/elcl16/clearselected.gif | Bin 0 -> 163 bytes .../icons/full/elcl16/combine_tsk.gif | Bin 0 -> 346 bytes .../icons/full/elcl16/compile.gif | Bin 0 -> 366 bytes .../icons/full/elcl16/convertarchive_tsk.gif | Bin 0 -> 359 bytes .../icons/full/elcl16/deletereference.gif | Bin 0 -> 326 bytes .../icons/full/elcl16/down.gif | Bin 0 -> 330 bytes .../icons/full/elcl16/editfilter.gif | Bin 0 -> 337 bytes .../icons/full/elcl16/exportshellhistory.gif | Bin 0 -> 590 bytes .../icons/full/elcl16/exportshelloutput.gif | Bin 0 -> 613 bytes .../icons/full/elcl16/lock.gif | Bin 0 -> 337 bytes .../icons/full/elcl16/makeProfileActive.gif | Bin 0 -> 608 bytes .../icons/full/elcl16/makeprofileinactive.gif | Bin 0 -> 628 bytes .../icons/full/elcl16/monitor_view.gif | Bin 0 -> 572 bytes .../icons/full/elcl16/move.gif | Bin 0 -> 197 bytes .../icons/full/elcl16/removeshell.gif | Bin 0 -> 580 bytes .../icons/full/elcl16/rename.gif | Bin 0 -> 346 bytes .../icons/full/elcl16/run.gif | Bin 0 -> 379 bytes .../icons/full/elcl16/searchremoveall.gif | Bin 0 -> 204 bytes .../full/elcl16/searchremoveselected.gif | Bin 0 -> 163 bytes .../icons/full/elcl16/selectpool.gif | Bin 0 -> 336 bytes .../icons/full/elcl16/selectprofile.gif | Bin 0 -> 346 bytes .../icons/full/elcl16/stop.gif | Bin 0 -> 215 bytes .../icons/full/elcl16/systemprofile.gif | Bin 0 -> 367 bytes .../icons/full/elcl16/systemshowintable.gif | Bin 0 -> 573 bytes .../icons/full/elcl16/up.gif | Bin 0 -> 320 bytes .../icons/full/elcl16/workwithcompilecmds.gif | Bin 0 -> 332 bytes .../icons/full/elcl16/workwithfilterpools.gif | Bin 0 -> 353 bytes .../icons/full/elcl16/workwithnamedtypes.gif | Bin 0 -> 345 bytes .../icons/full/elcl16/workwithuseractions.gif | Bin 0 -> 336 bytes .../icons/full/elcl16/xtrctarchv_tsk.gif | Bin 0 -> 579 bytes .../icons/full/elcl16/xtrctarchvto_tsk.gif | Bin 0 -> 585 bytes .../icons/full/etool16/archive_export.gif | Bin 0 -> 343 bytes .../icons/full/etool16/archive_import.gif | Bin 0 -> 342 bytes .../icons/full/etool16/export_wiz.gif | Bin 0 -> 356 bytes .../icons/full/etool16/import_wiz.gif | Bin 0 -> 357 bytes .../icons/full/etool16/jar_export.gif | Bin 0 -> 552 bytes .../icons/full/etool16/jar_import.gif | Bin 0 -> 552 bytes .../icons/full/etool16/new.gif | Bin 0 -> 612 bytes .../icons/full/etool16/newconnection_wiz.gif | Bin 0 -> 328 bytes .../icons/full/etool16/newfile_wiz.gif | Bin 0 -> 353 bytes .../icons/full/etool16/newfilter_wiz.gif | Bin 0 -> 227 bytes .../icons/full/etool16/newfilterpool_wiz.gif | Bin 0 -> 348 bytes .../full/etool16/newfilterpoolref_wiz.gif | Bin 0 -> 354 bytes .../icons/full/etool16/newfolder_wiz.gif | Bin 0 -> 350 bytes .../icons/full/etool16/newprofile_wiz.gif | Bin 0 -> 586 bytes .../icons/full/etool16/systemshowintable.gif | Bin 0 -> 573 bytes .../icons/full/eview16/commands_view.gif | Bin 0 -> 347 bytes .../icons/full/eview16/editor.gif | Bin 0 -> 591 bytes .../icons/full/eview16/errorlist_view.gif | Bin 0 -> 604 bytes .../icons/full/eview16/system_persp.gif | Bin 0 -> 606 bytes .../icons/full/eview16/system_view.gif | Bin 0 -> 362 bytes .../icons/full/eview16/team_view.gif | Bin 0 -> 139 bytes .../icons/full/misc/IBM_logo.gif | Bin 0 -> 382 bytes .../icons/full/obj16/IBM_logo.gif | Bin 0 -> 382 bytes .../icons/full/obj16/arrowdown_obj.gif | Bin 0 -> 88 bytes .../icons/full/obj16/arrowup_obj.gif | Bin 0 -> 88 bytes .../icons/full/obj16/compcmd_ibm_obj.gif | Bin 0 -> 596 bytes .../icons/full/obj16/compcmd_ibmuser_obj.gif | Bin 0 -> 587 bytes .../icons/full/obj16/compcmd_new_obj.gif | Bin 0 -> 597 bytes .../icons/full/obj16/compcmd_user_obj.gif | Bin 0 -> 563 bytes .../icons/full/obj16/connectorservice_obj.gif | Bin 0 -> 353 bytes .../icons/full/obj16/error.gif | Bin 0 -> 354 bytes .../icons/full/obj16/exportshellhistory.gif | Bin 0 -> 592 bytes .../icons/full/obj16/exportshelloutput.gif | Bin 0 -> 613 bytes .../icons/full/obj16/info.gif | Bin 0 -> 121 bytes .../icons/full/obj16/key.gif | Bin 0 -> 320 bytes .../icons/full/obj16/launcher_config_obj.gif | Bin 0 -> 547 bytes .../icons/full/obj16/properties_obj.gif | Bin 0 -> 578 bytes .../icons/full/obj16/service_obj.gif | Bin 0 -> 563 bytes .../icons/full/obj16/ssl_obj.gif | Bin 0 -> 239 bytes .../icons/full/obj16/system390Live_obj.gif | Bin 0 -> 581 bytes .../icons/full/obj16/system390_obj.gif | Bin 0 -> 357 bytes .../icons/full/obj16/system400_obj.gif | Bin 0 -> 366 bytes .../icons/full/obj16/system400live_obj.gif | Bin 0 -> 384 bytes .../icons/full/obj16/system_persp.gif | Bin 0 -> 606 bytes .../icons/full/obj16/system_search.gif | Bin 0 -> 587 bytes .../icons/full/obj16/systemaix_obj.gif | Bin 0 -> 221 bytes .../icons/full/obj16/systemaixlive_obj.gif | Bin 0 -> 348 bytes .../icons/full/obj16/systemblank.gif | Bin 0 -> 55 bytes .../icons/full/obj16/systemcancel.gif | Bin 0 -> 219 bytes .../icons/full/obj16/systemcommands_obj.gif | Bin 0 -> 578 bytes .../full/obj16/systemcommandslive_obj.gif | Bin 0 -> 589 bytes .../icons/full/obj16/systemconnection.gif | Bin 0 -> 200 bytes .../icons/full/obj16/systemconnectionlive.gif | Bin 0 -> 217 bytes .../icons/full/obj16/systemempty.gif | Bin 0 -> 156 bytes .../icons/full/obj16/systemenvvar.gif | Bin 0 -> 206 bytes .../icons/full/obj16/systemenvvarlibpath.gif | Bin 0 -> 216 bytes .../icons/full/obj16/systemenvvarpath.gif | Bin 0 -> 216 bytes .../icons/full/obj16/systemfailed.gif | Bin 0 -> 138 bytes .../icons/full/obj16/systemfile.gif | Bin 0 -> 354 bytes .../icons/full/obj16/systemfiles_obj.gif | Bin 0 -> 317 bytes .../icons/full/obj16/systemfileslive_obj.gif | Bin 0 -> 339 bytes .../icons/full/obj16/systemfilter.gif | Bin 0 -> 209 bytes .../icons/full/obj16/systemfilterpool.gif | Bin 0 -> 221 bytes .../icons/full/obj16/systemfilterstring.gif | Bin 0 -> 126 bytes .../icons/full/obj16/systemfolder.gif | Bin 0 -> 216 bytes .../icons/full/obj16/systemhelp.gif | Bin 0 -> 373 bytes .../icons/full/obj16/systeminfo.gif | Bin 0 -> 120 bytes .../icons/full/obj16/systemjobs_obj.gif | Bin 0 -> 347 bytes .../icons/full/obj16/systemjobslive_obj.gif | Bin 0 -> 362 bytes .../icons/full/obj16/systemlinux_obj.gif | Bin 0 -> 569 bytes .../icons/full/obj16/systemlinuxlive_obj.gif | Bin 0 -> 591 bytes .../icons/full/obj16/systemlocal_obj.gif | Bin 0 -> 580 bytes .../icons/full/obj16/systemlocallive_obj.gif | Bin 0 -> 592 bytes .../icons/full/obj16/systemok.gif | Bin 0 -> 343 bytes .../icons/full/obj16/systemprocess.gif | Bin 0 -> 245 bytes .../icons/full/obj16/systemprofile.gif | Bin 0 -> 367 bytes .../icons/full/obj16/systemprofile_active.gif | Bin 0 -> 608 bytes .../icons/full/obj16/systemrootdrive.gif | Bin 0 -> 336 bytes .../icons/full/obj16/systemrootdriveopen.gif | Bin 0 -> 339 bytes .../icons/full/obj16/systemsearchresult.gif | Bin 0 -> 586 bytes .../icons/full/obj16/systemshell.gif | Bin 0 -> 357 bytes .../icons/full/obj16/systemshelllive.gif | Bin 0 -> 366 bytes .../icons/full/obj16/systemunix_obj.gif | Bin 0 -> 98 bytes .../icons/full/obj16/systemunixlive_obj.gif | Bin 0 -> 145 bytes .../icons/full/obj16/systemwin_obj.gif | Bin 0 -> 997 bytes .../icons/full/obj16/systemwinlive_obj.gif | Bin 0 -> 1007 bytes .../icons/full/obj16/user_action_ibm_obj.gif | Bin 0 -> 338 bytes .../full/obj16/user_action_ibm_user_obj.gif | Bin 0 -> 361 bytes .../icons/full/obj16/user_action_new_obj.gif | Bin 0 -> 370 bytes .../icons/full/obj16/user_action_obj.gif | Bin 0 -> 353 bytes .../full/obj16/user_type_ibm_new_obj.gif | Bin 0 -> 574 bytes .../icons/full/obj16/user_type_ibm_obj.gif | Bin 0 -> 341 bytes .../full/obj16/user_type_ibm_user_obj.gif | Bin 0 -> 577 bytes .../icons/full/obj16/user_type_new_obj.gif | Bin 0 -> 577 bytes .../icons/full/obj16/user_type_obj.gif | Bin 0 -> 341 bytes .../icons/full/obj16/warning.gif | Bin 0 -> 331 bytes .../icons/full/ovr16/error_ovr.gif | Bin 0 -> 82 bytes .../icons/full/view16/commands_view.gif | Bin 0 -> 347 bytes .../icons/full/view16/editor.gif | Bin 0 -> 591 bytes .../icons/full/view16/errorlist_view.gif | Bin 0 -> 604 bytes .../icons/full/view16/fastopen.gif | Bin 0 -> 1023 bytes .../icons/full/view16/scratchpad_view.gif | Bin 0 -> 346 bytes .../icons/full/view16/system_persp.gif | Bin 0 -> 606 bytes .../icons/full/view16/system_view.gif | Bin 0 -> 362 bytes .../icons/full/view16/team_view.gif | Bin 0 -> 139 bytes .../icons/full/wizban/export_wiz.gif | Bin 0 -> 2816 bytes .../icons/full/wizban/import_wiz.gif | Bin 0 -> 2960 bytes .../icons/full/wizban/newconnection_wiz.gif | Bin 0 -> 2886 bytes .../icons/full/wizban/newfile_wiz.gif | Bin 0 -> 3238 bytes .../icons/full/wizban/newfilter_wiz.gif | Bin 0 -> 3033 bytes .../icons/full/wizban/newfilterpool_wiz.gif | Bin 0 -> 2938 bytes .../icons/full/wizban/newfolder_wiz.gif | Bin 0 -> 2796 bytes .../icons/full/wizban/newprofile_wiz.gif | Bin 0 -> 3229 bytes .../icons/full/wizban/rmote_exprt.gif | Bin 0 -> 2722 bytes .../icons/full/wizban/rmote_imprt.gif | Bin 0 -> 2678 bytes .../icons/full/wizban/rmotearchv_exprt.gif | Bin 0 -> 3500 bytes .../icons/full/wizban/rmotearchv_imprt.gif | Bin 0 -> 3416 bytes .../icons/full/wizban/rmotejar_exprt.gif | Bin 0 -> 3249 bytes .../icons/full/wizban/rmotejar_imprt.gif | Bin 0 -> 3357 bytes .../org.eclipse.rse.ui/messageFile.dtd | 22 + .../org/eclipse/rse/internal/model/Host.java | 660 ++ .../rse/internal/model/IPropertyType.java | 31 + .../eclipse/rse/internal/model/Property.java | 96 + .../rse/internal/model/PropertySet.java | 137 + .../internal/model/PropertySetContainer.java | 90 + .../rse/internal/model/RSEModelObject.java | 61 + .../rse/internal/model/SystemHostPool.java | 627 ++ .../model/SystemModelChangeEvent.java | 118 + .../model/SystemModelChangeEventManager.java | 70 + .../SystemNewConnectionPromptObject.java | 246 + .../model/SystemPostableEventNotifier.java | 60 + .../model/SystemPreferenceChangeEvent.java | 96 + .../model/SystemPreferenceChangeManager.java | 70 + .../rse/internal/model/SystemProfile.java | 242 + .../internal/model/SystemProfileManager.java | 644 ++ .../rse/internal/model/SystemRegistry.java | 3182 +++++++++ .../model/SystemRemoteChangeEventManager.java | 70 + .../model/SystemResourceChangeManager.java | 91 + .../model/SystemRunnableContextWrapper.java | 175 + .../rse/internal/model/SystemScratchpad.java | 94 + .../rse/model/AbstractSystemResourceSet.java | 144 + .../org/eclipse/rse/model/DummyHost.java | 266 + .../model/org/eclipse/rse/model/IHost.java | 213 + .../org/eclipse/rse/model/IProperty.java | 36 + .../org/eclipse/rse/model/IPropertySet.java | 40 + .../rse/model/IPropertySetContainer.java | 30 + .../eclipse/rse/model/IRSEModelObject.java | 25 + .../model/ISubSystemFactoryCategories.java | 37 + .../eclipse/rse/model/ISystemContainer.java | 59 + .../rse/model/ISystemContentsType.java | 36 + .../eclipse/rse/model/ISystemHostPool.java | 179 + .../rse/model/ISystemMessageObject.java | 74 + .../rse/model/ISystemModelChangeEvent.java | 43 + .../rse/model/ISystemModelChangeEvents.java | 104 + .../rse/model/ISystemModelChangeListener.java | 40 + .../model/ISystemPreferenceChangeEvent.java | 45 + .../model/ISystemPreferenceChangeEvents.java | 49 + .../ISystemPreferenceChangeListener.java | 33 + .../org/eclipse/rse/model/ISystemProfile.java | 95 + .../rse/model/ISystemProfileManager.java | 126 + .../rse/model/ISystemPromptableObject.java | 73 + .../eclipse/rse/model/ISystemRegistry.java | 844 +++ .../rse/model/ISystemRemoteChangeEvent.java | 64 + .../rse/model/ISystemRemoteChangeEvents.java | 46 + .../model/ISystemRemoteChangeListener.java | 31 + .../rse/model/ISystemResourceChangeEvent.java | 113 + .../model/ISystemResourceChangeEvents.java | 247 + .../model/ISystemResourceChangeListener.java | 40 + .../eclipse/rse/model/ISystemResourceSet.java | 36 + .../org/eclipse/rse/model/PropertyType.java | 123 + .../rse/model/SystemChildrenContentsType.java | 50 + .../rse/model/SystemEscapeCharHelper.java | 179 + .../model/SystemFilterStringContentsType.java | 47 + .../rse/model/SystemMessageObject.java | 104 + .../rse/model/SystemRemoteChangeEvent.java | 170 + .../model/SystemRemoteElementResourceSet.java | 89 + .../rse/model/SystemRemoteResourceSet.java | 92 + .../rse/model/SystemResourceChangeEvent.java | 190 + .../rse/model/SystemSignonInformation.java | 121 + .../eclipse/rse/model/SystemStartHere.java | 176 + .../rse/model/SystemWorkspaceResourceSet.java | 41 + .../persistence/RSEPersistenceManager.java | 427 ++ .../internal/persistence/SaveRSEDOMJob.java | 57 + .../persistence/dom/RSEDOMExporter.java | 478 ++ .../persistence/dom/RSEDOMImporter.java | 537 ++ .../DefaultRSEPersistenceProvider.java | 138 + .../persistence/IRSEPersistableContainer.java | 28 + .../persistence/IRSEPersistenceManager.java | 125 + .../persistence/IRSEPersistenceProvider.java | 53 + .../rse/persistence/dom/IRSEDOMConstants.java | 89 + .../rse/persistence/dom/IRSEDOMExporter.java | 130 + .../rse/persistence/dom/IRSEDOMImporter.java | 78 + .../eclipse/rse/persistence/dom/RSEDOM.java | 132 + .../rse/persistence/dom/RSEDOMNode.java | 260 + .../persistence/dom/RSEDOMNodeAttribute.java | 57 + .../org.eclipse.rse.ui/plugin.properties | 128 + rse/plugins/org.eclipse.rse.ui/plugin.xml | 1035 +++ .../SystemPersistableReferenceManager.java | 480 ++ .../SystemPersistableReferencedObject.java | 95 + ...stemPersistableReferencedObjectHelper.java | 60 + .../SystemPersistableReferencingObject.java | 179 + ...temPersistableReferencingObjectHelper.java | 68 + .../references/SystemReferencedObject.java | 90 + .../SystemReferencedObjectHelper.java | 98 + .../references/SystemReferencingObject.java | 94 + .../SystemReferencingObjectHelper.java | 84 + ...SystemBasePersistableReferenceManager.java | 174 + ...SystemBasePersistableReferencedObject.java | 49 + ...ystemBasePersistableReferencingObject.java | 51 + .../ISystemBaseReferencedObject.java | 45 + .../ISystemBaseReferencingObject.java | 51 + .../ISystemPersistableReferencedObject.java | 36 + .../ISystemPersistableReferencingObject.java | 66 + .../references/ISystemReferencedObject.java | 34 + .../references/ISystemReferencingObject.java | 35 + rse/plugins/org.eclipse.rse.ui/rseprofile.xsd | 186 + .../schema/archivehandlers.exsd | 141 + .../org.eclipse.rse.ui/schema/compile.exsd | 245 + .../schema/dynamicPopupMenuExtensions.exsd | 134 + .../schema/keystoreProviders.exsd | 134 + .../schema/mountPathMappers.exsd | 134 + .../schema/passwordPersistence.exsd | 119 + .../schema/persistenceProviders.exsd | 134 + .../org.eclipse.rse.ui/schema/popupMenus.exsd | 818 +++ .../schema/propertyPages.exsd | 464 ++ .../remoteSystemsViewPreferencesAction.exsd | 186 + .../schema/rseConfigDefaults.exsd | 142 + .../schema/subsystemConfiguration.exsd | 253 + .../org.eclipse.rse.ui/schema/systemtype.exsd | 160 + .../subsystems/AbstractCacheManager.java | 44 + .../internal/subsystems/AbstractResource.java | 80 + .../IBMServerLauncherConstants.java | 56 + .../internal/subsystems/ServerLauncher.java | 109 + .../SubSystemConfigurationProxy.java | 361 + .../SubSystemFilterNamingPolicy.java | 121 + .../servicesubsystem/IServiceSubSystem.java | 26 + .../IServiceSubSystemConfiguration.java | 40 + .../ServiceSubSystemConfiguration.java | 264 + .../servicesubsystem/SeviceSubSystem.java | 174 + .../subsystems/AbstractConnectorService.java | 1105 ++++ .../AbstractConnectorServiceManager.java | 208 + .../core/subsystems/CommunicationsEvent.java | 46 + .../core/subsystems/IBMServerLauncher.java | 442 ++ .../rse/core/subsystems/ICacheManager.java | 46 + .../subsystems/ICommunicationsListener.java | 49 + .../core/subsystems/IConnectorService.java | 311 + .../subsystems/IConnectorServiceManager.java | 26 + .../rse/core/subsystems/IFileConstants.java | 72 + .../core/subsystems/IIBMServerLauncher.java | 202 + .../rse/core/subsystems/IRemoteContainer.java | 61 + .../core/subsystems/IRemoteLineReference.java | 62 + .../subsystems/IRemoteObjectIdentifier.java | 30 + .../subsystems/IRemoteObjectResolver.java | 34 + .../subsystems/IRemotePropertyHolder.java | 70 + .../core/subsystems/IRemoteSystemEnvVar.java | 78 + .../rse/core/subsystems/IServerLauncher.java | 100 + .../subsystems/IServerLauncherProperties.java | 51 + .../rse/core/subsystems/ISubSystem.java | 660 ++ .../subsystems/ISubSystemConfiguration.java | 598 ++ .../ISubSystemConfigurationProxy.java | 103 + .../RemoteChildrenContentsType.java | 50 + .../rse/core/subsystems/ServerLaunchType.java | 288 + .../rse/core/subsystems/SubSystem.java | 3342 ++++++++++ .../subsystems/SubSystemConfiguration.java | 3049 +++++++++ .../rse/core/subsystems/SubSystemHelpers.java | 113 + .../util/ISubsystemConfigurationAdapter.java | 244 + .../org.eclipse.rse.ui/systemmessages.xml | 1358 ++++ .../rse/core/IRemoteSystemsProject.java | 33 + .../org/eclipse/rse/core/ISystemTypes.java | 74 + .../rse/core/ISystemUserIdConstants.java | 29 + .../eclipse/rse/core/ISystemViewSupplier.java | 38 + .../rse/core/PasswordPersistenceManager.java | 693 ++ .../rse/core/RemoteSystemsProject.java | 97 + .../core/RemoteSystemsTempProjectNature.java | 55 + .../rse/core/SystemAdapterHelpers.java | 113 + .../eclipse/rse/core/SystemBasePlugin.java | 984 +++ .../eclipse/rse/core/SystemElapsedTimer.java | 94 + .../rse/core/SystemPerspectiveHelpers.java | 190 + .../org/eclipse/rse/core/SystemPlugin.java | 1632 +++++ .../SystemPopupMenuActionContributor.java | 594 ++ ...stemPopupMenuActionContributorManager.java | 161 + .../rse/core/SystemPreferencesManager.java | 471 ++ .../rse/core/SystemPropertyPageExtension.java | 368 ++ .../SystemPropertyPageExtensionManager.java | 106 + .../rse/core/SystemRemoteObjectMatcher.java | 588 ++ .../rse/core/SystemResourceConstants.java | 36 + .../rse/core/SystemResourceHelpers.java | 776 +++ .../rse/core/SystemResourceListener.java | 806 +++ .../rse/core/SystemResourceManager.java | 581 ++ .../org/eclipse/rse/core/SystemSorter.java | 73 + .../rse/core/SystemStringTokenizer.java | 108 + .../org/eclipse/rse/core/SystemType.java | 199 + .../ISystemCommunicationsDaemonHandler.java | 44 + .../ISystemCommunicationsDaemonListener.java | 32 + .../core/comm/ISystemKeystoreProvider.java | 33 + .../core/comm/SystemCommunicationsDaemon.java | 446 ++ .../comm/SystemCommunicationsDaemonEvent.java | 50 + .../comm/SystemKeystoreProviderManager.java | 66 + 904 files changed, 177047 insertions(+) create mode 100644 rse/plugins/org.eclipse.rse.ui/.classpath create mode 100644 rse/plugins/org.eclipse.rse.ui/.cvsignore create mode 100644 rse/plugins/org.eclipse.rse.ui/.project create mode 100644 rse/plugins/org.eclipse.rse.ui/HelpContexts.xml create mode 100644 rse/plugins/org.eclipse.rse.ui/META-INF/MANIFEST.MF create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemView.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/AbstractElement.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/GenericMessages.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/GenericMessages.properties create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/IRemoteSelectionAddListener.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemConnectionFormCaller.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemContextMenuConstants.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemDeleteTarget.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemIconConstants.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemMassager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemMessages.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPageCompleteListener.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPreferencesConstants.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemRenameTarget.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemStringsInputAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemThemeConstants.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemVerifyListener.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerAddQuotes.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCase.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCaseOutsideQuotes.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCaseUnlessQuoted.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerRemoveQuotes.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/Mnemonics.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemBaseForm.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemConnectionForm.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemMenuManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemProfileForm.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPropertyResources.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPropertyResources.properties create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemResources.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemResources.properties create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemSortableSelection.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemTabFolderLayout.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemWidgetHelpers.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/DisplayDialogAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/DisplaySystemMessageAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemCopyTargetSelectionCallback.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemDialogAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemDynamicPopupMenuExtension.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemDynamicPopupMenuExtensionManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemWizardAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemAbstractPopupMenuExtensionAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseCopyAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseDialogAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseDummyAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseSubMenuAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseWizardAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingBrowseWithAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingCompareWithAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingExpandToAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingGoToAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingGotoActionOLD.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingNewAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingOpenWithAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingPreferencesAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingPulldownMenuAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingRemoteServerBaseAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingRemoteServersAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingReplaceWithAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingUserIdPerSystemTypeAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingViewAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingWorkWithAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemClearAllPasswordsAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemClearPasswordAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCollapseAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCollapseAllAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCommonDeleteAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCommonRenameAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCommonSelectAllAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemConnectAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemConnectAllSubSystemsAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCopyConnectionAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCopyToClipboardAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemDisconnectAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemDisconnectAllSubSystemsAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemDynamicPopupMenuExtensionManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemExpandAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemMoveConnectionAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemMoveDownConnectionAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemMoveUpConnectionAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemNewConnectionAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemNewConnectionFromExistingConnectionAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemNewProfileAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemOpenExplorerPerspectiveAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemOpenRSEPerspectiveAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPasteFromClipboardAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceQualifyConnectionNamesAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceRestoreStateAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceShowFilterPoolsAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceUserIdPerSystemTypeAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemProfileNameCopyAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemProfileNameSelectAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRefreshAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRefreshAllAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemotePropertiesAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemoteServerStartAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemoteServerStopAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemResolveFilterStringAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRunAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSelectConnectionAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSeparatorAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemShowInMonitorAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemShowInTableAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemShowPreferencesPageAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemStartCommunicationsDaemonAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemStringPromptAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSubMenuManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSubMenuManagerForTesting.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemTablePrintAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemTeamReloadAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemTestFilterStringAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemUpdateConnectionAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemViewExpandToAllAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemViewExpandToBaseAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemWorkOfflineAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemWorkWithProfilesAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/TestPopupMenuAction1.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/EnvironmentVariablesPromptDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISignonValidator.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemPasswordPromptDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemPromptDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemTypedObject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemControlEnableState.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemCopyProfileDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteTableProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteTableRow.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemFilterTableDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPersistancePrompt.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPromptDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPromptDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRemoteResourceDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRenameDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRenameSingleDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRenameTableProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRenameTableRow.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemResolveFilterStringDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectAnythingDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectConnectionDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectFileTypesDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleContentElement.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleContentProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleCopyDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleSelectDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemTestFilterStringDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemUpdateConnectionDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemUserIdPerSystemTypeDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemWizardDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemWorkWithHistoryDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/ISystemChangeFilterPaneEditPaneSupplier.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/ISystemFilterStringEditPaneListener.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemChangeFilterPane.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterDialogInputs.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterDialogInterface.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterDialogOutputs.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterPoolDialogInputs.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterPoolDialogInterface.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterPoolDialogOutputs.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterPoolManagerUIProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterStringEditPane.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterUIHelpers.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterWorkWithFilterPoolsTreeViewer.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/ISystemNewFilterActionConfigurator.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionCopyString.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionDeleteString.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionMoveStringDown.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionMoveStringUp.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionPasteString.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterPoolAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterPoolWizardAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterWizardAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCascadingNewFilterPoolReferenceAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCascadingNewFilterPoolReferenceFPMgrAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCopyFilterAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCopyFilterPoolAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCopyFilterStringAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveDownFilterAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveDownFilterPoolReferenceAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveFilterAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveFilterPoolAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveFilterStringAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveUpFilterAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveUpFilterPoolReferenceAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterNewFilterPoolAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterPoolReferenceSelectAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterRemoveFilterPoolReferenceAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterSelectFilterPoolsAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterWorkWithFilterPoolsAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterWorkWithFilterPoolsRefreshAllAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemNewFilterAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/ISystemFilterWizard.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/ISystemNewFilterWizardConfigurator.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemChangeFilterDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterNewFilterPoolWizard.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterNewFilterPoolWizardDefaultMainPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterNewFilterPoolWizardMainPageInterface.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterPoolWizardDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterPoolWizardInterface.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterWizardDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterWorkWithFilterPoolsDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizard.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardConfigurator.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardInfoPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardMainPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardNamePage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemUnNamedFilterDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/ISystemMessageLine.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/ISystemMessageLineTarget.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/StatusLineManagerAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemDialogPageMessageLine.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageLine.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageStatus.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemUIMessage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemUIMessageFile.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/ISystemQuickOpenPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/ISystemQuickOpenPageContainer.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemOpenQuickOpenDialogAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenDialog.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenPageDescriptor.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenUI.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenUtil.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/ISystemRunnableContext.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/Policy.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemFetchOperation.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemJobRunnableContext.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemProgressDialogRunnableContext.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemSchedulingRule.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/AbstractSystemSubSystemPropertyPageCoreForm.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemConnectionWizardErrorUpdater.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemConnectionWizardPropertyPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemSubSystemPropertyPageCoreForm.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/RemoteSystemsPreferencePage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ServerConnectionSecurityPropertyPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ServerLauncherPropertyPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ServicesPropertyPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SignonPreferencePage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemAbstractPropertyPageExtensionAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemBasePropertyPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemBooleanFieldEditor.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemChangeFilterPropertyPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemComboBoxFieldEditor.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemCommunicationsPreferencePage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemConnectionPropertyPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemConnectionSubSystemsPropertyPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemConnectorServicesPropertyPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterPoolPropertyPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterPoolReferencePropertyPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterPropertyPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterStringPropertyPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemKeyValueFieldEditor.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemLoggingPreferencePage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemPreferenceInitializer.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemRemotePropertyPageNode.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemStringFieldEditor.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemSubSystemPropertyPageCore.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemSubSystemPropertyPageCoreForm.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTeamViewCategoryPropertyPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTeamViewProfilePropertyPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTeamViewSubSystemFactoryPropertyPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTypeFieldEditor.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ISystemValidator.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ISystemValidatorUniqueString.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/IValidatorRemoteSelection.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/SystemNumericVerifyListener.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorArchiveName.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorCompileCommandLabel.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorConnectionName.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFileName.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterName.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterPoolName.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterString.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFolderName.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorIntegerInput.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorIntegerRangeInput.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLocalPath.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLongInput.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLongRangeInput.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorPathName.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorPortInput.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorProfileName.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorRemoteSelection.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorServerPortInput.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSourceType.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSpecialChar.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSystemName.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUniqueString.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserActionCommand.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserActionComment.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserActionName.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserId.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserTypeName.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserTypeTypes.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemRemoteAdapterFactory.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemViewAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/IRSEViewPart.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemDragDropAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemEditableRemoteObject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemLongRunningRequestListener.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemMementoConstants.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemPropertyConstants.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemRemoteElementAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemRemoveElementAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectAllTarget.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectRemoteObjectAPIProviderCaller.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemShellProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemTree.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewActionFilter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewDropDestination.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewElementAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewInputProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewRunnableObject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SubsystemFactoryAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SubsystemFactoryAdapterFactory.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemAbstractAPIProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemActionViewerFilter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemComboBoxCellEditor.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemComboBoxPropertyDescriptor.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemDNDTransferRunnable.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemDecoratingLabelProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemDropActionDelegate.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemEmptyListAPIProviderImpl.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemInheritablePropertyData.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemInheritableTextCellEditor.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemInheritableTextPropertyDescriptor.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemLongRunningRequestEvent.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemPerspectiveLayout.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemPropertySheetForm.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemResolveFilterStringAPIProviderImpl.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemResourceSelectionForm.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemResourceSelectionInputProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemSelectRemoteObjectAPIProviderImpl.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableTreeView.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableTreeViewProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewColumnManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewFilter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewPart.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewSorter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTestFilterStringAPIProviderImpl.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemView.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForConnections.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForFilterPools.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForFilterStrings.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForFilters.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForSubSystems.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAdapterFactory.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewCompositeActionGroup.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewConnectionAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewConnectionSelectionInputProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewDataDragAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewDataDropAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewDummyObject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterPoolAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterPoolReferenceAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterReferenceAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterStringAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewForm.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewLabelAndContentProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewMenuListener.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewMessageAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewNewConnectionPromptAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPart.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPartFrameSource.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPartGotoActionGroup.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPromptableAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewResources.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewResources.properties create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewRootInputAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewScratchpadAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewSubSystemAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/BrowseAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/ClearAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/ClearSelectedAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/MonitorViewPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/MonitorViewWorkbook.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/SystemMonitorUI.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/SystemMonitorViewPart.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/TabFolderLayout.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/BrowseAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/ClearAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/ClearSelectedAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/SystemScratchpadView.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/SystemScratchpadViewPart.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/SystemScratchpadViewProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchClearHistoryAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchCopyToClipboardAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchHistoryAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchRemoveAllMatchesAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchRemoveSelectedMatchesAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchTableView.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchTableViewProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchUI.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewContentProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewLabelProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewPart.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemResourceAdaptableProfile.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamView.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewActiveProfileAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewCategoryAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewCategoryNode.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewContentProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewInputProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewLabelProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewMakeActiveProfileAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewMakeInActiveProfileAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewPart.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewProfileAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewRefreshAllAction.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewResourceAdapterFactory.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewSubSystemFactoryAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewSubSystemFactoryNode.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/EnvironmentVariablesForm.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/GridUtil.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/IBMBaseServerLauncherForm.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/IBMServerLauncherForm.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/IServerLauncherForm.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemAddListener.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemCollapsableSectionListener.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemCombo.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemEditPaneStates.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritButton.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritControl.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritControlLayout.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritableEntryField.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SSLForm.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ServerConnectionSecurityForm.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemCollapsableSection.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemEditPaneStateMachine.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHistoryCombo.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHostCombo.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemPortPrompt.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemSelectConnectionForm.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ConnectorServiceElement.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ConnectorServicesForm.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/FactoryServiceElement.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/PropertyElement.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/PropertySetServiceElement.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/RSEModelServiceElement.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/RootServiceElement.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServerLauncherPropertiesServiceElement.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceElement.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceServiceElement.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceTableContentProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceTableLabelProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServicesForm.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemNewConnectionWizardPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemWizard.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemWizardPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISubSystemPropertiesWizardPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemNewConnectionWizardMainPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemNewConnectionWizardPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemWizard.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemWizardPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SubSystemServiceWizardPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewConnectionWizard.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewConnectionWizardDefaultMainPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewConnectionWizardRenameProfilePage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewProfileWizard.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewProfileWizardMainPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemSubSystemsPropertiesWizardPage.java create mode 100644 rse/plugins/org.eclipse.rse.ui/about.html create mode 100644 rse/plugins/org.eclipse.rse.ui/build.properties create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterConstants.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterContainer.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterContainerReference.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterNamingPolicy.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPool.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolManagerProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolReference.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolReferenceManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolReferenceManagerProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolSelectionValidator.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolWrapper.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolWrapperInformation.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterReference.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterSavePolicies.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterString.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterStringReference.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterPoolWrapper.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterPoolWrapperInformation.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterReference.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterSimple.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterStartHere.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterContainerCommonMethods.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterContainerReferenceCommonMethods.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterNamingPolicy.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterPool.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterPoolManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterPoolReference.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterPoolReferenceManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterString.java create mode 100644 rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterStringReference.java create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/ctool16/new.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/ctool16/newconnection_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/ctool16/newfile_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/ctool16/newfilter_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/ctool16/newfilterpool_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/ctool16/newfilterpoolref_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/ctool16/newfolder_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/ctool16/newprofile_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/cview16/commands_view.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/cview16/editor.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/cview16/errorlist_view.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/cview16/resourceRef_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/cview16/system_persp.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/cview16/system_view.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/cview16/team_view.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/cancelshell.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/clear.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/clearall.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/clearselected.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/combine_tsk.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/compile.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/convertarchive_tsk.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/deletereference.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/down.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/editfilter.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/exportshellhistory.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/exportshelloutput.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/lock.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/makeProfileActive.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/makeprofileinactive.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/monitor_view.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/move.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/removeshell.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/rename.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/run.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/searchremovealll.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/searchremoveselected.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/selectpool.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/selectprofile.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/stop.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/systemprofile.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/up.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/workwithcompilecmds.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/workwithfilterpools.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/workwithnamedtypes.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/workwithuseractions.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/xtrctarchv_tsk.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/xtrctarchvto_tsk.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/export_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/import_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/new.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/newconnection_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/newfile_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/newfilter_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/newfilterpool_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/newfilterpoolref_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/newfolder_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/newprofile_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/rmotejar_expt.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/rmotejar_impt.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/rmtarchv_exp.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/rmtarchv_imp.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/rmtexp.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/rmtimp.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/systemshowintable.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/cancelshell.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/clear.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/clearall.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/clearselected.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/combine_tsk.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/compile.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/convertarchive_tsk.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/deletereference.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/down.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/editfilter.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/exportshellhistory.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/exportshelloutput.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/lock.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/makeProfileActive.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/makeprofileinactive.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/monitor_view.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/move.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/removeshell.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/rename.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/run.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/searchremoveall.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/searchremoveselected.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/selectpool.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/selectprofile.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/stop.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/systemprofile.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/systemshowintable.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/up.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/workwithcompilecmds.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/workwithfilterpools.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/workwithnamedtypes.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/workwithuseractions.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/xtrctarchv_tsk.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/xtrctarchvto_tsk.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/etool16/archive_export.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/etool16/archive_import.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/etool16/export_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/etool16/import_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/etool16/jar_export.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/etool16/jar_import.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/etool16/new.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/etool16/newconnection_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/etool16/newfile_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/etool16/newfilter_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/etool16/newfilterpool_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/etool16/newfilterpoolref_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/etool16/newfolder_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/etool16/newprofile_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/etool16/systemshowintable.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/eview16/commands_view.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/eview16/editor.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/eview16/errorlist_view.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/eview16/system_persp.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/eview16/system_view.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/eview16/team_view.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/misc/IBM_logo.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/IBM_logo.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/arrowdown_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/arrowup_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/compcmd_ibm_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/compcmd_ibmuser_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/compcmd_new_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/compcmd_user_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/connectorservice_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/error.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/exportshellhistory.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/exportshelloutput.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/info.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/key.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/launcher_config_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/properties_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/service_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/ssl_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/system390Live_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/system390_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/system400_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/system400live_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/system_persp.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/system_search.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemaix_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemaixlive_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemblank.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemcancel.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemcommands_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemcommandslive_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemconnection.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemconnectionlive.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemempty.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemenvvar.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemenvvarlibpath.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemenvvarpath.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemfailed.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemfile.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemfiles_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemfileslive_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemfilter.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemfilterpool.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemfilterstring.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemfolder.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemhelp.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systeminfo.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemjobs_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemjobslive_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemlinux_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemlinuxlive_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemlocal_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemlocallive_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemok.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemprocess.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemprofile.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemprofile_active.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemrootdrive.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemrootdriveopen.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemsearchresult.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemshell.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemshelllive.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemunix_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemunixlive_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemwin_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemwinlive_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_action_ibm_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_action_ibm_user_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_action_new_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_action_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_type_ibm_new_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_type_ibm_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_type_ibm_user_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_type_new_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_type_obj.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/obj16/warning.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/ovr16/error_ovr.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/view16/commands_view.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/view16/editor.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/view16/errorlist_view.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/view16/fastopen.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/view16/scratchpad_view.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/view16/system_persp.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/view16/system_view.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/view16/team_view.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/wizban/export_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/wizban/import_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/wizban/newconnection_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/wizban/newfile_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/wizban/newfilter_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/wizban/newfilterpool_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/wizban/newfolder_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/wizban/newprofile_wiz.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/wizban/rmote_exprt.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/wizban/rmote_imprt.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/wizban/rmotearchv_exprt.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/wizban/rmotearchv_imprt.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/wizban/rmotejar_exprt.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/icons/full/wizban/rmotejar_imprt.gif create mode 100644 rse/plugins/org.eclipse.rse.ui/messageFile.dtd create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/Host.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/IPropertyType.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/Property.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/PropertySet.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/PropertySetContainer.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/RSEModelObject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemHostPool.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemModelChangeEvent.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemModelChangeEventManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemNewConnectionPromptObject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemPostableEventNotifier.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemPreferenceChangeEvent.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemPreferenceChangeManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemProfile.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemProfileManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemRegistry.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemRemoteChangeEventManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemResourceChangeManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemRunnableContextWrapper.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemScratchpad.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/AbstractSystemResourceSet.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/DummyHost.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/IHost.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/IProperty.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/IPropertySet.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/IPropertySetContainer.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/IRSEModelObject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISubSystemFactoryCategories.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemContainer.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemContentsType.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemHostPool.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemMessageObject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemModelChangeEvent.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemModelChangeEvents.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemModelChangeListener.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemPreferenceChangeEvent.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemPreferenceChangeEvents.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemPreferenceChangeListener.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemProfile.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemProfileManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemPromptableObject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemRegistry.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemRemoteChangeEvent.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemRemoteChangeEvents.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemRemoteChangeListener.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemResourceChangeEvent.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemResourceChangeEvents.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemResourceChangeListener.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemResourceSet.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/PropertyType.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemChildrenContentsType.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemEscapeCharHelper.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemFilterStringContentsType.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemMessageObject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRemoteChangeEvent.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRemoteElementResourceSet.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRemoteResourceSet.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemResourceChangeEvent.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemSignonInformation.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemStartHere.java create mode 100644 rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemWorkspaceResourceSet.java create mode 100644 rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/internal/persistence/RSEPersistenceManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/internal/persistence/SaveRSEDOMJob.java create mode 100644 rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/internal/persistence/dom/RSEDOMExporter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/DefaultRSEPersistenceProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/IRSEPersistableContainer.java create mode 100644 rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/IRSEPersistenceManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/IRSEPersistenceProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/IRSEDOMConstants.java create mode 100644 rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/IRSEDOMExporter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/IRSEDOMImporter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/RSEDOM.java create mode 100644 rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/RSEDOMNode.java create mode 100644 rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/RSEDOMNodeAttribute.java create mode 100644 rse/plugins/org.eclipse.rse.ui/plugin.properties create mode 100644 rse/plugins/org.eclipse.rse.ui/plugin.xml create mode 100644 rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemPersistableReferenceManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemPersistableReferencedObject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemPersistableReferencedObjectHelper.java create mode 100644 rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemPersistableReferencingObject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemPersistableReferencingObjectHelper.java create mode 100644 rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemReferencedObject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemReferencedObjectHelper.java create mode 100644 rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemReferencingObject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemReferencingObjectHelper.java create mode 100644 rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemBasePersistableReferenceManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemBasePersistableReferencedObject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemBasePersistableReferencingObject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemBaseReferencedObject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemBaseReferencingObject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemPersistableReferencedObject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemPersistableReferencingObject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemReferencedObject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemReferencingObject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/rseprofile.xsd create mode 100644 rse/plugins/org.eclipse.rse.ui/schema/archivehandlers.exsd create mode 100644 rse/plugins/org.eclipse.rse.ui/schema/compile.exsd create mode 100644 rse/plugins/org.eclipse.rse.ui/schema/dynamicPopupMenuExtensions.exsd create mode 100644 rse/plugins/org.eclipse.rse.ui/schema/keystoreProviders.exsd create mode 100644 rse/plugins/org.eclipse.rse.ui/schema/mountPathMappers.exsd create mode 100644 rse/plugins/org.eclipse.rse.ui/schema/passwordPersistence.exsd create mode 100644 rse/plugins/org.eclipse.rse.ui/schema/persistenceProviders.exsd create mode 100644 rse/plugins/org.eclipse.rse.ui/schema/popupMenus.exsd create mode 100644 rse/plugins/org.eclipse.rse.ui/schema/propertyPages.exsd create mode 100644 rse/plugins/org.eclipse.rse.ui/schema/remoteSystemsViewPreferencesAction.exsd create mode 100644 rse/plugins/org.eclipse.rse.ui/schema/rseConfigDefaults.exsd create mode 100644 rse/plugins/org.eclipse.rse.ui/schema/subsystemConfiguration.exsd create mode 100644 rse/plugins/org.eclipse.rse.ui/schema/systemtype.exsd create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/AbstractCacheManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/AbstractResource.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/IBMServerLauncherConstants.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/ServerLauncher.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/SubSystemConfigurationProxy.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/SubSystemFilterNamingPolicy.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/servicesubsystem/IServiceSubSystem.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/servicesubsystem/IServiceSubSystemConfiguration.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/servicesubsystem/ServiceSubSystemConfiguration.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/servicesubsystem/SeviceSubSystem.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/AbstractConnectorService.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/AbstractConnectorServiceManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/CommunicationsEvent.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IBMServerLauncher.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ICacheManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ICommunicationsListener.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IConnectorService.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IConnectorServiceManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IFileConstants.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IIBMServerLauncher.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemoteContainer.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemoteLineReference.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemoteObjectIdentifier.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemoteObjectResolver.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemotePropertyHolder.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemoteSystemEnvVar.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IServerLauncher.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IServerLauncherProperties.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ISubSystem.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ISubSystemConfiguration.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ISubSystemConfigurationProxy.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/RemoteChildrenContentsType.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ServerLaunchType.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystem.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystemConfiguration.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystemHelpers.java create mode 100644 rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/util/ISubsystemConfigurationAdapter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systemmessages.xml create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/IRemoteSystemsProject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/ISystemTypes.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/ISystemUserIdConstants.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/ISystemViewSupplier.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/PasswordPersistenceManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/RemoteSystemsProject.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/RemoteSystemsTempProjectNature.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemAdapterHelpers.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemBasePlugin.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemElapsedTimer.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPerspectiveHelpers.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPlugin.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPopupMenuActionContributor.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPopupMenuActionContributorManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPreferencesManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPropertyPageExtension.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPropertyPageExtensionManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemRemoteObjectMatcher.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemResourceConstants.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemResourceHelpers.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemResourceListener.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemResourceManager.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemSorter.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemStringTokenizer.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemType.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/comm/ISystemCommunicationsDaemonHandler.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/comm/ISystemCommunicationsDaemonListener.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/comm/ISystemKeystoreProvider.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/comm/SystemCommunicationsDaemon.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/comm/SystemCommunicationsDaemonEvent.java create mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/comm/SystemKeystoreProviderManager.java diff --git a/rse/plugins/org.eclipse.rse.ui/.classpath b/rse/plugins/org.eclipse.rse.ui/.classpath new file mode 100644 index 00000000000..a16894a8371 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/.classpath @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/rse/plugins/org.eclipse.rse.ui/.cvsignore b/rse/plugins/org.eclipse.rse.ui/.cvsignore new file mode 100644 index 00000000000..ba077a4031a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/.cvsignore @@ -0,0 +1 @@ +bin diff --git a/rse/plugins/org.eclipse.rse.ui/.project b/rse/plugins/org.eclipse.rse.ui/.project new file mode 100644 index 00000000000..31dbfcb6c3a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/.project @@ -0,0 +1,28 @@ + + + org.eclipse.rse.ui + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/rse/plugins/org.eclipse.rse.ui/HelpContexts.xml b/rse/plugins/org.eclipse.rse.ui/HelpContexts.xml new file mode 100644 index 00000000000..9abcce63f37 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/HelpContexts.xml @@ -0,0 +1,946 @@ + + + + + + + + Click in the columns to change the enablement state or default user ID for a given system type. Disabled system types do not appear in the New Connection wizard. Default user IDs are used when connecting to a remote system of that type. + + + + + Import files from a remote server to a project on your local workstation. + + + + + + Export files from your local workstation to a folder on a remote server. + + + + + +Open a wizard to create a new connection to a remote system. + + + +Move the selected connections up within its profile. This is disabled if the first connection is selected. Connection order is a local preference not shared by the team. + + + +Move a connection down within its profile. This is disabled if the last connection is selected. Connection order is a local preference not shared by the team. + + + + +Use this view to work with the team-sharable artifacts from the Remote System Explorer: connection, filters, user actions and compile commands. These are contained in profiles. Use this view to see the sharable artifacts by profile, and share those artifacts using the popup menu of the root node. + + + + +Open a wizard to create a new profile for partitioning your connections, filters, user actions and compile commands. + + + + +Toggle this profile between active and not active. The Remote Systems view only shows connections, filters, user actions and compile commands from active profiles. + + + + + +Make all the selected profiles active, such that their connections, filters, user actions and compile commands are visible in the Remote Systems view. + + + + + +Make all the selected profiles inactive, such that their connections, filters, user actions and compile commands are not visible in the Remote Systems view. + + + + + + +Rename selected profile. + + + + + +Delete selected profiles, including all of their connections, filters, user actions and compile commands. + + + + +Copy selected profile, including all its connections, filters, user actions and compile commands. + + + + + + +Switch to the Team view, where you can create, delete, copy, rename and activate profiles + + + + +Show connections and filter pools in the Remote Systems view prefixed by profile name. This is recommended if two profiles have connections or filter pools with the same names. + + + +Use this action after receiving Remote System Explorer files from the team repository, such as after a synchronize action. It reloads the contents of the Remote System Explore from the workspace, processing the new files. + + + +Set as the default user ID for a given system type when creating a new connection, or change it for existing connections that inherit the user ID. + + + +Go directly to a preference page. Saves drilling down via Windows->Preferences. + + + +Go directly to the main preference page for the Remote System Explorer. From there, you can also access the subpages. + + + + +Go directly to the main preference page for the LPEX editor. From there, you can also access the subpages. + + + +Specify whether to show filter pools when subsystems are expanded in the Remote Systems view. Filter pools allow you to partition filters into named groups for easier management. + + + +Select this to restore the Remote Systems tree view to its previous expanded state the next time you start the workbench. Previous selections and active connections are also restored. This preference increases the amount of time needed to start the Remote System Explorer, but improves productivity overall since you do not need to reconfigure the view. + + + + +All your connections, filters, and user-defined actions can be shared by your team. Use this to synchronize your latest changes with those of the team. Only valid if a team repository has been identified within the team properties. + + + + +All your connections, filters, and user-defined actions can be shared by your team. Use this to identify the remote repository that will centrally host the Remote Systems Connections project containing all the Remote Systems information. + + + + +Open a wizard to create a new connection to a remote system. By default, the values are used from the selected connection. + + + + +Open a new instance of the Remote Systems view, within its own perspective page. Its contents will start with those of the child of the selected resource. + + + + +Refresh the contents of the current selection. If the node is expanded, all children are re-retrieved successively. + + + + +Open a dialog for renaming the currently selected resources. + + + + +Copy this connection and resources to the same profile, or a different profile. + + + + +Move this connection to a different profile. + + + + +Permanently delete the selected resources. + + + +Ask each subsystem to disconnect from the remote system. Disabled unless at least one subsystem is currently connected. + + + +Open a wizard to create a new filter pool in any profile, and a reference to the new pool in this subsystem. + + + +Add a reference to an existing filter pool to this subsystem. Multiple subsystems can reference the same pool, and subsystems can contain multiple filter pool references. + + + +Open a wizard to create a new filter in the selected or default filter pool. + + + + +For remotely starting or stopping servers (or daemons) on this remote system. + + + +Start this remote server or daemon. + +Stop this remote server or daemon. + + +Select the filter pools referenced by this subsystem. + + + +Work with all filter pools in all active profiles for this subsystem type. + + + +Work with user-defined actions that appear in the pop-up menu of remote system objects for subsystems of this subsystem type. + + + +Work with named types that group one or more resource types into named collections. + + + +Connect this subsystem's service to the remote system identified by the parent connection. This is disabled if already connected. + + + +Disconnect this subsystem's service from the remote system identified by the parent connection. This is disabled if not connected. + + + +Clear the password retained in memory after this subsystem is disconnected. This is disabled if not connected, or there is no password cached in memory. + + + +Copy this filter pool, and all of its filters, to another profile, or copy and rename to the same profile. + + + +Move this filter pool to another profile. + + + +Remove this subsystem's reference to this filter pool. This action does not delete the filter pool. + + + +Move the selected filter pool references up within this subsystem. This is disabled if first filter pool reference is selected. + + + +Move the selected filter pool references down within this subsystem. This is disabled if the last filter pool reference is selected. + + + +Open a wizard to create a new filter string within the selected filter. + + + +Change this filter by adding, editing, removing or re-ordering filter strings within it + + +Copy the selected filters to a different filter pool, or copy and rename in the same pool. + + + +Move the selected filters to a different filter pool. + + + +Move the selected filters up within their filter. This is disabled if the first filter is selected. + + + +Move the selected filters down within their filter pool. This is disabled if the last filter is selected. + + + +Edit this filter string. + + + +Copy the selected filter strings to a different filter. + + + +Move the selected filter strings to a different filter. + + + +Move the selected filter strings up within their filter. This is disabled if the first filter string is selected. + + + +Move the selected filter strings down within their filter. This is disabled if the last filter string is selected. + + + +Run the selected prompt to open a wizard to create a new object. + + +Copy the selected folders or files. You will be prompted for the target folder, and for a new name if a folder or file name is already in use in that target folder. + + + +Move the selected folders or files. You will be prompted for the target folder, and for a new name if a folder or file name is already in use in that target folder. + + + +Open a wizard to create a new filter from the selected folder. + + + +Launch a command shell on the remote host. The Remote Shell view will allow you to interact with the remote shell. + + + +Run a command on the remote host. You will be prompted for the command to run on the host. + + + +Search files and file contents within the selected folder. You will be prompted with the Remote Search dialog. + + + +Copy the selected resource to the system clipboard. + + + +Paste the contents of the system clipboard into the selected resource. + + + +Extract the selected archive's contents to the same folder in which the archive is located. A new folder will be created with the same name as the archive for the archive's contents. + + + +Extract the selected archive's contents to another folder. You will be prompted to select the destination folder. + + + +Combine the selected archives into a single archive. You will be prompted to create the destination archive. + + + +Convert the selected archives into another type of archive. You will be prompted to create the destination archive. + + + +Add the selected files to a new or existing archive. You will be prompted to select or create the destination archive. + + + +Select a command to compile this resource with. The command will first be prompted, then run. + + +Select a command to compile this resource with. The command will be run without prompting. + + +Compile the selected resource with this compile command. The command is prompted first, then run. + + +Compile the selected resource with this compile command. The command is not prompted. + + +Work with commands for compiling selected resources. + + + + +Specify a new, unique name for the profile. Profiles can be unique to a person and specific to a task, such as Release 1. + + +Specify the name for the copied profile. + + +Specify if the new copied profile is to be made active. If active, its connections are visible. + + + + +This wizard will guide you through the creation of a new profile to hold connections and filters. Profiles are folders that hold connections and filter pools. They enable team support by allowing you to decide which connections will be private and which will be shared. Team members only see connections within the profiles they make active. + + +Specify a name for the profile. This might be a personal name that is unique within the team, or a name such as Release 1. + + +If you do not make this profile active, its connections will not be visible. If you want to share the profile, inform other team members to make it active after team synchronization. + + + + +This is your first connection. Connections are grouped into profiles to facilitate team sharing. Specify the name for your personal profile to contain connections unique to you. The default is your local machine hostname. + + + + +Specify the information needed to create a connection to a remote system. + + +Select a profile to contain this connection. + + +Arbitrary name for this connection. It must be unique to this profile. + + +Operating system type of the remote host. + + +Hostname or IP address of the remote host. + + +Default user ID that is used by subsystems that do not have a specific user ID. If the arrow is to the left, the user ID comes from the preferences settings for this system type, and can only be changed. Changing it affects all connections that inherit this user ID. If you toggle the arrow to the right, the user ID will be set locally for this connection and not inherited from the preferences setting. + + +A brief description of the connection. + + + + +Set the default user ID for all connections to systems of the selected type. This can be overridden within a particular connection or connection subsystem. + + + + +Specify the new name for the selected resource. + + + +Indicate whether to overwrite the existing resource or specify a unique name. + + + + + +Specify the new name for the selected profile. + + + + +Specify the new name for each of the selected resources. Use the Tab key to move to the next resource name. + + + + +Specify the new name for each of the selected profiles. Use the Tab key to move to the next profile name. + + + + + +Delete or re-order the items in the drop-down list. The items all represent previously-typed or selected values for this drop-down list. + + + + +Select the target profile. The connection's profile is preselected. If you select the existing parent profile, you will be asked to rename the connection. + + + + +Confirm that you want to delete the selected resources that are listed. Select Delete to confirm the deletion. Select Cancel if you decide not to delete the resources. + + + + +Confirm that you want to delete the selected profiles that are listed, including their connections, filters and user actions. Select Delete to confirm the deletion. Select Cancel if you decide not to delete the profiles. + + + + +Select the target profile. The connection's profile is preselected. If you select the existing parent profile, you will be asked to rename the connection. + + + + +Select the target profile. The connection's profile is excluded. + + + + +Select the filter pools to reference in this subsystem. All filters from the referenced pools will be available when the subsystem is expanded. + + + + +Create, delete, rename, copy, and move filter pools. The filter pools for each active profile are listed under that profile. Select a profile or filter pool to enable the toolbar actions. The actions are also available in the pop-up menu. + + + + +Select the target profile. The filter pool's profile is preselected. If you select the existing parent profile, you will be asked to rename the filter pool. + + + + +Select the target profile. The filter pool's profile is excluded. + + + + +Select the target filter pool within a profile. If you select the existing parent filter pool, you will be asked to rename the filter. + + + + +Select the target filter pool within a profile. + + + + +Use this dialog to change your filter. Filters can contain one or more filter strings. In the Remote Systems view, when a filter is expanded, the results of resolving all the strings are concatenated together. Use this dialog to add additional strings, and to order, delete or change the strings. Use the context menu on a string for additional actions. + + +Delete the selected filter string. You will be asked to confirm your action. + +Copy the selected filter string to the clipboard. The copy can be pasted to create a new filter string. + +Paste a copy of a filter string from the clipboard. + +Move the selected filter string up in the list. + +Move the selected filter string down in the list. + + + +Select the target filter within a profile and filter pool. + + + + +Select the target filter within a profile and filter pool. + + + + +This view shows the commands that have been run on remote systems, along with the resulting messages. + + + + +Browse or update information about the selected connection. + + + + +Browse or update information about the selected subsystem. + + + + +Browse information about the selected filter pool reference. Subsystems contain references to filter pools that physically exist within profiles. Multiple subsystems can reference the same filter pool. + + + + +Browse information about the filter pool being referenced. Subsystems contain references to filter pools that physically exist within profiles. Multiple subsystems can reference the same filter pool. + + + + +Browse information about the selected filter. + + + + +Browse information about the selected filter string. + + + +Specify the name and parent profile for the new filter pool. Profiles own filter pools, while subsystems reference them. + + + + +Specify a unique name for the filter, and click Add to create one or more filter strings. When this filter is expanded, the filter strings will be resolved and the results listed in the tree. + + + +On this page, specify a unique name for the filter, and whether it is unique for this connection or will appear in all applicable connections. For the latter, you also specify what filter pool to contain the filter. + + + + +Select the folder where you want to copy the selected folders or files. The folder they exist in is pre-selected. If you leave this as the default, you will be prompted for new names for the copied folders and files. + + + + +Select the folder where you want to move the selected folders or files. The folder they exist in is pre-selected. If you leave this as the default, you will be prompted for new names for the moved folders and files. + + + +Specify the user ID and password used to log onto the remote system. + + + +Specify the settings used by the Remote System Explorer. + + + +This view lets you create connections to remote systems and work with them. + + + +This wizard will guide you through the creation of a new file. + + + +This wizard will guide you through the creation of a new folder. + + + +This command creates a new file. + + + +This command creates a new folder resource. + + + +This command copies an object to another location. + + + +This command moves an object to another location. + + + +Specify options for the Files System. + + + + + + + +This wizard will guide you through the creation of a filter string for listing files. + + + + +This dialog updates your filter string that are used for listing files. + + + + + Type or select the fully-qualified folder of the files that you want to list. + + + +Select this to list all files, or all files whose name meets a generic pattern. + + + +Specify a simple file name or a generic name pattern, containing up to 2 wildcard characters *. For example, abc*def*. Specify * to list all files. + + + +Select this to list all files that match one or more file types. + + + +Click Select to choose one or more file types to restrict. Only files of the selected types will be shown for this filter string. + + + +Select this to list only matching files within the given folder. Deselect this to list all folders within the given folder. + + + +Select this to test the filter string and see the list of files that match its criteria. + + + + +Collapses all currently expanded resources in the Remote Systems view. + + + + +Collapses all selected resources in the view. + + + +Expands all selected resources in the view. + + +Use this dialog to create or edit user actions that appear in the User Actions pop-up menu for remote objects. Each active profile can contain unique actions, and all applicable actions from all active profiles are shown in the User Actions menu. +The list on the left shows the existing user actions: +- To create a new action, select the "New" node at the top of the list, enter information in the edit pane on the right, and press the Create button. +- To edit an existing action, select the action in the list, update the information in the edit pane on the right, and press the Apply button. +- To copy, paste, delete or re-order existing actions, use the pop-up menu. + + + + + + +Use this dialog to create or edit named types, which are named collections of resource types. These named types make it easier to identify resources which match one or more resource types. +The list on the left shows the existing named types: +- To create a new type, select the "New" node at the top of the list, enter information in the edit pane on the right, and press the Create button. +- To edit an existing type, select the type in the list, update the information in the edit pane on the right, and press the Apply button. +- To copy, paste, delete or re-order existing types, use the pop-up menu. +IBM-supplied types cannot be edited, but you can create a new type based on them by using copy and paste. + +Enter a comma-separated list of file extensions or file names. For file names that have no extension, such as "makefile", specify ".null" for the extension, as in "makefile.null". + + +Delete the selected action or type. You will be asked to confirm your action. + +Copy the selected action or type to the clipboard. + +Paste an action or type from the clipboard. You will be asked for a new name. + +Move the selected action or type up in the list. + +Move the selected action or type down in the list. + +Restore the action or type to its values as originally supplied by IBM. + + +Use this dialog to create or edit compile commands that appear in the Compile pop-up menu for remote resources. Each active profile can contain unique compile commands, and all applicable commands from all active profiles are shown in the Compile menu. +The list on the left shows the existing compile commands: +- To create a new compile command, select the "New" node at the top of the list, enter information in the edit pane on the right, and press the Create button. +- To edit an existing compile command, select the command in the list, update the information in the edit pane on the right, and press the Apply button. +- To copy, paste, delete or re-order existing compile commands, use the pop-up menu. + + + +Delete the selected compile command. You will be asked to confirm your action. + +Copy the selected compile command to the clipboard. The copy can be pasted to create a new compile command. + +Paste a copy of a compile command from the clipboard. + +Move the selected compile command up in the list. + +Move the selected compile command down in the list. + +Restore the compile command to its values as originally supplied by IBM. + + + +Use the password information preference page to add, change, and remove stored passwords for remote systems. The stored passwords are used whenever a password is required to connect to the remote system. + + + +Type the password information for the remote system and click OK to save the information or Cancel to exit without saving. + + + +Modify the saved password information for the remote system and click OK to update the saved information or Cancel to exit without updating. + + + + + +Use the subsystem property page to see and edit common information about the subsystem: +Vendor: - the company who created this subsystem +Name: - the name of this subsystem, as shown in the Remote Systems view +Parent connection: - the connection that owns this subsystem +Parent profile: - the system profile that owns the connection +Port: - the port used for the communication between this client, and the remote server for this subsystem +User ID: - the user ID to use to signon to the remote server + + + + + +Use the environment variables property page to specify environment variables for the remote system. These environment variables will be set when the remote system is connected. Any changes made to the environment variables while connected, will not be set on the remote system until it is disconnected and reconnected. + + +Type the name and value for the new environment variable. Click OK to add the new environment variable or Cancel to exit without adding it. + + +Modify the name or value for the environment variable. Click OK to update the existing environment variable or Cancel to exit without modifying. + + + + +Use the server launcher settings property page to specify how to connect to a remote server on the remote system. To connect to a remote Linux, Unix or Windows host you must first install the Remote System Explorer server on the remote host. + + + + +Indicate that a connection should be established with a server on the remote system using the remote daemon to start the server. To use this option, the remote daemon must be running on the remote system. + + +Indicate that a connection should be established with a server on the remote system using the REXEC service to start the server. To use this option, the REXEC service must be running on the remote system. + + +Indicate that a connection should be established with a server that is already running on some known port. To use this option, the server needs to be started up before attempting to connect in the Remote System Explorer. + + +Specify the location of the server installed on the host. REXEC uses this location to determine where to run the startup script from. + + +Specify the name of the command or script that REXEC needs to run to invoke the server installed on the host. + + + + + + +To connect to a remote Linux, Unix or Windows host you must first install the Remote System Explorer server on the remote host. + + + + + + + +Specify a command to run on the remote system. + + + + +Specify a search string and optionally limit the search to a subset of files by specifying file name patterns. Leave the search string empty to search for files only. + + + +Opens Remote Search dialog page for text and file searching on remote systems. + + + + +Specify the name and location of a new folder which will be created to hold the extracted contents of the archive. + + + + +Specify the name, type and location of a new file which will be created to hold the combined archives. + + + + +Specify the name, type and location of the file to which the archive will be converted. + + + + +Specify the name, type and location of the archive file to which the selected files will be added. + + + + +Specify a name filter to use in locating objects in the view. + + + + +Specify a set of property filters to use as criteria in populating the table. + + + + +Specify the list of columns and the order in which to display them in the table. + + + + +This view lets you view the contents and properties of remote objects. + + + + +This view shows you the results of a remote file search. + + + + +This view allows you to run and view shell commands. + + + + +Drag and drop objects here from other Remote Systems Explorer views to work with them in isolation. + + + + +This view shows you errors, warnings and informational messages resulting from a compile command. + + + + +You are about to save your changes to a file on the remote system that has been modified since you started editing. Choose whether you want to overwrite the remote file, replace your changes with those of the file on the remote system, save your changes to another remote file or cancel the save. + + + + +You have made changes to this file during a previous editing session that have not been saved on the remote system. If you open the remote file, you will lose all pending changes. Choose whether you want to replace your changes with the remote file, keep your changes or cancel the operation. You will be able to save your file to a different location without overwriting the remote file if you choose to keep your pending changes. + + + +Select this option to enable the help to work in the CODE tools, and VisualAge RPG tools. It uncompresses the html help files for these tools. + + + + + +This is the RSE communications preferences page. These preferences are not specific to any single RSE connection. The RSE communications daemon can be used by local Workbench functions to listen for incoming socket requests from remote systems. The daemon can be started and stopped from the pull down menu in the RSE's Remote Systems view. + +Use the start RSE communications daemon checkbox to automatically start the daemon when the Workbench is started. + +Use the port preference to change which local TCP/IP port the daemon uses to listen for incoming requests. A valid TCP/IP port number must be entered. If the port is changed and the daemon is currently running then the daemon will be stopped and restarted on the new port when the preference page is closed. + + + + +This is the RSE file cache preference page. + +Use this page to limit the amount of disk space used to store locally replicated remote files. + +Use the clear button to remove all cached files. + + + + + +This action starts and stops the local Remote System Explorer (RSE) communications daemon. This daemon is not directly used by individual RSE connections. Instead it allows local Workbench functions to accept incoming socket requests from remote systems. You can set the daemon to automatically start and configure the port used by the daemon in the Workbench preferences under Remote Systems->Communications. + + + + + + +The Work Offline action toggles the connection between offline and online modes. In offline mode information is retrieved from the cache if available and supported by the connection type. If the action currently has a check mark beside it then the connection is offline and selecting this action will put the connection in online mode so it can be connected to the remote system. + + +Select the Work Offline property to set the connection offline. In offline mode the connection cannot be connected to the remote system. Information is retrieved from the cache if available and supported by the connection type. + + + + +This is the RSE SSL preference page. +From here you can manage the certificates that the RSE client uses when connecting to a server that is configured to use SSL. + + + +Use the server connection security property page to indicate whether the server you are connecting to is running in SSL mode. + + + + \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/META-INF/MANIFEST.MF b/rse/plugins/org.eclipse.rse.ui/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..dfbb817caad --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/META-INF/MANIFEST.MF @@ -0,0 +1,56 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %plugin.name +Bundle-SymbolicName: org.eclipse.rse.ui;singleton:=true +Bundle-Version: 1.0.0 +Bundle-Activator: org.eclipse.rse.core.SystemPlugin +Bundle-Localization: plugin +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.rse.services, + org.eclipse.rse.logging, + org.eclipse.core.resources, + org.eclipse.jface.text, + org.eclipse.ui.views, + org.eclipse.ui.forms, + org.eclipse.ui.ide, + org.eclipse.debug.ui, + org.eclipse.ui.workbench.texteditor +Eclipse-LazyStart: true +Export-Package: org.eclipse.rse.core, + org.eclipse.rse.core.comm, + org.eclipse.rse.core.internal.subsystems, + org.eclipse.rse.core.servicesubsystem, + org.eclipse.rse.core.subsystems, + org.eclipse.rse.core.subsystems.util, + org.eclipse.rse.filters, + org.eclipse.rse.internal.filters, + org.eclipse.rse.internal.model, + org.eclipse.rse.internal.persistence, + org.eclipse.rse.internal.persistence.dom, + org.eclipse.rse.internal.references, + org.eclipse.rse.model, + org.eclipse.rse.persistence, + org.eclipse.rse.persistence.dom, + org.eclipse.rse.references, + org.eclipse.rse.ui, + org.eclipse.rse.ui.actions, + org.eclipse.rse.ui.dialogs, + org.eclipse.rse.ui.filters, + org.eclipse.rse.ui.filters.actions, + org.eclipse.rse.ui.filters.dialogs, + org.eclipse.rse.ui.messages, + org.eclipse.rse.ui.open, + org.eclipse.rse.ui.operations, + org.eclipse.rse.ui.propertypages, + org.eclipse.rse.ui.validators, + org.eclipse.rse.ui.view, + org.eclipse.rse.ui.view.monitor, + org.eclipse.rse.ui.view.scratchpad, + org.eclipse.rse.ui.view.search, + org.eclipse.rse.ui.view.team, + org.eclipse.rse.ui.widgets, + org.eclipse.rse.ui.widgets.services, + org.eclipse.rse.ui.wizards +Bundle-Vendor: Eclipse.org +Bundle-ClassPath: systems.jar 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 new file mode 100644 index 00000000000..dc8200f5633 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemView.java @@ -0,0 +1,5846 @@ +/******************************************************************************** + * 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 java.util.ArrayList; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Vector; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +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.IDoubleClickListener; +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.ITreeContentProvider; +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.TreeViewer; +import org.eclipse.jface.viewers.ViewerFilter; +import org.eclipse.jface.window.SameShellProvider; +import org.eclipse.rse.core.SystemAdapterHelpers; +import org.eclipse.rse.core.SystemElapsedTimer; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.SystemPopupMenuActionContributorManager; +import org.eclipse.rse.core.SystemPreferencesManager; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterContainer; +import org.eclipse.rse.filters.ISystemFilterContainerReference; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.filters.ISystemFilterString; +import org.eclipse.rse.filters.ISystemFilterStringReference; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemContainer; +import org.eclipse.rse.model.ISystemMessageObject; +import org.eclipse.rse.model.ISystemPromptableObject; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.ISystemRemoteChangeEvent; +import org.eclipse.rse.model.ISystemRemoteChangeEvents; +import org.eclipse.rse.model.ISystemRemoteChangeListener; +import org.eclipse.rse.model.ISystemResourceChangeEvent; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.ISystemResourceChangeListener; +import org.eclipse.rse.model.ISystemResourceSet; +import org.eclipse.rse.model.SystemRemoteElementResourceSet; +import org.eclipse.rse.model.SystemRemoteResourceSet; +import org.eclipse.rse.references.ISystemBaseReferencingObject; +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.SystemMenuManager; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.actions.ISystemAction; +import org.eclipse.rse.ui.actions.SystemCascadingGoToAction; +import org.eclipse.rse.ui.actions.SystemCollapseAction; +import org.eclipse.rse.ui.actions.SystemCommonDeleteAction; +import org.eclipse.rse.ui.actions.SystemCommonRenameAction; +import org.eclipse.rse.ui.actions.SystemCommonSelectAllAction; +import org.eclipse.rse.ui.actions.SystemExpandAction; +import org.eclipse.rse.ui.actions.SystemNewConnectionAction; +import org.eclipse.rse.ui.actions.SystemOpenExplorerPerspectiveAction; +import org.eclipse.rse.ui.actions.SystemRefreshAction; +import org.eclipse.rse.ui.actions.SystemRemotePropertiesAction; +import org.eclipse.rse.ui.actions.SystemShowInMonitorAction; +import org.eclipse.rse.ui.actions.SystemShowInTableAction; +import org.eclipse.rse.ui.actions.SystemSubMenuManager; +import org.eclipse.rse.ui.messages.ISystemMessageLine; +import org.eclipse.rse.ui.messages.SystemMessageDialog; +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.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.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.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.dialogs.PropertyDialogAction; +import org.eclipse.ui.part.EditorInputTransfer; +import org.eclipse.ui.part.PluginTransfer; +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. + */ +public class SystemView extends TreeViewer implements ISystemTree, + ISystemResourceChangeListener, + ISystemRemoteChangeListener, + IMenuListener, + //MenuListener, + //IDoubleClickListener, + //ArmListener, + ISelectionChangedListener, + ISelectionProvider, + ITreeViewerListener, + ISystemResourceChangeEvents, + ISystemDeleteTarget, + ISystemRenameTarget, + ISystemSelectAllTarget + //, IWireEventTarget +{ + + protected Shell shell; // shell hosting this viewer + 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 + protected SystemNewConnectionAction newConnectionAction; + protected SystemRefreshAction refreshAction; + protected PropertyDialogAction propertyDialogAction; + protected SystemRemotePropertiesAction remotePropertyDialogAction; + protected SystemCollapseAction collapseAction; // defect 41203 + protected SystemExpandAction expandAction; // defect 41203 + protected SystemOpenExplorerPerspectiveAction openToPerspectiveAction; + + protected SystemShowInTableAction showInTableAction; + protected SystemShowInMonitorAction showInMonitorAction; + protected GoIntoAction goIntoAction; + protected SystemCascadingGoToAction gotoActions; + // 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 + // special flags needed when building popup menu, set after examining selections + 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; + public boolean doTimings = false; + public SystemElapsedTimer elapsedTime = new SystemElapsedTimer(); + // 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); + this.shell = shell; + this.inputProvider = inputProvider; + this.inputProvider.setShell(shell); // DY: defect 44544 + 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); + this.shell = shell; + this.inputProvider = inputProvider; + this.inputProvider.setShell(shell); // DY: defect 44544 + 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); + this.shell = shell; + this.inputProvider = inputProvider; + this.inputProvider.setShell(shell); // DY: defect 44544 + 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); + this.shell = shell; + this.inputProvider = inputProvider; + this.inputProvider.setShell(shell); // DY: defect 44544 + this.messageLine = msgLine; + init(); + } + + /** + * Set the input provider. Sometimes this is delayed, or can change. + */ + public void setInputProvider(ISystemViewInputProvider inputProvider) + { + this.inputProvider = inputProvider; + inputProvider.setViewer(this); + inputProvider.setShell(getShell()); // DY: Defect 44544, shell was not being set for Test dialogs, when they + // tried to connect there was not shell for the password prompt + // and an error message (expand failed) occured. + 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) + { + setLabelProvider(new DecoratingLabelProvider(lcProvider, SystemPlugin.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator())); + 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 + + // 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 + // ---------------------------------------- + SystemPlugin.getTheSystemRegistry().addSystemResourceChangeListener(this); + SystemPlugin.getTheSystemRegistry().addSystemRemoteChangeListener(this); + // ----------------------------- + // Enable right-click popup menu + // ----------------------------- + menuMgr = new MenuManager("#PopupMenu"); + 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. + * Opens editor if file double-clicked. + */ + protected void handleDoubleClick(DoubleClickEvent event) + { + if (!enabledMode) + { + //event.doit = false; + return; + } + IStructuredSelection s= (IStructuredSelection) event.getSelection(); + Object element= s.getFirstElement(); + if (element == null) + return; + ISystemViewElementAdapter adapter = getAdapter(element); + boolean alreadyHandled = false; + if (adapter != null) + alreadyHandled = adapter.handleDoubleClick(element); + if (!alreadyHandled && isExpandable(element)) + { + boolean expandedState = getExpandedState(element); + setExpandedState(element, !expandedState); + // DY: fire collapse / expand event + if (expandedState) { + fireTreeCollapsed(new TreeExpansionEvent(this, element)); + } else { + fireTreeExpanded(new TreeExpansionEvent(this, element)); + } + return; + } + } + /** + * Handles key events in viewer. + */ + void handleKeyPressed(KeyEvent event) + { + if ((event.character == SWT.DEL) && (event.stateMask == 0) && (((IStructuredSelection)getSelection()).size()>0) ) + { + scanSelections("handleKeyPressed"); + /* 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; idx0)) + { + for (int idx=0; idxfrom popup menu + return newConnectionAction; + } + /** + * Return the refresh action + */ + public IAction getRefreshAction() + { + if (refreshAction == null) + refreshAction = new SystemRefreshAction(getShell()); + return refreshAction; + } + /** + * Return the collapse action + */ + public IAction getCollapseAction() + { + if (collapseAction == null) + collapseAction = new SystemCollapseAction(getShell()); + return collapseAction; + } + /** + * Return the expand action + */ + 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.setToolTipText(" "); + } + propertyDialogAction.selectionChanged(getSelection()); + return propertyDialogAction; + } + /** + * Rather than pre-defining this common action we wait until it is first needed, + * for performance reasons. + */ + public SystemRemotePropertiesAction getRemotePropertyDialogAction() + { + if (remotePropertyDialogAction == null) + { + remotePropertyDialogAction = new SystemRemotePropertiesAction(getShell()); + } + remotePropertyDialogAction.setSelection(getSelection()); + return remotePropertyDialogAction; + } + /** + * 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); + 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); + return deleteAction; + } + /* + * Get the common "Open to->" action for opening a new Remote Systems 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 Systems 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 Systems 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, and then re-expand it one element deep. + * Called by com.ibm.etools.systems.SystemBaseElement. + */ + //public void refreshElementChildren(ISystemBaseElement element) + //{ + // boolean expanded = isElementExpanded(element); + // collapseElement(element, true); // collapse and delete children + // if (expanded) + // expandToLevel(element, 1); // re-expand + //} + /** + * Helper method to collapse a node in the tree. + * Called when a currently expanded subsystem is disconnected. + * @param 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()); + } + 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"); + + // ADD COMMON ACTIONS... + + // COMMON REFRESH ACTION... + if (showRefresh()) + { + menu.appendToGroup(ISystemContextMenuConstants.GROUP_BUILD, getRefreshAction()); + 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); + } + + // ADAPTER SPECIFIC ACTIONS + 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; + + while (elements.hasNext() && !skipAdapterActions) + { + Object element= elements.next(); + if (adapter == null) + { + adapter = getAdapter(element); + } + else if (adapter != getAdapter(element)) + { + // selected elements have different adapters + skipAdapterActions = true; + } + //if (adapter != null) + // adapters.put(adapter,element); // want only unique adapters + } + + //Enumeration uniqueAdapters = adapters.keys(); + if (!skipAdapterActions && adapter != null) + { + 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 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() ); + try{ + item.setInputs(getShell(), this, selection); + } catch (Exception e) + { + SystemPlugin.logError("Error configuring action " + item.getClass().getName(),e); + } + } + else if (items[idx] instanceof SystemSubMenuManager) + { + SystemSubMenuManager item = (SystemSubMenuManager)items[idx]; + item.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 (!selectionIsRemoteObject) // is not a remote object + { + PropertyDialogAction pdAction = getPropertyDialogAction(); + if (pdAction.isApplicableForSelection()) + menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); + // GO INTO ACTION... + // OPEN IN NEW WINDOW ACTION... + if (fromSystemViewPart && showOpenViewActions()) + { + GoIntoAction goIntoAction = getGoIntoAction(); + goIntoAction.setEnabled(selection.size()==1); + menu.appendToGroup(ISystemContextMenuConstants.GROUP_GOTO, goIntoAction); + + SystemOpenExplorerPerspectiveAction openToPerspectiveAction = getOpenToPerspectiveAction(); + openToPerspectiveAction.setSelection(selection); + menu.appendToGroup(openToPerspectiveAction.getContextMenuGroup(), openToPerspectiveAction); + + if (showGenericShowInTableAction()) + { + SystemShowInTableAction showInTableAction = getShowInTableAction(); + showInTableAction.setSelection(selection); + menu.appendToGroup(openToPerspectiveAction.getContextMenuGroup(), showInTableAction); + + SystemShowInMonitorAction showInMonitorAction = getShowInMonitorAction(); + showInMonitorAction.setSelection(selection); + menu.appendToGroup(openToPerspectiveAction.getContextMenuGroup(), showInMonitorAction); + + } + } + } + else // is a remote object + { + //Object firstSelection = selection.getFirstElement(); + //ISystemRemoteElementAdapter remoteAdapter = getRemoteAdapter(firstSelection); + //logMyDebugMessage(this.getClass().getName(), ": there is a remote adapter"); + SystemRemotePropertiesAction pdAction = getRemotePropertyDialogAction(); + if (pdAction.isApplicableForSelection()) + menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); + //else + //logMyDebugMessage(this.getClass().getName(), ": but it is not applicable for selection"); + // -------------------------------------------------------------------------------------------------------------------- + // look for and add any popup menu actions registered via our org.eclipse.rse.core.popupMenus extension point... + // -------------------------------------------------------------------------------------------------------------------- + if (fromSystemViewPart) // these require an IWorkbenchPart as a parameter, so we can't support them from within dialogs + addObjectActions(ourMenu); + } + // GO TO CASCADING ACTIONS... + if (fromSystemViewPart && (selectionIsRemoteObject || showOpenViewActions())) + { + SystemCascadingGoToAction gotoActions = getGoToActions(); + gotoActions.setSelection(selection); + menu.appendToGroup(gotoActions.getContextMenuGroup(), gotoActions.getSubMenu()); + } + } + } + /** + * Contributes popup menu actions and submenus registered for the object type(s) in the current selection. + * Patterned after addObjectActions in PopupMenuExtender class supplied by Eclipse. + */ + protected void addObjectActions(SystemMenuManager menu) + { + if (SystemPopupMenuActionContributorManager.getManager().contributeObjectActions(getWorkbenchPart(), menu, this, null)) + { + //menu.add(new Separator()); + } + } + /** + * 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 + + 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() + { + + Item[] elements = getSelection(getControl()); + for (int i = 0; i < elements.length; i++) + { + TreeItem parentItem = (TreeItem)elements[i]; + for (int j =0; j < elements.length; j++) + { + if (j != i) + { + if (isAncestorOf(parentItem, (TreeItem)elements[j])) + { + 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 = getAdapter(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 = getAdapter(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 + if (debugProperties) + { + ISystemRemoteElementAdapter element = getRemoteAdapter(firstSelection); + if (element == null) + return; + else + { + logMyDebugMessage(this.getClass().getName(),": -----------------------------------------------------------"); + logMyDebugMessage(this.getClass().getName(),": REMOTE SSFID.......: " + element.getSubSystemFactoryId(firstSelection)); + logMyDebugMessage(this.getClass().getName(),": REMOTE NAME........: " + element.getName(firstSelection)); + logMyDebugMessage(this.getClass().getName(),": REMOTE TYPECATEGORY: " + element.getRemoteTypeCategory(firstSelection)); + logMyDebugMessage(this.getClass().getName(),": REMOTE TYPE........: " + element.getRemoteType(firstSelection)); + logMyDebugMessage(this.getClass().getName(),": REMOTE SUBTYPE.....: " + element.getRemoteSubType(firstSelection)); + logMyDebugMessage(this.getClass().getName(),": REMOTE SUBSUBTYPE..: " + element.getRemoteSubSubType(firstSelection)); + } + } + } + protected void logMyDebugMessage(String prefix, String msg) + { + if (!debugProperties) + return; + //SystemPlugin.logDebugMessage(prefix, msg); + System.out.println(prefix+" "+msg); + } + + /** + * Convenience method for returning the shell of this viewer. + */ + public Shell getShell() + { + //return shell; + return getTree().getShell(); + } + + /** + * 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 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[] newResult = new Item[oldResult.length]; + for (int i = 0; i < oldResult.length; i++) + { + Item first = removeFirstItem(parentItem, oldResult); + newResult[i] = first; + } + + return newResult; + } + + protected Item removeFirstItem(Widget parentItem, Item[] items) + { + int firstIndex = 0; + Item firstItem = null; + int firstItemPosition = 0; + for (int i = 0; i < items.length; i++) + { + if (items[i] != null) + { + Item current = items[i]; + int position = getTreeItemPosition(parentItem, current, items); + + if (firstItem == null || position < firstItemPosition) + { + firstItem = current; + firstItemPosition = position; + firstIndex = i; + } + } + } + + items[firstIndex] = null; + return firstItem; + } + + + /** + * Move one tree item to a new location + */ + protected void moveTreeItem(Widget parentItem, Item item, Object src, int newPosition) + { + 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.

+ */ + 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 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= 0) + pos++; // want to add after previous + } + else + pos = event.getPosition(); + //logDebugMsg("ADDING CONN? "+ addingConnection + ", position="+pos); + createTreeItem(parentItem, src, pos); + setSelection(new StructuredSelection(src),true); + } + break; + case EVENT_ADD_MANY: + if (debug) + { + logDebugMsg("SV event: EVENT_ADD_MANY"); + } + multiSource = event.getMultiSource(); + clearSelection(); + parentItem = findItem(parent); + if (parentItem == null) + return; + 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 0 && parentItem != null && 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 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 EVENT_REFRESH: + if (debug) + logDebugMsg("SV event: EVENT_REFRESH "); + //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 == SystemPlugin.getTheSystemRegistry())) + refreshAll(); + else + { + //smartRefresh(src, false); + smartRefresh(src, true); + } + updatePropertySheet(); + break; + // refresh the parent of the currently selected items. + // todo: intelligently re-select previous selections + case EVENT_REFRESH_SELECTED_PARENT: + if (debug) + logDebugMsg("SV event: EVENT_REFRESH_SELECTED_PARENT "); + TreeItem[] items = getTree().getSelection(); + if ((items != null) && (items.length > 0) && (items[0] instanceof Item)) + { + //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 EVENT_REFRESH_SELECTED: + if (debug) + logDebugMsg("SV event: EVENT_REFRESH_SELECTED "); + 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; + Vector selectedRemoteObjects = new Vector(); + ss = null; + items = getTree().getSelection(); + int itemIdx = 0; + SystemElapsedTimer timer = null; + if (doTimings) + timer = new SystemElapsedTimer(); + //System.out.println("Inside EVENT_REFRESH_SELECTED. FIRST SELECTED OBJECT = " + items[0].handle); + while (i.hasNext()) + { + + Object element = i.next(); + ISystemViewElementAdapter adapter = getAdapter(element); + if ((parentElementItem==null) && (adapter != null) && (!adapter.hasChildren(element))) + { + //parentItem = getParentItem((Item)findItem(element)); + parentItem = getParentItem(items[itemIdx]); + if ((parentItem != null) && (parentItem instanceof Item)) + parentElementItem = (Item)parentItem; //.getData(); + } + if (getRemoteAdapter(element) != null) + { + selectedRemoteObjects.addElement(element); + if (ss==null) + ss=getRemoteAdapter(element).getSubSystem(element); + } + itemIdx++; + } + if (parentElementItem != null) + { + //refresh(parentElement); + 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()); + } + if (doTimings) + { + timer.setEndTime(); + System.out.println("Time to refresh selected: " + timer); + } + //else + //{ + //i = selected.iterator(); + //while (i.hasNext()) + //refresh(i.next()); + //} + + updatePropertySheet(); + break; + case EVENT_REFRESH_SELECTED_FILTER: + if (debug) + logDebugMsg("SV event: EVENT_REFRESH_SELECTED_FILTER "); + 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; + Vector selRemoteObjects = new Vector(); + ss = null; + if (j.hasNext()) + { + Object element = j.next(); + ISystemViewElementAdapter adapter = getAdapter(element); + if ((parentElemItem==null) && (adapter != null)) + { + Item parItem = getParentItem((Item)findItem(element)); + + if ((parItem != null) && (parItem instanceof Item)) + parentElemItem = (Item)parItem; //.getData(); + + while (parItem!= null && !(parItem.getData() instanceof ISystemFilterReference)) + { + parItem = getParentItem((Item)parItem); + + if ((parItem != null) && (parItem instanceof Item)) + parentElemItem = (Item)parItem; //.getData(); + } + } + if (getRemoteAdapter(element) != null) + { + selRemoteObjects.addElement(element); + if (ss==null) + ss=getRemoteAdapter(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 EVENT_REFRESH_REMOTE: + if (debug) + logDebugMsg("SV event: EVENT_REFRESH_REMOTE: src = "+src); + refreshRemoteObject(src, parent, originatedHere); + break; + case EVENT_SELECT_REMOTE: + if (debug) + logDebugMsg("SV event: EVENT_SELECT_REMOTE: src = "+src); + //remoteItemsToSkip = null; // reset + selectRemoteObjects(src, (ISubSystem)null, parent); + break; + + case EVENT_MOVE_MANY: + if (debug) + logDebugMsg("SV event: EVENT_MOVE_MANY "); + multiSource = event.getMultiSource(); + if ((multiSource == null) || (multiSource.length == 0)) + return; + parentItem = findItem(parent); + if (parentItem == null) + return; + 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 EVENT_PROPERTY_CHANGE: + if (debug) + logDebugMsg("SV event: EVENT_PROPERTY_CHANGE "); + String[] allProps = {IBasicPropertyConstants.P_TEXT,IBasicPropertyConstants.P_IMAGE}; + ISystemRemoteElementAdapter ra = getRemoteAdapter(src); + if (ra != null) + { + updateRemoteObjectProperties(src); + } + else + update(src, allProps); // for refreshing non-structural properties in viewer when model changes + updatePropertySheet(); + break; + case EVENT_PROPERTYSHEET_UPDATE: + if (debug) + logDebugMsg("SV event: EVENT_PROPERTYSHEET_UPDATE "); + updatePropertySheet(); + break; + case EVENT_MUST_COLLAPSE: + if (debug) + logDebugMsg("SV event: EVENT_MUST_COLLAPSE "); + collapseNode(src, true); // collapse and flush gui widgets from memory + break; + case EVENT_COLLAPSE_ALL: + if (debug) + logDebugMsg("SV event: EVENT_COLLAPSE_ALL "); + collapseAll(); // collapse all + if ((src!=null) && (src instanceof String) && ((String)src).equals("false")) // defect 41203 + {} + else + refresh(); // flush gui widgets from memory + break; + case EVENT_COLLAPSE_SELECTED: // defect 41203 + if (debug) + logDebugMsg("SV event: EVENT_COLLAPSE_SELECTED "); + collapseSelected(); + break; + case EVENT_EXPAND_SELECTED: // defect 41203 + if (debug) + logDebugMsg("SV event: EVENT_EXPAND_SELECTED "); + expandSelected(); + break; + + + case EVENT_REVEAL_AND_SELECT: + if (debug) + logDebugMsg("SV event: EVENT_REVEAL_AND_SELECT "); + parentItem = findItem(parent); + if (parentItem == null) + return; + 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 ISystemBaseReferencingObject) + { + TreeItem child = (TreeItem)internalFindReferencedItem((Item)parentItem, toSelect, 1); + if (child != null) + toSelect = child.getData(); + } + else if ( (parent instanceof ISystemFilterPoolReferenceManagerProvider) && + !(src instanceof ISystemBaseReferencingObject) ) + { + // 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((Item)parentItem, toSelect, 1); + if (child != null) + toSelect = child.getData(); + } + setSelection(new StructuredSelection(toSelect),true); + } + } + break; + case EVENT_SELECT: + if (debug) + logDebugMsg("SV event: EVENT_SELECT "); + item = findItem(src); + if (item == null) // if not showing item, this is a no-op + return; + setSelection(new StructuredSelection(src), true); + break; + case EVENT_SELECT_EXPAND: + if (debug) + logDebugMsg("SV event: EVENT_SELECT_EXPAND "); + item = findItem(src); + if (item == null) // if not showing item, this is a no-op + return; + if (!getExpanded((Item)item)) + setExpandedState(src, true); + setSelection(new StructuredSelection(src), true); + break; + + } + } + // ------------------------------------ + // ISYSTEMREMOTEChangeListener METHOD + // ------------------------------------ + + /** + * 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.model.ISystemRemoteChangeEvent + */ + public void systemRemoteResourceChanged(ISystemRemoteChangeEvent event) + { + int eventType = event.getEventType(); + Object remoteResourceParent = event.getResourceParent(); + Object remoteResource = event.getResource(); + boolean originatedHere = (event.getOriginatingViewer() == this); + Vector remoteResourceNames = null; + if (remoteResource instanceof Vector) + { + remoteResourceNames = (Vector)remoteResource; + remoteResource = remoteResourceNames.elementAt(0); + } + String remoteResourceParentName = getRemoteResourceAbsoluteName(remoteResourceParent); + String remoteResourceName = getRemoteResourceAbsoluteName(remoteResource); + if (remoteResourceName == null) + return; + + ISubSystem ss = getSubSystem(event, remoteResource, remoteResourceParent); + + Vector 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 + Vector 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 0) + ss = getSubSystem(event, v.elementAt(0), null); + } + else + { + ISystemRemoteElementAdapter ra = getRemoteAdapter(remoteResource); + if (ra != null) + ss = ra.getSubSystem(remoteResource); + } + } + if ((ss==null) && (remoteParent != null) && !(remoteParent instanceof String)) + { + if (remoteParent instanceof Vector) + { + Vector v = (Vector)remoteParent; + if (v.size() > 0) + ss = getSubSystem(event, null, v.elementAt(0)); + } + else + { + ISystemRemoteElementAdapter ra = getRemoteAdapter(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() != SystemPlugin.getTheSystemRegistry()) + && !(getInput() instanceof SystemEmptyListAPIProviderImpl)) + { + for (int idx=0; !affected && (idxtrue if structural changes are to be picked up, + * and false if only label provider changes are of interest + */ + protected void ourInternalRefresh(Widget widget, Object element, boolean doStruct, boolean forceRemote, boolean doTimings) + { + 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 + { + clearSelection(); // there is nothing much else we can do. Calling code will restore it anyway hopefully + doOurInternalRefresh(fWidget, fElement, fDoStruct, doTimings); + } + else // it is us that is selected. This might be a refresh selected operation. TreeItem address won't change + { + doOurInternalRefresh(fWidget, fElement, fDoStruct, doTimings); + } + } + else + { + final boolean finalDoTimings = doTimings; + preservingSelection(new Runnable() + { + public void run() + { + doOurInternalRefresh(fWidget, fElement, fDoStruct, finalDoTimings); + } + }); + } + } + protected boolean isSelectionRemote() + { + ISelection s = getSelection(); + if ((s!=null)&&(s instanceof IStructuredSelection)) + { + IStructuredSelection ss = (IStructuredSelection)s; + Object firstSel = ss.getFirstElement(); + if ((firstSel != null) && (getRemoteAdapter(firstSel) != null)) + return true; + } + return false; + } + protected void doOurInternalRefresh(Widget widget, Object element, boolean doStruct, boolean doTimings) + { + if (debug) + { + logDebugMsg("in doOurInternalRefresh on " + getAdapter(element).getName(element)); + logDebugMsg("...current selection is " + getFirstSelectionName(getSelection())); + } + SystemElapsedTimer timer = null; + if (doTimings) + timer = new SystemElapsedTimer(); + if (widget instanceof Item) + { + //System.out.println("Inside doOurInternalRefresh. widget = " + ((TreeItem)widget).handle); + if (doStruct) { + updatePlus((Item)widget, element); + } + updateItem((Item)widget, element); + if (doTimings) + { + System.out.println("doOurInternalRefresh timer 1: time to updatePlus and updateItem:" + timer.setEndTime()); + timer.setStartTime(); + } + } + + if (doStruct) { + // pass null for children, to allow updateChildren to get them only if needed + Object[] newChildren = null; + if ((widget instanceof Item) && getExpanded((Item)widget)) + { + // DKM - get raw children does a query but so does internalRefresh() + // newChildren = getRawChildren(widget); + if (doTimings) + { + System.out.println("doOurInternalRefresh timer 2: time to getRawChildren:" + timer.setEndTime()); + timer.setStartTime(); + } + } + // DKM - without the else we get duplicate queries on expanded folder + // uncommented - seems new results after query aren't showing up + //else + { + internalRefresh(element); + } + + if (doTimings) + { + System.out.println("doOurInternalRefresh timer 3: time to updateChildren:" + timer.setEndTime()); + timer.setStartTime(); + } + } + // recurse + Item[] children= getChildren(widget); + if (children != null) + { + //SystemElapsedTimer timer2 = null; + //int intervalCount = 0; + //if (doTimings) + //timer2 = new SystemElapsedTimer(); + for (int i= 0; i < children.length; i++) + { + Widget item= children[i]; + Object data= item.getData(); + if (data != null) + doOurInternalRefresh(item, data, doStruct, false); + /* + if (doTimings) + { + ++intervalCount; + if (intervalCount == 1000) + { + System.out.println("...time to recurse next 1000 children: " + timer2.setEndTime()); + intervalCount = 0; + timer2.setStartTime(); + } + }*/ + } + } + if (doTimings) + { + System.out.println("doOurInternalRefresh timer 4: time to recurse children:" + timer.setEndTime()); + timer.setStartTime(); + } + } + protected Object[] getRawChildren(Widget w) + { + Object parent = w.getData(); + if (w != null) + { + 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 = getAdapter(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 + { + ISystemRemoteElementAdapter ra = getRemoteAdapter(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!! + { + remoteItem = null; + if (remoteObject instanceof String) + remoteItem = findFirstRemoteItemReference((String)remoteObject, subsystem, (Item)null); + else + { + ISystemRemoteElementAdapter ra = getRemoteAdapter(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 vector 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) + { + ISystemRemoteElementAdapter ra = getRemoteAdapter(parentObject); + if (ra != null) + { + //parentName = ra.getAbsoluteName(parentObject); + if (subsystem == null) + subsystem = ra.getSubSystem(parentObject); + Item parentItem = (Item)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 vector 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 Vector) + { + String elementName = null; + Vector selVector = (Vector)src; + ArrayList selItems = new ArrayList(); + // our goal here is to turn the vector of names or remote objects into a collection of + // actual TreeItems we matched them on... + for (int idx=0; idx 0) + { + setSelection(selItems); + updatePropertySheet(); + return true; + } + } + else + { + if (src instanceof String) + //selItem = (Item)findFirstRemoteItemReference((String)src, (SubSystem)null, parentItem); Phil test + selItem = (Item)findFirstRemoteItemReference((String)src, subsystem, parentItem); + else + selItem = (Item)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; + Vector selectedRemoteObjects = new Vector(); + Widget parentItem = null; + ISubSystem ss = null; + while (i.hasNext()) + { + Object element = i.next(); + if (parentElement == null) + { + parentItem = getParentItem((Item)findItem(element)); + if ((parentItem != null) && (parentItem instanceof Item)) + parentElement = ((Item)parentItem).getData(); + } + if (getRemoteAdapter(element) != null) + { + selectedRemoteObjects.addElement(element); + if (ss == null) + ss = getRemoteAdapter(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 reexpands 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) + { + SystemElapsedTimer timer = null; + if (doTimings) + timer = new SystemElapsedTimer(); + 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]; + boolean anyGivenItemsRemote = false; + for (int idx=0; idx 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 + { + TreeItem item, parentItem; + Object data; + String remoteName; + ISystemRemoteElementAdapter remoteAdapter; + ISubSystem subsystem; + ExpandedItem(TreeItem parentItem, TreeItem item) + { + this.parentItem = parentItem; + this.item = item; + 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); + } + else if (debug) + System.out.println("ExpandedItem added. Data = " + data); + } + else if (debug) + System.out.println("ExpandedItem added. Data = null"); + } + 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(); + if (itemChildren != null) + { + for (int idx=0; idx + * 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) + *

+ * 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 + *

+ * 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 EVENT_RENAME_FILTER_REFERENCE: + eventType = "EVENT_RENAME_FILTER_REFERENCE"; + break; + case EVENT_CHANGE_FILTER_REFERENCE: + eventType = "EVENT_CHANGE_FILTER_REFERENCE"; + break; + } + logDebugMsg("SV event: "+eventType); + } + + // 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); + + 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); + + item = internalFindReferencedItem(widget, filter, SEARCH_INFINITE); + } + + if (item == null) + logDebugMsg("......didn't find renamed/updated filter's reference!"); + else + { + // STEP 3: UPDATE THAT FILTER... + if (type == 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 == 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); + // 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!"); + else + { + // STEP 3: UPDATE THAT FILTER STRING... + if (type == 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!! + *

+ * 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) + *

+ * 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 + *

+ * 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 EVENT_ADD_FILTER_REFERENCE: + add = true; + if (debug) + eventType = "EVENT_ADD_FILTER_REFERENCE"; + break; + case EVENT_DELETE_FILTER_REFERENCE: + delete = true; + if (debug) + eventType = "EVENT_DELETE_FILTER_REFERENCE"; + break; + case EVENT_MOVE_FILTER_REFERENCES: + move = true; + if (debug) + eventType = "EVENT_MOVE_FILTER_REFERENCES"; + break; + case EVENT_ADD_FILTERSTRING_REFERENCE: + add = true; + afilterstring = true; + if (debug) + eventType = "EVENT_ADD_FILTERSTRING_REFERENCE"; + break; + case EVENT_DELETE_FILTERSTRING_REFERENCE: + delete = true; + afilterstring = true; + if (debug) + eventType = "EVENT_DELETE_FILTERSTRING_REFERENCE"; + break; + case EVENT_MOVE_FILTERSTRING_REFERENCES: + move = true; + afilterstring = true; + if (debug) + eventType = "EVENT_MOVE_FILTERSTRING_REFERENCES"; + break; + + } + if (debug) + logDebugMsg("SV event: "+eventType); + //} + //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()); + return; + } + Item ssItem = (Item)item; + boolean wasSelected = false; + IStructuredSelection oldSelections = (IStructuredSelection)getSelection(); + + + + Object parent = event.getParent(); + if (debug) + logDebugMsg("...Found ss "+ss); + + // STEP 2: ARE WE SHOWING A REFERENCE TO THE FILTER's PARENT POOL? + Item 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 = (Item)internalFindReferencedItem(ssItem, refdParent, SEARCH_INFINITE); + } + // 3b and 3d. (filter pool or filter) + else if (parent instanceof ISystemFilterContainer) + { + refdParent = (ISystemFilterContainer)parent; + parentRefItem = (Item)internalFindReferencedItem(ssItem, refdParent, SEARCH_INFINITE); + } + // 3c (subsystem) + else + { + parentRefItem = ssItem; + } + if (parentRefItem != null) + { + if (debug) + logDebugMsg("......We are showing reference to parent"); + // 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 + { + 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 + { + 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"); + // .... 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!"); + } + else + { + if (debug) + logDebugMsg(".........Trying to set selection to " + filterItem.getData()); + 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 + */ + 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 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 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) + { + //Vector matches = new Vector(); + ISystemRemoteElementAdapter adapter = getRemoteAdapter(remoteObject); + if (adapter == null) + return null; + Item match = 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); + match = recursiveFindFirstRemoteItemReference(parentItem, remoteObjectName, remoteObject, subsystem); + if (debugRemote) + System.out.println("Returning " + match + " from findFirstRemoteItemReference(1,2)"); + } + + //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 vector to populate with hits + */ + protected Vector findAllRemoteItemReferences(Object element, Object elementObject, Vector matches) + { + String searchString = null; + ISubSystem subsystem = null; + if (element instanceof String) + searchString = (String)element; + else + { + if (elementObject == null) + elementObject = element; + ISystemRemoteElementAdapter adapter = getRemoteAdapter(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(); + for (int idx=0; idx + * 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 vector to populate with hits + */ + protected Vector findAllRemoteItemReferences(String searchString, Object elementObject, ISubSystem subsystem, Vector matches) + { + Tree tree = getTree(); + Item[] roots = tree.getItems(); + if (roots == null) + return matches; + if (matches == null) + matches = new Vector(); + for (int idx=0; idx + * 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 vector to populate with hits + * @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; + Item match = null; + if (debugRemote) + { + System.out.println("Inside internalFindFirstRemoteItemReference for searchString: "+searchString+", subsystem null? " + (subsystem==null) + ", nbr roots = " + roots.length); + } + for (int idx=0; (match==null) && (idx + * 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... + 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(); + while (elements.hasNext()) + { + Object element= elements.next(); + ISystemViewElementAdapter adapter = getAdapter(element); + if (adapter == null) + continue; + + 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 = (getRemoteAdapter(element) != null); + + if (selectionIsRemoteObject && !selectionFlagsUpdated) + { + ISubSystem srcSubSystem = adapter.getSubSystem(element); + if (srcSubSystem.isConnected() || + element instanceof ISystemFilterReference || + element instanceof ISubSystem) + { + SystemRemoteElementResourceSet set = getSetFor(srcSubSystem, adapter); + set.addResource(element); + } + } + } + selectionFlagsUpdated = true; + //System.out.println("Inside scan selections: selectionShowOpenViewActions = " + selectionShowOpenViewActions); + } + + /** + * 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"); + } + 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"); + } + return selectionEnableDeleteAction; + } + + /** + * Required method from ISystemDeleteTarget + */ + public boolean doDelete(IProgressMonitor monitor) + { + ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry(); + 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 = getAdapter(element); + if (getRemoteAdapter(element) != null) continue; + ok = adapter.doDelete(getShell(), element, monitor); + if (ok) + { + anyOk = true; + deletedVector.addElement(element); + } + } + // now we have things divided into sets + // delete 1 set at a time + for (int s = 0; s < _setList.size() && ok; s++) + { + SystemRemoteElementResourceSet set = (SystemRemoteElementResourceSet)_setList.get(s); + ISubSystem srcSubSystem = set.getSubSystem(); + ISystemViewElementAdapter srcAdapter = set.getAdapter(); + + if (srcSubSystem != null) + { + 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) + { + exc.printStackTrace(); + String msg = exc.getMessage(); + if ((msg == null) || (exc instanceof ClassCastException)) + msg = exc.getClass().getName(); + SystemMessageDialog.displayErrorMessage(getShell(), SystemPlugin.getPluginMessage( + ISystemMessages.MSG_EXCEPTION_DELETING).makeSubstitution(element,msg)); + ok = false; + } + //System.out.println("in doDelete. Any ok? " + anyOk + ", selectionIsRemoteObject? " + selectionIsRemoteObject); + if (anyOk) + { + if (selectionIsRemoteObject) + //sr.fireEvent( + // new com.ibm.etools.systems.model.impl.SystemResourceChangeEvent( + // deleted,ISystemResourceChangeEvent.EVENT_DELETE_REMOTE_MANY,null)); + sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED, deletedVector, null, null, null, this); + else + { + Object[] deleted = new Object[deletedVector.size()]; + for (int idx=0; idx 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 + * 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 && (idx0) && (currParent != prevParent)) + same = false; + else + { + prevParent = currParent; + } + } + return same; + } + + protected boolean selectionHasAncestryRelationship() + { + if (selectionFlagsUpdated) return selectionHasAncestorRelation; + Tree tree = getTree(); + TreeItem[] items = tree.getSelection(); + + for (int idx=0; idx 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. + *

+ * 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 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) && (idx0)) + { + 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 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; idx0)) + { + 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 && (idx0)) + { + 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 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 && (idx0)) + { + // for every selected tree item, see if needs expanding... + for (int idx=0; !expandable && (idx 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[] transfers = new Transfer[] + { PluginTransfer.getInstance(), + /*ResourceTransfer.getInstance(),*/ + FileTransfer.getInstance(), + EditorInputTransfer.getInstance() + }; + addDragSupport(ops | DND.DROP_DEFAULT, transfers, new SystemViewDataDragAdapter((ISelectionProvider)this)); + addDropSupport(ops | DND.DROP_DEFAULT, transfers, new SystemViewDataDropAdapter(this)); + } + + // ---------------------------------- + // Support for EXPAND TO-> ACTIONS... + // ---------------------------------- + /** + * 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(); + ISystemRemoteElementAdapter remoteAdapter = getRemoteAdapter(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.getAdapter() == adapter && set.getSubSystem() == subSystem) + { + return set; + } + } + + // no existing set - create one + SystemRemoteElementResourceSet newSet = new SystemRemoteElementResourceSet(subSystem, adapter); + _setList.add(newSet); + return newSet; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/AbstractElement.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/AbstractElement.java new file mode 100644 index 00000000000..a4b6eb0d951 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/AbstractElement.java @@ -0,0 +1,40 @@ +/******************************************************************************** + * 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.IAdaptable; +import org.eclipse.core.runtime.Platform; +//import org.eclipse.ui.views.properties.*; + +/** + * In order to populate the PropertySheet, an object must implement the + * IAdaptable interface. Thus, this is the minimum requirement for any + * object that we wish to represent in a tree or table viewer. We simply + * defer the request for an adapter to the platform, assuming that the + * adapter has been registered with it. + */ +public class AbstractElement implements IAdaptable +{ + + /** + * @see IAdaptable#getAdapter(Class) + */ + public Object getAdapter(Class adapterType) + { + return Platform.getAdapterManager().getAdapter(this, adapterType); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/GenericMessages.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/GenericMessages.java new file mode 100644 index 00000000000..404642dcf0e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/GenericMessages.java @@ -0,0 +1,73 @@ +/******************************************************************************** + * 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; + +import org.eclipse.osgi.util.NLS; + +public class GenericMessages extends NLS +{ + private static String BUNDLE_NAME = "org.eclipse.rse.ui.GenericMessages";//$NON-NLS-1$ + + public static String ResourceNavigator_goto; + + public static String RefreshAction_text; + public static String RefreshAction_toolTip; + public static String RefreshAction_progressMessage; + public static String RefreshAction_problemTitle; + public static String RefreshAction_problemMessage; + public static String RefreshAction_locationDeletedMessage; + public static String RefreshAction_dialogTitle; + + public static String DragAndDropOperation_message; + public static String RSESubSystemOperation_message; + public static String RSESubSystemOperation_Connect_message; + public static String RSESubSystemOperation_Disconnect_message; + public static String RSESubSystemOperation_Get_properties_message; + public static String RSESubSystemOperation_Get_property_message; + public static String RSESubSystemOperation_Resolve_filter_strings_message; + public static String RSESubSystemOperation_Set_properties_message; + public static String RSESubSystemOperation_Set_property_message; + public static String RSESubSystemOperation_Notifying_registry_message; + + // ============================================================================== + // Property Pages + // ============================================================================== + public static String PropertyDialog_messageTitle; + public static String PropertyDialog_noPropertyMessage; + public static String PropertyDialog_propertyMessage; + + // ============================================================================== + // Editor Framework + // ============================================================================== + public static String EditorManager_saveResourcesMessage; + public static String EditorManager_saveResourcesTitle; + + 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 FilteredPreferenceDialog_PreferenceSaveFailed; + + static { + // load message values from bundle file + NLS.initializeMessages(BUNDLE_NAME, GenericMessages.class); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/GenericMessages.properties b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/GenericMessages.properties new file mode 100644 index 00000000000..91a8ac122e0 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/GenericMessages.properties @@ -0,0 +1,56 @@ +################################################################################ +# 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. +################################################################################ + +ResourceNavigator_goto = Goto + +RefreshAction_text = Re&fresh +RefreshAction_toolTip = Refresh +RefreshAction_progressMessage = Refreshing... +RefreshAction_problemTitle = Refresh Problems +RefreshAction_problemMessage = Problems occurred refreshing the selected resources. +RefreshAction_locationDeletedMessage = The location for project ''{0}'' ({1}) has been deleted.\n Delete ''{0}'' from the workspace? +RefreshAction_dialogTitle = Project location has been deleted + +EditorManager_saveResourcesMessage = Select the &resources to save: +EditorManager_saveResourcesTitle = Save Resources + +# ============================================================================== +# 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 +FilteredPreferenceDialog_PreferenceSaveFailed=Preferences save failed. + +DragAndDropOperation_message = Drag and Drop Operation +RSESubSystemOperation_message = RSE SubSystem Operation: +RSESubSystemOperation_Connect_message = Connect +RSESubSystemOperation_Disconnect_message = Disconnect +RSESubSystemOperation_Get_properties_message = Get properties +RSESubSystemOperation_Get_property_message = Get property +RSESubSystemOperation_Resolve_filter_strings_message = Resolve filter strings +RSESubSystemOperation_Set_properties_message = Set properties +RSESubSystemOperation_Set_property_message = Set property +RSESubSystemOperation_Notifying_registry_message = Notifying registry of connection status change... + +PropertyDialog_messageTitle = Properties +PropertyDialog_noPropertyMessage Properties +PropertyDialog_propertyMessage = Properties for {0} \ No newline at end of file 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 new file mode 100644 index 00000000000..79ab84e9674 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/IRemoteSelectionAddListener.java @@ -0,0 +1,67 @@ +/******************************************************************************** + * 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.model.IHost; + +/** + *

+ * This interface is used by the remote object selection dialogs when Add mode is enabled. + *

+ * 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. + *

+ * 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 new file mode 100644 index 00000000000..a35ea42cf57 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemConnectionFormCaller.java @@ -0,0 +1,38 @@ +/******************************************************************************** + * 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.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(String 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 new file mode 100644 index 00000000000..fa1c048fc08 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemContextMenuConstants.java @@ -0,0 +1,296 @@ +/******************************************************************************** + * 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. + *


+ * 	    // 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
+ * 
+ */ +public interface ISystemContextMenuConstants +{ + /** + * Pop-up menu: name of group for goto actions (value "group.goto"). + *

+ * Examples for open actions are: + *

    + *
  • Go Into
  • + *
  • Go To
  • + *
+ *

+ */ + public static final String GROUP_GOTO= "group.goto"; + /** + * ID of the submenu for "Go To->" + */ + public static final String MENU_GOTO= "menu.goto"; + /** + * ID of the submenu for "Preferences->" + */ + public static final String MENU_PREFERENCES= "menu.preferences"; + + /** + * Pop-up menu: name of group for open-with actions (value "group.openwith"). + *

+ * Examples for open-with actions are: + *

    + *
  • Open With->Editor
  • + *
  • Open With->Designer
  • + *
+ *

+ */ + public static final String GROUP_OPENWITH= "group.openwith"; + /** + * ID of the submenu for "Open With->" + */ + public static final String MENU_OPENWITH= "menu.openwith"; + + /** + * Group name for the "Browse With" submenu + */ + public static final String GROUP_BROWSEWITH= "group.browsewith"; + + /** + * Group name for the "Compare With" submenu + */ + public static final String GROUP_COMPAREWITH= "group.comparewith"; + + /** + * Group name for the "Replace With" submenu + */ + public static final String GROUP_REPLACEWITH= "group.replacewith"; + + /** + * ID for "Browse With" submenu + */ + public static final String MENU_BROWSEWITH = "menu.browsewith"; + + /** + * ID for "Compare With" submenu + */ + public static final String MENU_COMPAREWITH = "menu.comparewith"; + + /** + * ID for "Compare With" submenu + */ + public static final String MENU_REPLACEWITH = "menu.replacewith"; + + /** + * Pop-up menu: name of group for expand actions (value "group.expand"). + */ + public static final String GROUP_EXPAND = "group.expand"; + + /** + * Pop-up menu: name of group for expand-to cascading actions (value "group.expandto"). + */ + public static final String GROUP_EXPANDTO= "group.expandto"; + /** + * ID of the submenu for "Expand to->" + */ + public static final String MENU_EXPANDTO= "menu.expandto"; + + /** + * Pop-up menu: name of group for open-to actions (value "group.opento"). + *

+ * Examples for open-to actions are: + *

    + *
  • Open To->Navigator
  • + *
  • Open To->iSeries Navigator
  • + *
+ *

+ */ + public static final String GROUP_OPENTO= "group.opento"; + /** + * ID of the submenu for "Open To->" + */ + public static final String MENU_OPENTO= "menu.opento"; + + /** + * Pop-up menu: name of group for work-with actions (value "group.workwith"). + *

+ * Examples for work-with actions are: + *

    + *
  • Work with->Filter Pools...
  • + *
  • Work with->User Actions...
  • + *
  • Work with->File Types...
  • + *
+ *

+ */ + public static final String GROUP_WORKWITH= "group.workwith"; + /** + * ID of the submenu for "Work Work->" + */ + public static final String MENU_WORKWITH= "menu.workwith"; + /** + * Pop-up menu: name of group for open actions (value "group.open"). + *

+ * Examples for open actions are: + *

    + *
  • Open To
  • + *
  • Open With
  • + *
+ *

+ */ + public static final String GROUP_OPEN= "group.open"; + /** + * Pop-up menu: name of group for show actions (value "group.show"). + *

+ * Examples for show actions are: + *

    + *
  • Show in Navigator
  • + *
  • Show in Type Hierarchy
  • + *
+ *

+ */ + public static final String GROUP_SHOW= "group.show"; + + /** + * Pop-up menu: name of group for new actions (value "group.new"). + * This is a cascading group. + *

+ * Examples for new actions are: + *

    + *
  • Create new filter
  • + *
  • Create new folder
  • + *
+ *

+ */ + public static final String GROUP_NEW= "group.new"; + /** + * ID of the submenu for "New->" + */ + public static final String MENU_NEW= "menu.new"; + + /** + * Pop-up menu: name of group for new actions (value "group.new.noncascade"). + * This is a non-cascading group. + *

+ * This is used in the Team view + *

+ */ + public static final String GROUP_NEW_NONCASCADING="group.new.noncascade"; + + /** + * Pop-up menu: name of group for build actions (value "group.build"). + */ + public static final String GROUP_BUILD= "group.build"; + + /** + * Pop-up menu: name of group for reorganize actions (value "group.reorganize"). + */ + public static final String GROUP_REORGANIZE= "group.reorganize"; + /** + * Pop-up menu: name of group for reorder actions like move up/down(value "group.reorder"). + */ + public static final String GROUP_REORDER= "group.reorder"; + /** + * Pop-up menu: name of group for CHANGE actions. (value "group.change"). + *

+ * Examples for change actions are: + *

    + *
  • Change...
  • + *
  • Update...
  • + *
+ * SHould you even have a change action? Maybe it should be a PropertyPage instead! + *

+ */ + public static final String GROUP_CHANGE = "group.change"; + + /** + * Pop-up menu: name of group for code generation or refactoring actions ( + * value "group.generate"). + */ + public static final String GROUP_GENERATE= "group.generate"; + + /** + * Pop-up menu: name of group for search actions (value "group.search"). + */ + public static final String GROUP_SEARCH= "group.search"; + + /** + * Pop-up menu: name of group for additional actions (value "group.additions"). + */ + public static final String GROUP_ADDITIONS= IWorkbenchActionConstants.MB_ADDITIONS; //"additions"; + + /** + * Pop-up menu: name of group for viewer setup actions (value "group.viewerSetup"). + */ + public static final String GROUP_VIEWER_SETUP= "group.viewerSetup"; + + /** + * Pop-up menu: name of group for properties actions (value "group.properties"). + */ + public static final String GROUP_PROPERTIES= "group.properties"; + /** + * 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"; + /** + * Pop-up menu: name of group for actions related to getting and putting the selected object. + */ + public static final String GROUP_IMPORTEXPORT= "group.importexport"; + /** + * Pop-up menu: name of group for actions contributed by the adaptors for the selected object + */ + public static final String GROUP_ADAPTERS= "group.adapters"; + /** + * Pop-up menu: name of group for team actions + */ + public static final String GROUP_TEAM= "group.team"; + + + /** + * ID of the submenu for "Compile->" + */ + public static final String MENU_COMPILE= "menu.compile"; + /** + * ID of the submenu for "User Actions->" + */ + public static final String MENU_USERACTIONS= "menu.useractions"; + + /** + * Group for "Start Server->" + */ + public static final String GROUP_STARTSERVER= "group.remoteservers"; + /** + * ID of the submenu for "Start Server->" + */ + public static final String MENU_STARTSERVER= "menu.remoteservers"; +} \ 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 new file mode 100644 index 00000000000..fa90538d5d6 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemDeleteTarget.java @@ -0,0 +1,43 @@ +/******************************************************************************** + * 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 new file mode 100644 index 00000000000..0929a8d0b09 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemIconConstants.java @@ -0,0 +1,447 @@ +/******************************************************************************** + * 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; + +/** + * Constants used throughout the System plugin. + */ +public interface ISystemIconConstants +{ + public static final String PLUGIN_ID ="org.eclipse.rse.ui"; + public static final String PREFIX = PLUGIN_ID+"."; + + // Icons + public static final String ICON_DIR = "icons"; + public static final String ICON_PATH = java.io.File.separator + ICON_DIR + java.io.File.separator; + public static final String ICON_SUFFIX = "Icon"; + public static final String ICON_BANNER_SUFFIX = "BannerIcon"; + public static final String ICON_EXT = ".gif"; + + // WIZARD ICONS... + public static final String ICON_WIZARD_DIR = java.io.File.separator + "full" + java.io.File.separator + "wizban" + java.io.File.separator + ""; + public static final String ICON_SYSTEM_NEWPROFILEWIZARD_ROOT = "newprofile_wiz"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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 = java.io.File.separator + "full" + java.io.File.separator + "obj16" + java.io.File.separator + ""; + + public static final String ICON_SYSTEM_USERACTION_NEW_ROOT = "user_action_new_obj"; + public static final String ICON_SYSTEM_USERACTION_NEW = ICON_MODEL_DIR + ICON_SYSTEM_USERACTION_NEW_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_USERACTION_NEW_ID = PREFIX+ICON_SYSTEM_USERACTION_NEW_ROOT+ICON_SUFFIX; + + public static final String ICON_SYSTEM_USERACTION_USR_ROOT = "user_action_obj"; + public static final String ICON_SYSTEM_USERACTION_USR = ICON_MODEL_DIR + ICON_SYSTEM_USERACTION_USR_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_USERACTION_USR_ID = PREFIX+ICON_SYSTEM_USERACTION_USR_ROOT+ICON_SUFFIX; + + public static final String ICON_SYSTEM_USERACTION_IBM_ROOT = "user_action_ibm_obj"; + public static final String ICON_SYSTEM_USERACTION_IBM = ICON_MODEL_DIR + ICON_SYSTEM_USERACTION_IBM_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_USERACTION_IBM_ID = PREFIX+ICON_SYSTEM_USERACTION_IBM_ROOT+ICON_SUFFIX; + + public static final String ICON_SYSTEM_USERACTION_IBMUSR_ROOT = "user_action_ibm_user_obj"; + public static final String ICON_SYSTEM_USERACTION_IBMUSR = ICON_MODEL_DIR + ICON_SYSTEM_USERACTION_IBMUSR_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_USERACTION_IBMUSR_ID = PREFIX+ICON_SYSTEM_USERACTION_IBMUSR_ROOT+ICON_SUFFIX; + + public static final String ICON_SYSTEM_USERTYPE_NEW_ROOT = "user_type_new_obj"; + public static final String ICON_SYSTEM_USERTYPE_NEW = ICON_MODEL_DIR + ICON_SYSTEM_USERTYPE_NEW_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_USERTYPE_NEW_ID = PREFIX+ICON_SYSTEM_USERTYPE_NEW_ROOT+ICON_SUFFIX; + + public static final String ICON_SYSTEM_USERTYPE_USR_ROOT = "user_type_obj"; + public static final String ICON_SYSTEM_USERTYPE_USR = ICON_MODEL_DIR + ICON_SYSTEM_USERTYPE_USR_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_USERTYPE_USR_ID = PREFIX+ICON_SYSTEM_USERTYPE_USR_ROOT+ICON_SUFFIX; + + public static final String ICON_SYSTEM_USERTYPE_IBM_ROOT = "user_type_ibm_obj"; + public static final String ICON_SYSTEM_USERTYPE_IBM = ICON_MODEL_DIR + ICON_SYSTEM_USERTYPE_IBM_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_USERTYPE_IBM_ID = PREFIX+ICON_SYSTEM_USERTYPE_IBM_ROOT+ICON_SUFFIX; + + public static final String ICON_SYSTEM_USERTYPE_IBMUSR_ROOT = "user_type_ibm_user_obj"; + public static final String ICON_SYSTEM_USERTYPE_IBMUSR = ICON_MODEL_DIR + ICON_SYSTEM_USERTYPE_IBMUSR_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_USERTYPE_IBMUSR_ID = PREFIX+ICON_SYSTEM_USERTYPE_IBMUSR_ROOT+ICON_SUFFIX; + + public static final String ICON_SYSTEM_COMPILE_NEW_ROOT = "compcmd_new_obj"; + public static final String ICON_SYSTEM_COMPILE_NEW = ICON_MODEL_DIR + ICON_SYSTEM_COMPILE_NEW_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_COMPILE_NEW_ID = PREFIX+ICON_SYSTEM_COMPILE_NEW_ROOT+ICON_SUFFIX; + + public static final String ICON_SYSTEM_COMPILE_USR_ROOT = "compcmd_user_obj"; + public static final String ICON_SYSTEM_COMPILE_USR = ICON_MODEL_DIR + ICON_SYSTEM_COMPILE_USR_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_COMPILE_USR_ID = PREFIX+ICON_SYSTEM_COMPILE_USR_ROOT+ICON_SUFFIX; + + public static final String ICON_SYSTEM_COMPILE_IBM_ROOT = "compcmd_ibm_obj"; + public static final String ICON_SYSTEM_COMPILE_IBM = ICON_MODEL_DIR + ICON_SYSTEM_COMPILE_IBM_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_COMPILE_IBM_ID = PREFIX+ICON_SYSTEM_COMPILE_IBM_ROOT+ICON_SUFFIX; + + public static final String ICON_SYSTEM_COMPILE_IBMUSR_ROOT = "compcmd_ibmuser_obj"; + public static final String ICON_SYSTEM_COMPILE_IBMUSR = ICON_MODEL_DIR + ICON_SYSTEM_COMPILE_IBMUSR_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_COMPILE_IBMUSR_ID = PREFIX+ICON_SYSTEM_COMPILE_IBMUSR_ROOT+ICON_SUFFIX; + + public static final String ICON_SYSTEM_PROFILE_ROOT = "systemprofile"; + 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"; + 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"; + 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 + 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"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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_ENVVAR_ROOT = "systemenvvar"; + public static final String ICON_SYSTEM_ENVVAR = ICON_MODEL_DIR + ICON_SYSTEM_ENVVAR_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_ENVVAR_ID = PREFIX+ICON_SYSTEM_ENVVAR+ICON_SUFFIX; + + public static final String ICON_SYSTEM_ENVVAR_LIBPATH_ROOT = "systemenvvarlibpath"; + public static final String ICON_SYSTEM_ENVVAR_LIBPATH = ICON_MODEL_DIR + ICON_SYSTEM_ENVVAR_LIBPATH_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_ENVVAR_LIBPATH_ID = PREFIX+ICON_SYSTEM_ENVVAR_LIBPATH+ICON_SUFFIX; + + public static final String ICON_SYSTEM_ENVVAR_PATH_ROOT = "systemenvvarpath"; + public static final String ICON_SYSTEM_ENVVAR_PATH = ICON_MODEL_DIR + ICON_SYSTEM_ENVVAR_PATH_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_ENVVAR_PATH_ID = PREFIX+ICON_SYSTEM_ENVVAR_PATH+ICON_SUFFIX; + + public static final String ICON_SYSTEM_PROCESS_ROOT = "systemprocess"; + 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"; + 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 = java.io.File.separator + "full" + java.io.File.separator + "ctool16" + java.io.File.separator + ""; + + public static final String ICON_SYSTEM_NEW_ROOT = "new"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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 = java.io.File.separator + "full" + java.io.File.separator + "elcl16" + java.io.File.separator + ""; + + public static final String ICON_SYSTEM_COMPILE_ROOT = "compile"; + public static final String ICON_SYSTEM_COMPILE = ICON_ACTIONS_DIR + ICON_SYSTEM_COMPILE_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_COMPILE_ID = PREFIX+ICON_SYSTEM_COMPILE_ROOT+ICON_SUFFIX; + + public static final String ICON_SYSTEM_LOCK_ROOT = "lock"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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"; + public static final String ICON_IDE_COLLAPSEALL_ID = "elcl16/collapseall.gif"; + public static final String ICON_IDE_LINKTOEDITOR_ID = "elcl16/synced.gif"; + public static final String ICON_IDE_FILTER_ID = "elcl16/filter_ps.gif"; + + public static final String ICON_SYSTEM_MAKEPROFILEACTIVE_ROOT = "makeProfileActive"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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_WORKWITHUSERACTIONS_ROOT = "workwithuseractions"; + public static final String ICON_SYSTEM_WORKWITHUSERACTIONS = ICON_ACTIONS_DIR + ICON_SYSTEM_WORKWITHUSERACTIONS_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_WORKWITHUSERACTIONS_ID = PREFIX+ICON_SYSTEM_WORKWITHUSERACTIONS_ROOT+ICON_SUFFIX; + + public static final String ICON_SYSTEM_WORKWITHNAMEDTYPES_ROOT = "workwithnamedtypes"; + public static final String ICON_SYSTEM_WORKWITHNAMEDTYPES = ICON_ACTIONS_DIR + ICON_SYSTEM_WORKWITHNAMEDTYPES_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_WORKWITHNAMEDTYPES_ID = PREFIX+ICON_SYSTEM_WORKWITHNAMEDTYPES_ROOT+ICON_SUFFIX; + + public static final String ICON_SYSTEM_WORKWITHCOMPILECMDS_ROOT = "workwithcompilecmds"; + public static final String ICON_SYSTEM_WORKWITHCOMPILECMDS = ICON_ACTIONS_DIR + ICON_SYSTEM_WORKWITHCOMPILECMDS_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_WORKWITHCOMPILECMDS_ID = PREFIX+ICON_SYSTEM_WORKWITHCOMPILECMDS_ROOT+ICON_SUFFIX; + + public static final String ICON_SYSTEM_REMOVE_SHELL_ROOT = "removeshell"; + public static final String ICON_SYSTEM_REMOVE_SHELL_ID = PREFIX + ICON_SYSTEM_REMOVE_SHELL_ROOT + ICON_SUFFIX; + public static final String ICON_SYSTEM_REMOVE_SHELL = ICON_ACTIONS_DIR + ICON_SYSTEM_REMOVE_SHELL_ROOT + ICON_EXT; + + public static final String ICON_SYSTEM_CANCEL_SHELL_ROOT = "cancelshell"; + public static final String ICON_SYSTEM_CANCEL_SHELL_ID = PREFIX + ICON_SYSTEM_CANCEL_SHELL_ROOT + ICON_SUFFIX; + public static final String ICON_SYSTEM_CANCEL_SHELL = ICON_ACTIONS_DIR + ICON_SYSTEM_CANCEL_SHELL_ROOT + ICON_EXT; + + public static final String ICON_SYSTEM_EXTRACT_ROOT = "xtrctarchv_tsk"; + public static final String ICON_SYSTEM_EXTRACT = ICON_ACTIONS_DIR + ICON_SYSTEM_EXTRACT_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_EXTRACT_ID = PREFIX+ICON_SYSTEM_EXTRACT_ROOT+ICON_SUFFIX; + + public static final String ICON_SYSTEM_EXTRACTTO_ROOT = "xtrctarchvto_tsk"; + public static final String ICON_SYSTEM_EXTRACTTO = ICON_ACTIONS_DIR + ICON_SYSTEM_EXTRACTTO_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_EXTRACTTO_ID = PREFIX+ICON_SYSTEM_EXTRACTTO_ROOT+ICON_SUFFIX; + + public static final String ICON_SYSTEM_CONVERT_ROOT = "convertarchive_tsk"; + public static final String ICON_SYSTEM_CONVERT = ICON_ACTIONS_DIR + ICON_SYSTEM_CONVERT_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_CONVERT_ID = PREFIX+ICON_SYSTEM_CONVERT_ROOT+ICON_SUFFIX; + + public static final String ICON_SYSTEM_COMBINE_ROOT = "combine_tsk"; + public static final String ICON_SYSTEM_COMBINE = ICON_ACTIONS_DIR + ICON_SYSTEM_COMBINE_ROOT+ICON_EXT; + public static final String ICON_SYSTEM_COMBINE_ID = PREFIX+ICON_SYSTEM_COMBINE_ROOT+ICON_SUFFIX; + + public static final String ICON_SYSTEM_SHOW_TABLE_ROOT = "systemshowintable"; + 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"; + 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"; + 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_EXPORT_SHELL_OUTPUT_ROOT = "exportshelloutput"; + public static final String ICON_SYSTEM_EXPORT_SHELL_OUTPUT = ICON_ACTIONS_DIR + ICON_SYSTEM_EXPORT_SHELL_OUTPUT_ROOT + ICON_EXT; + public static final String ICON_SYSTEM_EXPORT_SHELL_OUTPUT_ID = PREFIX + ICON_SYSTEM_EXPORT_SHELL_OUTPUT_ROOT + ICON_SUFFIX; + + public static final String ICON_SYSTEM_EXPORT_SHELL_HISTORY_ROOT = "exportshellhistory"; + public static final String ICON_SYSTEM_EXPORT_SHELL_HISTORY = ICON_ACTIONS_DIR + ICON_SYSTEM_EXPORT_SHELL_HISTORY_ROOT + ICON_EXT; + public static final String ICON_SYSTEM_EXPORT_SHELL_HISTORY_ID = PREFIX + ICON_SYSTEM_EXPORT_SHELL_HISTORY_ROOT + ICON_SUFFIX; + + // SPECIAL MODEL OBJECT ICONS... + public static final String ICON_OBJS_DIR = java.io.File.separator + "full" + java.io.File.separator + "obj16" + java.io.File.separator; + public static final String ICON_SYSTEM_ERROR_ROOT = "error"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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_FAILED_ROOT = "systemfailed"; // not used yet + public static final String ICON_SYSTEM_FAILED_ID = PREFIX + ICON_SYSTEM_FAILED_ROOT + ICON_SUFFIX; + public static final String ICON_SYSTEM_FAILED = ICON_OBJS_DIR + ICON_SYSTEM_FAILED_ROOT + ICON_EXT; + + public static final String ICON_SYSTEM_BLANK_ROOT = "systemblank"; // not used yet + 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"; + 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"; + 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_SHELL_ROOT = "systemshell"; // not used yet + public static final String ICON_SYSTEM_SHELL_ID = PREFIX + ICON_SYSTEM_SHELL_ROOT + ICON_SUFFIX; + public static final String ICON_SYSTEM_SHELL = ICON_OBJS_DIR + ICON_SYSTEM_SHELL_ROOT + ICON_EXT; + + public static final String ICON_SYSTEM_SHELLLIVE_ROOT = "systemshelllive"; // not used yet + public static final String ICON_SYSTEM_SHELLLIVE_ID = PREFIX + ICON_SYSTEM_SHELLLIVE_ROOT + ICON_SUFFIX; + public static final String ICON_SYSTEM_SHELLLIVE = ICON_OBJS_DIR + ICON_SYSTEM_SHELLLIVE_ROOT + ICON_EXT; + + public static final String ICON_SYSTEM_PERSPECTIVE_ROOT ="system_persp"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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 new file mode 100644 index 00000000000..354ee1eaabe --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemMassager.java @@ -0,0 +1,38 @@ +/******************************************************************************** + * 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. + *

+ * 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 new file mode 100644 index 00000000000..14ddc5ee3b7 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemMessages.java @@ -0,0 +1,454 @@ +/******************************************************************************** + * 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; + +/** + * Message IDs + */ +public interface ISystemMessages +{ + + public static final String PLUGIN_ID ="org.eclipse.rse.ui"; + public static final String PREFIX = PLUGIN_ID+"."; + // Resource Bundle ids + public static final String RESID_PREFIX = PREFIX+"ui."; + // Messages + public static final String MSG_PREFIX = RESID_PREFIX+"msg."; + //public static final String MSG_TITLE = MSG_PREFIX + "Title"; + //public static final String MSG_TITLEWARNING = MSG_PREFIX + "TitleWarning"; + //public static final String MSG_TITLEINFORMATION = MSG_PREFIX + "TitleInformation"; + //public static final String MSG_TITLECONFIRMATION = MSG_PREFIX + "TitleConfirmation"; + + //public static final String MSG_CREATE_PROJECT_ERROR = "RSEG1002"; //MSG_PREFIX + "CreateProjectFailed"; + + //public static final String MSG_VALIDATE_PREFIX = MSG_PREFIX + "Validate."; + public static final String MSG_UNDERCONSTRUCTION = "RSEG1001"; + + public static final String MSG_CONFIRM_RELOADRSE = "RSEG1002"; + + public static final String MSG_CONFIRM_ENABLE_CLASSIC_HELP = "RSEG1400"; + public static final String MSG_ERROR_ENABLE_CLASSIC_HELP = "RSEG1401"; + + public static final String MSG_VALIDATE_NAME_EMPTY = "RSEG1006"; + public static final String MSG_VALIDATE_NAME_NOTUNIQUE= "RSEG1007"; + public static final String MSG_VALIDATE_NAME_NOTVALID = "RSEG1008"; + + public static final String MSG_VALIDATE_RENAME_EMPTY = "RSEG1012"; //MSG_VALIDATE_PREFIX + "ReName.Required"; + public static final String MSG_VALIDATE_RENAME_NOTUNIQUE= "RSEG1010"; //MSG_VALIDATE_PREFIX + "ReName.NotUnique"; + public static final String MSG_VALIDATE_RENAME_NOTVALID = "RSEG1011"; //MSG_VALIDATE_PREFIX + "ReName.NotValid"; + public static final String MSG_VALIDATE_RENAME_OLDEQUALSNEW = "RSEG1009"; //MSG_VALIDATE_PREFIX+"ReName.OldEqualsNew"; + + public static final String MSG_VALIDATE_PROFILENAME_EMPTY = "RSEG1014"; + public static final String MSG_VALIDATE_PROFILENAME_NOTUNIQUE= "RSEG1015"; + public static final String MSG_VALIDATE_PROFILENAME_NOTVALID = "RSEG1016"; + public static final String MSG_VALIDATE_PROFILENAME_RESERVED = "RSEG1040"; + + public static final String MSG_VALIDATE_PATH_EMPTY = "RSEG1032"; + public static final String MSG_VALIDATE_PATH_NOTUNIQUE= "RSEG1033"; + public static final String MSG_VALIDATE_PATH_NOTVALID = "RSEG1034"; + + public static final String MSG_VALIDATE_NOT_NUMERIC = "RSEG1017"; + public static final String MSG_VALIDATE_PORT_EMPTY = "RSEG1027"; + public static final String MSG_VALIDATE_PORT_NOTVALID = "RSEG1028"; + public static final String MSG_VALIDATE_FOLDERNAME_NOTVALID = "RSEG1018"; + public static final String MSG_VALIDATE_FILENAME_NOTVALID = "RSEG1019"; + + public static final String MSG_VALIDATE_CONNECTIONNAME_EMPTY= "RSEG1021"; + public static final String MSG_VALIDATE_CONNECTIONNAME_NOTUNIQUE = "RSEG1022"; + public static final String MSG_VALIDATE_CONNECTIONNAME_NOTUNIQUE_OTHERPROFILE = "RSEG1041"; + public static final String MSG_VALIDATE_CONNECTIONNAME_NOTVALID = "RSEG1023"; + + public static final String MSG_VALIDATE_HOSTNAME_EMPTY= "RSEG1024"; //MSG_VALIDATE_PREFIX + "HostNameRequired"; + public static final String MSG_VALIDATE_USERID_EMPTY = "RSEG1025"; + public static final String MSG_VALIDATE_USERID_NOTVALID = "RSEG1026"; + + public static final String MSG_VALIDATE_ENTRY_EMPTY = "RSEG1029"; + public static final String MSG_VALIDATE_ENTRY_NOTUNIQUE= "RSEG1030"; + public static final String MSG_VALIDATE_ENTRY_NOTVALID = "RSEG1031"; + + public static final String MSG_VALIDATE_FILTERPOOLNAME_EMPTY = "RSEG1037"; + public static final String MSG_VALIDATE_FILTERPOOLNAME_NOTUNIQUE= "RSEG1038"; + public static final String MSG_VALIDATE_FILTERPOOLNAME_NOTVALID = "RSEG1039"; + + public static final String MSG_VALIDATE_FILTERNAME_EMPTY = "RSEG1042"; + public static final String MSG_VALIDATE_FILTERNAME_NOTUNIQUE= "RSEG1043"; + public static final String MSG_VALIDATE_FILTERNAME_NOTVALID = "RSEG1044"; + + public static final String MSG_VALIDATE_PASSWORD_EMPTY = "RSEG1035"; //MSG_VALIDATE_PREFIX + "PasswordRequired"; + public static final String MSG_VALIDATE_PASSWORD_EXPIRED = "RSEG1036"; //MSG_VALIDATE_PREFIX + "PasswordExpired"; + public static final String MSG_VALIDATE_FILTERSTRING_EMPTY = "RSEG1045"; + public static final String MSG_VALIDATE_FILTERSTRING_NOTUNIQUE= "RSEG1046"; + public static final String MSG_VALIDATE_FILTERSTRING_NOTVALID = "RSEG1047"; + public static final String MSG_VALIDATE_FILTERSTRING_DUPLICATES = "RSEG1048"; + public static final String MSG_VALIDATE_FILTERSTRING_ALREADYEXISTS = "RSEG1049"; + public static final String MSG_VALIDATE_NUMBER_EMPTY = "RSEG1170"; + public static final String MSG_VALIDATE_NUMBER_NOTVALID = "RSEG1171"; + public static final String MSG_VALIDATE_NUMBER_OUTOFRANGE= "RSEG1172"; + + public static final String MSG_CONFIRM_DELETE = "RSEG1052"; + public static final String MSG_CONFIRM_DELETEREMOTE = "RSEG1130"; + public static final String MSG_CONFIRM_DELETEPROFILE = "RSEG1053"; + public static final String MSG_CONFIRM_CHANGES = "RSEG1201"; + public static final String MSG_CONFIRM_CHANGES_CANCELABLE = "RSEG1202"; + + //public static final String MSG_CONNECT_PREFIX = MSG_PREFIX + "Connect."; + public static final String MSG_CONNECT_PROGRESS = "RSEG1054"; //MSG_CONNECT_PREFIX + "Connecting"; + public static final String MSG_CONNECTWITHPORT_PROGRESS = "RSEG1055"; //MSG_CONNECT_PREFIX + "ConnectingWithPort"; + public static final String MSG_CONNECT_FAILED = "RSEG1056"; //MSG_CONNECT_PREFIX + "Failed"; + public static final String MSG_CONNECT_UNKNOWNHOST = "RSEG1057"; //MSG_CONNECT_PREFIX + "UnknownHost"; + public static final String MSG_CONNECT_CANCELLED = "RSEG1058"; //MSG_CONNECT_PREFIX + "Cancelled"; + + + public static final String MSG_CONNECT_DAEMON_FAILED = "RSEG1242"; //MSG_CONNECT_PREFIX + "Failed"; + public static final String MSG_CONNECT_DAEMON_FAILED_EXCEPTION = "RSEG1243"; //MSG_CONNECT_PREFIX + "Failed"; + public static final String MSG_CONNECT_SSL_EXCEPTION = "RSEC2307"; //MSG_CONNECT_PREFIX + "Failed"; + + public static final String MSG_STARTING_SERVER_VIA_REXEC = "RSEC2310"; + public static final String MSG_STARTING_SERVER_VIA_DAEMON = "RSEC2311"; + public static final String MSG_CONNECTING_TO_SERVER= "RSEC2312"; + public static final String MSG_INITIALIZING_SERVER= "RSEC2313"; + + //public static final String MSG_DISCONNECT_PREFIX = MSG_PREFIX + "Disconnect."; + public static final String MSG_DISCONNECT_PROGRESS = "RSEG1059"; //MSG_DISCONNECT_PREFIX + "Disconnecting"; + public static final String MSG_DISCONNECTWITHPORT_PROGRESS = "RSEG1060"; //MSG_DISCONNECT_PREFIX + "DisconnectingWithPort"; + public static final String MSG_DISCONNECT_FAILED = "RSEG1061"; // MSG_DISCONNECT_PREFIX + "Failed"; + public static final String MSG_DISCONNECT_CANCELLED = "RSEG1062"; //MSG_DISCONNECT_PREFIX + "Cancelled"; + + //public static final String MSG_SAVE_PREFIX = MSG_PREFIX + "Save."; + public static final String MSG_SAVE_FAILED = "RSEG1050"; //MSG_SAVE_PREFIX + "Failed"; + public static final String MSG_RESTORE_FAILED = "RSEG1051"; + public static final String MSG_SAVE_CHANGES_PENDING = "RSEG1201"; + + //public static final String MSG_EXCEPTION_PREFIX = MSG_PREFIX + "Exception."; + public static final String MSG_EXCEPTION_OCCURRED = "RSEG1003"; + public static final String MSG_EXCEPTION_DELETING = "RSEG1063"; //""RSEG1004"; + public static final String MSG_EXCEPTION_RENAMING = "RSEG1064"; //"RSEG1005"; //MSG_EXCEPTION_PREFIX + "Renaming"; + public static final String MSG_EXCEPTION_MOVING = "RSEG1065"; //MSG_EXCEPTION_PREFIX + "Moving"; + + //public static final String MSG_RESOLVE_PREFIX = MSG_PREFIX + "Resolve."; + public static final String MSG_RESOLVE_PROGRESS = "RSEG1070"; + + //public static final String MSG_QUERY_PREFIX = MSG_PREFIX + "Query."; + public static final String MSG_QUERY_PROGRESS = "RSEG1095"; + public static final String MSG_QUERY_PROPERTIES_PROGRESS = "RSEG1096"; + + //public static final String MSG_SET_PREFIX = MSG_PREFIX + "Set."; + public static final String MSG_SET_PROGRESS = "RSEG1093"; + public static final String MSG_SET_PROPERTIES_PROGRESS = "RSEG1094"; + + //public static final String MSG_RUN_PREFIX = MSG_PREFIX + "Run."; + public static final String MSG_RUN_PROGRESS = "RSEG1071"; + + //public static final String MSG_COPY_PREFIX = MSG_PREFIX + "Copy."; + public static final String MSG_COPY_PROGRESS = "RSEG1072"; + public static final String MSG_COPYCONNECTION_PROGRESS = "RSEG1073"; + public static final String MSG_COPYCONNECTIONS_PROGRESS = "RSEG1074"; + public static final String MSG_COPYFILTERPOOLS_PROGRESS = "RSEG1075"; + public static final String MSG_COPYFILTERPOOL_PROGRESS = "RSEG1076"; + public static final String MSG_COPYFILTERS_PROGRESS = "RSEG1077"; + public static final String MSG_COPYFILTER_PROGRESS = "RSEG1078"; + public static final String MSG_COPYFILTERSTRINGS_PROGRESS="RSEG1079"; + public static final String MSG_COPYFILTERSTRING_PROGRESS ="RSEG1080"; + public static final String MSG_COPYSUBSYSTEMS_PROGRESS = "RSEG1081"; + + public static final String MSG_DOWNLOAD_PROGRESS = "RSEG1280"; + public static final String MSG_UPLOAD_PROGRESS = "RSEG1281"; + public static final String MSG_SYNCHRONIZE_PROGRESS = "RSEG1282"; + public static final String MSG_EXTRACT_PROGRESS = "RSEG1285"; + public static final String MSG_PERCENT_DONE = "RSEG1290"; + public static final String MSG_DOWNLOADING_PROGRESS = "RSEG1295"; + public static final String MSG_UPLOADING_PROGRESS = "RSEG1296"; + + public static final String MSG_COPYFILTERPOOL_COMPLETE = "RSEG1082"; + + //public static final String MSG_MOVE_PREFIX = MSG_PREFIX + "Move."; + public static final String MSG_MOVE_PROGRESS = "RSEG1083"; // "moving %1 to %2" + public static final String MSG_MOVECONNECTION_PROGRESS = "RSEG1084"; + public static final String MSG_MOVECONNECTIONS_PROGRESS = "RSEG1085"; + public static final String MSG_MOVEFILTERPOOLS_PROGRESS = "RSEG1086"; + public static final String MSG_MOVEFILTERPOOL_PROGRESS = "RSEG1087"; + public static final String MSG_MOVEFILTERS_PROGRESS = "RSEG1088"; + public static final String MSG_MOVEFILTER_PROGRESS = "RSEG1089"; + public static final String MSG_MOVEFILTERSTRINGS_PROGRESS="RSEG1090"; + public static final String MSG_MOVEFILTERSTRING_PROGRESS ="RSEG1091"; + public static final String MSG_MOVEFILTERPOOL_COMPLETE = "RSEG1092"; + + public static final String MSG_COPYGENERIC_PROGRESS = "RSEG1115"; + public static final String MSG_MOVEGENERIC_PROGRESS = "RSEG1116"; + public static final String MSG_COPYTHINGGENERIC_PROGRESS = "RSEG1117"; + public static final String MSG_MOVETHINGGENERIC_PROGRESS = "RSEG1118"; + + public static final String MSG_SAVING_PROGRESS = "RSEG1119"; + + public static final String MSG_VALIDATE_UDANAME_EMPTY = "RSEG1180"; + public static final String MSG_VALIDATE_UDANAME_NOTUNIQUE= "RSEG1181"; + public static final String MSG_VALIDATE_UDANAME_NOTVALID = "RSEG1182"; + + public static final String MSG_VALIDATE_UDACMT_EMPTY = "RSEG1183"; + public static final String MSG_VALIDATE_UDACMT_NOTVALID = "RSEG1184"; + + public static final String MSG_VALIDATE_UDACMD_EMPTY = "RSEG1185"; + public static final String MSG_VALIDATE_UDACMD_NOTVALID = "RSEG1186"; + + public static final String MSG_VALIDATE_UDTNAME_EMPTY = "RSEG1187"; + public static final String MSG_VALIDATE_UDTNAME_NOTUNIQUE= "RSEG1188"; + public static final String MSG_VALIDATE_UDTNAME_NOTVALID = "RSEG1189"; + + public static final String MSG_VALIDATE_UDTTYPES_EMPTY = "RSEG1190"; + public static final String MSG_VALIDATE_UDTTYPES_NOTVALID = "RSEG1191"; + + public static final String MSG_VALIDATE_SRCTYPE_EMPTY = "RSEG1192"; + public static final String MSG_VALIDATE_SRCTYPE_NOTVALID = "RSEG1193"; + public static final String MSG_VALIDATE_SRCTYPE_NOTUNIQUE= "RSEG1194"; + + public static final String MSG_VALIDATE_COMPILELABEL_EMPTY = "RSEG1195"; + public static final String MSG_VALIDATE_COMPILELABEL_NOTUNIQUE= "RSEG1196"; + public static final String MSG_VALIDATE_COMPILELABEL_NOTVALID = "RSEG1197"; + public static final String MSG_VALIDATE_COMPILESTRING_EMPTY = "RSEG1198"; + public static final String MSG_VALIDATE_COMPILESTRING_NOTVALID = "RSEG1199"; + + public static final String MSG_VALIDATE_ARCHIVE_NAME = "RSEG1120"; + public static final String MSG_COMBINETO_VIRTUAL_DEST = "RSEG1121"; + public static final String MSG_CONVERTTO_VIRTUAL_DEST = "RSEG1127"; + public static final String MSG_ADDTO_VIRTUAL_DEST = "RSEG1128"; + public static final String MSG_DEST_NOT_IN_SOURCE = "RSEG1129"; + public static final String MSG_DEST_TARGET_READONLY = "RSEF1313"; + + public static final String FILEMSG_ARCHIVE_CORRUPTED = "RSEG1122"; + public static final String MSG_FOLDER_INUSE = "RSEG1150"; // defect 42138 + public static final String MSG_FILE_INUSE = "RSEG1151"; // defect 42332 + + public static final String MSG_FILTERPOOL_CREATED = "RSEG1160"; // defect 42503 + public static final String MSG_UPDATEFILTER_FAILED = "RSEG1161"; + public static final String MSG_RENAMEFILTER_FAILED = "RSEG1162"; + + //public static final String MSG_OPERATION_PREFIX = MSG_PREFIX + "Operation."; + public static final String MSG_OPERATION_FAILED = "RSEG1066"; + public static final String MSG_OPERATION_CANCELLED = "RSEG1067"; + + + //public static final String MSG_LOADING_PREFIX = MSG_PREFIX + "Loading."; + public static final String MSG_LOADING_PROFILE_SHOULDBE_ACTIVATED = "RSEG1068"; + public static final String MSG_LOADING_PROFILE_SHOULDNOTBE_DEACTIVATED = "RSEG1069"; + + public static final String MSG_UDA_LOAD_ERROR = "RSEG1140"; + public static final String MSG_UDA_ROOTTAG_ERROR = "RSEG1141"; + + public static final String MSG_HOSTNAME_NOTFOUND = "RSEG1220"; + public static final String MSG_HOSTNAME_VERIFYING = "RSEG1221"; + + public static final String MSG_CONFIRM_DELETE_USERACTION = "RSEG1230"; + public static final String MSG_CONFIRM_DELETE_USERTYPE = "RSEG1231"; + + public static final String MSG_WIZARD_PAGE_ERROR = "RSEG1240"; + + // universal find files + public static final String MSG_UFF_PATTERN_EMPTY = "RSEG1250"; + public static final String MSG_UFF_PATTERN_INVALID_REGEX = "RSEG1251"; + + // universal commands + public static final String MSG_UCMD_INVOCATION_EMPTY = "RSEG1260"; + + // operation status + public static final String MSG_OPERATION_RUNNING = "RSEG1255"; + public static final String MSG_OPERATION_FINISHED = "RSEG1256"; + public static final String MSG_OPERTION_STOPPED = "RSEG1257"; + public static final String MSG_OPERATION_DISCONNECTED = "RSEG1258"; + + + + // -------------------------- + // UNIVERSAL FILE MESSAGES... + // -------------------------- + public static final String FILEMSG_VALIDATE_FILEFILTERSTRING_EMPTY = "RSEF1011"; + public static final String FILEMSG_VALIDATE_FILEFILTERSTRING_NOTUNIQUE= "RSEF1007"; + public static final String FILEMSG_VALIDATE_FILEFILTERSTRING_NOTVALID = "RSEF1008"; + public static final String FILEMSG_VALIDATE_FILEFILTERSTRING_NOINCLUDES = "RSEF1009"; + public static final String FILEMSG_DELETE_FILE_FAILED = "RSEF1300"; + public static final String FILEMSG_RENAME_FILE_FAILED = "RSEF1301"; + public static final String FILEMSG_CREATE_FILE_FAILED = "RSEF1302"; + public static final String FILEMSG_CREATE_FILE_FAILED_EXIST = "RSEF1303"; + public static final String FILEMSG_CREATE_FOLDER_FAILED = "RSEF1304"; + public static final String FILEMSG_CREATE_FOLDER_FAILED_EXIST = "RSEF1309"; + public static final String FILEMSG_CREATE_RESOURCE_NOTVISIBLE = "RSEF1310"; + public static final String FILEMSG_RENAME_RESOURCE_NOTVISIBLE = "RSEF1311"; + public static final String FILEMSG_ERROR_NOFILETYPES = "RSEF1010"; + public static final String FILEMSG_COPY_FILE_FAILED = "RSEF1306"; + public static final String FILEMSG_MOVE_FILE_FAILED = "RSEF1307"; + public static final String FILEMSG_MOVE_TARGET_EQUALS_SOURCE = "RSEF1308"; + public static final String FILEMSG_MOVE_TARGET_DESCENDS_FROM_SOUCE = "RSEF1312"; + public static final String FILEMSG_DELETING = "RSEF1315"; + + // ------------------------- + // IMPORT/EXPORT MESSAGES... + // ------------------------- + public static final String FILEMSG_COPY_ROOT = "RSEF8050"; + public static final String FILEMSG_IMPORT_ERROR = "RSEF8052"; + public static final String FILEMSG_IMPORT_PROBLEMS = "RSEF8054"; + public static final String FILEMSG_IMPORT_SELF = "RSEF8056"; + public static final String FILEMSG_EXPORT_ERROR = "RSEF8057"; + public static final String FILEMSG_EXPORT_PROBLEMS = "RSEF8058"; + public static final String FILEMSG_NOT_WRITABLE = "RSEF8059"; + + public static final String FILEMSG_TARGET_EXISTS = "RSEF8060"; + public static final String FILEMSG_FOLDER_IS_FILE = "RSEF8061"; + public static final String FILEMSG_DESTINATION_CONFLICTING = "RSEF8062"; + public static final String FILEMSG_SOURCE_IS_FILE = "RSEF8063"; + public static final String FILEMSG_SOURCE_EMPTY = "RSEF8066"; + public static final String FILEMSG_EXPORT_FAILED = "RSEF8067"; + public static final String FILEMSG_EXPORT_NONE_SELECTED = "RSEF8068"; + public static final String FILEMSG_DESTINATION_EMPTY = "RSEF8069"; + public static final String FILEMSG_IMPORT_FAILED = "RSEF8070"; + public static final String FILEMSG_IMPORT_NONE_SELECTED = "RSEF8071"; + public static final String FILEMSG_IMPORT_FILTERING = "RSEF8072"; + + // -------------------------------- + // INFO-POPS FOR UNIVERSAL FILE + // ------------------------------- + + public static final String NEW_FILE_WIZARD = "ufwf0000"; + public static final String NEW_FOLDER_WIZARD = "ufwr0000"; + public static final String NEW_FILE_ACTION = "ufaf0000"; + public static final String NEW_FOLDER_ACTION = "ufar0000"; + + + // Remote File Exception Messages + public static final String FILEMSG_SECURITY_ERROR = "RSEF1001"; + public static final String FILEMSG_IO_ERROR = "RSEF1002"; + + public static final String FILEMSG_FOLDER_NOTEMPTY = "RSEF1003"; + public static final String FILEMSG_FOLDER_NOTFOUND = "RSEF1004"; + public static final String FILEMSG_FOLDER_NOTFOUND_WANTTOCREATE = "RSEF1005"; + public static final String FILEMSG_FILE_NOTFOUND = "RSEF1006"; + + // -------------------------- + // 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"; + public static final String MSG_EXPAND_CANCELLED = "RSEG1067"; //MSG_EXPAND_PREFIX + "Cancelled"; + // 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"; + public static final String MSG_EXPAND_FILTERCREATED = "RSEG1102"; //MSG_EXPAND_PREFIX + "FilterCreated"; + public static final String MSG_EXPAND_CONNECTIONCREATED = "RSEG1108"; //MSG_EXPAND_PREFIX + "ConnectionCreated"; + + public static final String MSG_LIST_PREFIX = MSG_PREFIX + "List."; + public static final String MSG_LIST_CANCELLED = "RSEG1101"; //MSG_LIST_PREFIX + "Cancelled"; + + // ---------------------------------- + // GENERIC ERROR CHECKING MESSAGES... + // ---------------------------------- + public static final String MSG_ERROR_CONNECTION_NOTFOUND = "RSEG1103"; + public static final String MSG_ERROR_PROFILE_NOTFOUND = "RSEG1104"; + public static final String MSG_ERROR_FOLDER_NOTFOUND = "RSEG1105"; + public static final String MSG_ERROR_FILE_NOTFOUND = "RSEG1106"; + public static final String MSG_ERROR_FOLDERORFILE_NOTFOUND = "RSEG1107"; + public static final String MSG_ERROR_ARCHIVEMANAGEMENT_NOTSUPPORTED = "RSEG1304"; + + // -------------------------- + // Generic messages, must substitute in values... + // -------------------------- + public static final String MSG_GENERIC_I = "RSEO1010"; + public static final String MSG_GENERIC_W = "RSEO1011"; + public static final String MSG_GENERIC_E = "RSEO1012"; + public static final String MSG_GENERIC_U = "RSEO1013"; + public static final String MSG_GENERIC_Q = "RSEO1014"; + public static final String MSG_GENERIC_I_HELP = "RSEO1000"; + public static final String MSG_GENERIC_W_HELP = "RSEO1001"; + public static final String MSG_GENERIC_E_HELP = "RSEO1002"; + public static final String MSG_GENERIC_U_HELP = "RSEO1003"; + public static final String MSG_GENERIC_Q_HELP = "RSEO1004"; + public static final String MSG_GENERIC_I_TWOPARMS_HELP = "RSEO1005"; + public static final String MSG_GENERIC_W_TWOPARMS_HELP = "RSEO1006"; + public static final String MSG_GENERIC_E_TWOPARMS_HELP = "RSEO1007"; + public static final String MSG_GENERIC_U_TWOPARMS_HELP = "RSEO1008"; + public static final String MSG_GENERIC_Q_TWOPARMS_HELP = "RSEO1009"; + + // ---------------------------------- + // COMMUNICATIONS ERROR CHECKING MESSAGES... + // ---------------------------------- + public static final String MSG_COMM_CONNECT_FAILED = "RSEC1001"; + public static final String MSG_COMM_AUTH_FAILED = "RSEC1002"; + public static final String MSG_COMM_PWD_INVALID = "RSEC1004"; + + public static final String MSG_COMM_PWD_EXISTS = "RSEC2101"; + public static final String MSG_COMM_PWD_MISMATCH = "RSEC2102"; + public static final String MSG_COMM_PWD_BLANKFIELD = "RSEC2103"; + + public static final String MSG_COMM_ENVVAR_DUPLICATE = "RSEC2001"; + public static final String MSG_COMM_ENVVAR_NONAME = "RSEC2002"; + public static final String MSG_COMM_ENVVAR_INVALIDCHAR = "RSEC2004"; + + public static final String MSG_COMM_DAEMON_NOTSTARTED = "RSEC2201"; + + public static final String MSG_COMM_SERVER_NOTSTARTED = "RSEC2301"; + public static final String MSG_COMM_INVALID_LOGIN = "RSEC2302"; + + public static final String MSG_COMM_INCOMPATIBLE_PROTOCOL = "RSEC2303"; + public static final String MSG_COMM_INCOMPATIBLE_UPDATE = "RSEC2304"; + + + public static final String MSG_COMM_REXEC_NOTSTARTED = "RSEC2305"; + + public static final String MSG_COMM_PORT_WARNING = "RSEC2306"; + + public static final String MSG_COMM_SERVER_OLDER_WARNING = "RSEC2308"; + public static final String MSG_COMM_CLIENT_OLDER_WARNING = "RSEC2309"; + + // Unexpected error message + public static final String MSG_ERROR_UNEXPECTED = "RSEF8002"; + + // Connection doesn't exist + public static final String MSG_CONNECTION_DELETED = "RSEF5011"; + + // Remote editing messages + public static final String MSG_DOWNLOAD_NO_WRITE = "RSEF5002"; + public static final String MSG_DOWNLOAD_ALREADY_OPEN_IN_EDITOR = "RSEF5009"; + public static final String MSG_UPLOAD_FILE_EXISTS = "RSEF5012"; + + // General error message + public static final String MSG_ERROR_GENERAL = "RSEO1002"; + + // file transfer message + public static final String MSG_TRANSFER_INVALID = "RSEG1270"; + + + // remote error list title message + public static final String MSG_ERROR_LIST_TITLE = "RSEG1500"; + + // name validation + public static final String MSG_ERROR_EXTENSION_EMPTY = "RSEF6001"; + public static final String MSG_ERROR_FILENAME_INVALID = "RSEF6002"; + + // cache preferences + public static final String MSG_CACHE_UPLOAD_BEFORE_DELETE = "RSEF6101"; + public static final String MSG_CACHE_UNABLE_TO_SYNCH = "RSEF6102"; + + // remote search messages + public static final String MSG_REMOTE_SEARCH_INVALID_REGEX = "RSEG1601"; + + // yantzi: artemis 6.0, offline messages + public static final String MSG_OFFLINE_CANT_CONNECT = "RSEC3001"; + + // file import/export messages + public static final String MSG_IMPORT_EXPORT_UNABLE_TO_USE_CONNECTION = "RSEF5101"; + public static final String MSG_IMPORT_EXPORT_UNEXPECTED_EXCEPTION = "RSEF5102"; + + // jar export messages + public static final String MSG_REMOTE_JAR_EXPORT_OVERWRITE_FILE = "RSEF5103"; +} \ No newline at end of file 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 new file mode 100644 index 00000000000..3d996dedcfa --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPageCompleteListener.java @@ -0,0 +1,34 @@ +/******************************************************************************** + * 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. + * @see {@link 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 new file mode 100644 index 00000000000..663d5a7f4ab --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPreferencesConstants.java @@ -0,0 +1,93 @@ +/******************************************************************************** + * 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; +/** + * Keys into preferences bundle. + */ +public interface ISystemPreferencesConstants +{ + + // root + public static final String ROOT = "org.eclipse.rse.preferences."; + + // keys + public static final String SYSTEMTYPE = ROOT + "systemtype"; + public static final String SYSTEMTYPE_VALUES = ROOT + "systemtype.info"; + public static final String USERIDPERKEY = ROOT + "useridperkey"; + public static final String USERIDKEYS = ROOT + "userid.keys"; + public static final String SHOWFILTERPOOLS = ROOT + "filterpools.show"; + public static final String ACTIVEUSERPROFILES = ROOT + "activeuserprofiles"; + public static final String QUALIFY_CONNECTION_NAMES= ROOT + "qualifyconnectionnames"; + public static final String ORDER_CONNECTIONS = ROOT + "order.connections"; + public static final String HISTORY_FOLDER = ROOT + "history.folder"; + public static final String HISTORY_QUALIFIED_FOLDER= ROOT + "history.qualified.folder"; + public static final String SHOWHIDDEN = ROOT + "showhidden"; + public static final String SHOWNEWCONNECTIONPROMPT = ROOT + "shownewconnection"; + public static final String REMEMBER_STATE = ROOT + "rememberState"; + public static final String USE_DEFERRED_QUERIES = ROOT + "useDeferredQueries"; + public static final String RESTORE_STATE_FROM_CACHE = ROOT + "restoreStateFromCache"; + public static final String CASCADE_UDAS_BYPROFILE = ROOT + "uda.cascade"; + public static final String FILETRANSFERMODEDEFAULT = ROOT + "filetransfermodedefault"; + public static final String DAEMON_AUTOSTART = ROOT + "daemon.autostart"; + public static final String DAEMON_PORT = ROOT + "daemon.port"; + + public static final String LIMIT_CACHE = ROOT + "limit.cache"; + public static final String MAX_CACHE_SIZE = ROOT + "max.cache.size"; + + public static final String DOSUPERTRANSFER = ROOT + "dosupertransfer"; + public static final String SUPERTRANSFER_ARC_TYPE = ROOT + "supertransfer.archivetype"; + + public static final String DOWNLOAD_BUFFER_SIZE = ROOT + "download.buffer.size"; + public static final String UPLOAD_BUFFER_SIZE = ROOT + "upload.buffer.size"; + + public static final String VERIFY_CONNECTION = ROOT + "verify.connection"; + + // DEFAULTS + public static final boolean DEFAULT_SHOWFILTERPOOLS = false; + public static final boolean DEFAULT_QUALIFY_CONNECTION_NAMES = false; + public static final String DEFAULT_SYSTEMTYPE = ""; + public static final String DEFAULT_USERID = ""; + //DKM public static final String DEFAULT_ACTIVEUSERPROFILES = "Team;Private"; + public static final String DEFAULT_ACTIVEUSERPROFILES = "Team"; + + public static final String DEFAULT_ORDER_CONNECTIONS = ""; + public static final String DEFAULT_HISTORY_FOLDER = ""; + public static final boolean DEFAULT_SHOW_HIDDEN = true; + public static final boolean DEFAULT_SHOWNEWCONNECTIONPROMPT = true; + public static final boolean DEFAULT_REMEMBER_STATE = true; // changed in R2. Phil + public static final boolean DEFAULT_RESTORE_STATE_FROM_CACHE = true; // yantzi: artemis 6.0 + public static final boolean DEFAULT_CASCADE_UDAS_BYPROFILE = false; + public static final int DEFAULT_FILETRANSFERMODE = 0; + + public static final String DEFAULT_TEAMPROFILE = "Team"; + + public static final int FILETRANSFERMODE_BINARY = 0; + public static final int FILETRANSFERMODE_TEXT = 1; + + public static final boolean DEFAULT_DAEMON_AUTOSTART = false; + public static final int DEFAULT_DAEMON_PORT = 4300; + + public static final boolean DEFAULT_LIMIT_CACHE = false; + public static final String DEFAULT_MAX_CACHE_SIZE = "512"; + + public static final String DEFAULT_SUPERTRANSFER_ARCHIVE_TYPE = "zip"; + public static final boolean DEFAULT_DOSUPERTRANSFER = true; + + public static final int DEFAULT_DOWNLOAD_BUFFER_SIZE = 4; + + public static final boolean DEFAULT_VERIFY_CONNECTION = true; +} \ No newline at end of file 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 new file mode 100644 index 00000000000..f02c0eb561a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemRenameTarget.java @@ -0,0 +1,41 @@ +/******************************************************************************** + * 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 new file mode 100644 index 00000000000..4137d69160e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemStringsInputAction.java @@ -0,0 +1,28 @@ +/******************************************************************************** + * 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 new file mode 100644 index 00000000000..54afdfa3fc3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemThemeConstants.java @@ -0,0 +1,37 @@ +/******************************************************************************** + * 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"; + public static final String MESSAGE_WARNING_COLOR = "MESSAGE_WARNING_COLOR" ; + public static final String MESSAGE_INFORMATION_COLOR = "MESSAGE_INFORMATION_COLOR"; + + // color constants used by Remote Commnds view + public static final String REMOTE_COMMANDS_VIEW_BG_COLOR = "REMOTE_COMMANDS_VIEW_BG_COLOR"; + public static final String REMOTE_COMMANDS_VIEW_FG_COLOR = "REMOTE_COMMANDS_VIEW_FG_COLOR"; + public static final String REMOTE_COMMANDS_VIEW_PROMPT_COLOR = "REMOTE_COMMANDS_VIEW_PROMPT_COLOR"; + + // font constant used by Remote Commands view + public static final String REMOTE_COMMANDS_VIEW_FONT = "REMOTE_COMMANDS_VIEW_FONT"; +} \ 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 new file mode 100644 index 00000000000..e5d2363a249 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemVerifyListener.java @@ -0,0 +1,33 @@ +/******************************************************************************** + * 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.IBMBaseServerLauncherForm}. + * 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/MassagerAddQuotes.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerAddQuotes.java new file mode 100644 index 00000000000..93006be85c3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerAddQuotes.java @@ -0,0 +1,86 @@ +/******************************************************************************** + * 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; + +/** + * 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(); + } + + + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..761b4ad2544 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCase.java @@ -0,0 +1,110 @@ +/******************************************************************************** + * 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; +/** + * This massager folds the input text into either uppercase or lowercase, + * depending on the value pass to the constructor or setter. + *

+ * 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(); + } +} \ No newline at end of file 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 new file mode 100644 index 00000000000..f87d2773b40 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCaseOutsideQuotes.java @@ -0,0 +1,197 @@ +/******************************************************************************** + * 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; +/** + * This massager folds the input text into either uppercase or lowercase, + * but ONLY for those portions of the string that are not inside delimiters. + *

+ * 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. + *

+ * 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. + *

+ * 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= 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 + } +} \ No newline at end of file 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 new file mode 100644 index 00000000000..92e614a3e53 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerRemoveQuotes.java @@ -0,0 +1,192 @@ +/******************************************************************************** + * 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; + +/** + * Utility class used by UI widgets to format a srcpf or member Description string.
+ * 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.
+ * 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; + } + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..ba1c611d842 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/Mnemonics.java @@ -0,0 +1,578 @@ +/******************************************************************************** + * 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; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.rse.ui.widgets.InheritableEntryField; +import org.eclipse.swt.events.ArmListener; +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; + + + +/** + * A class for creating unique mnemonics per control per window. + */ +public class Mnemonics +{ + private static final String[] TransparentEndings = { // endings that should appear after a mnemonic + "...", // ellipsis + ">>", // standard "more" + "<<", // standard "less" + ">", // "more" -- non-standard usage, must appear in list after >> + "<", // "less" -- non-standard usage, must appear in list after << + ":", // colon + "\uff0e\uff0e\uff0e", // wide ellipsis + "\uff1e\uff1e", // wide standard "more" + "\uff1c\uff1c", // wide standard "less" + "\uff1e", // wide non-standard "more" + "\uff1c", // wide non-standard "less" + "\uff1a" // wide colon + }; + + private StringBuffer mnemonics = new StringBuffer(); // mnemonics used so far + private static final String candidateChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + private String preferencePageMnemonics = null; // mnemonics used by Eclipse on preference pages + private String wizardPageMnemonics = null; // mnemonics used by Eclipse on wizard pages + // private static String preferencePageMnemonics = "AD"; // mnemonics used by Eclipse on preference pages + // private static String wizardPageMnemonics = "FBN"; // mnemonics used by Eclipse on wizard pages + public static final char MNEMONIC_CHAR = '&'; + private boolean onPrefPage = false; + private boolean onWizardPage = false; + private boolean applyMnemonicsToPrecedingLabels = true; + + /** + * Clear the list for re-use + */ + public void clear() + { + mnemonics = new StringBuffer(); + } + + /** + * Inserts an added mnemonic of the form (&x) into a StringBuffer at the correct point. + * Checks for transparent endings and trailing spaces. + * @param label the label to check + */ + private static void insertMnemonic(StringBuffer label, String mnemonic) { + int p = label.length(); + // check for trailing spaces #1 + while (p > 0 && label.charAt(p - 1) == ' ') { + p--; + } + // check for transparent endings + for (int i = 0; i < TransparentEndings.length; i++) { + String transparentEnding = TransparentEndings[i]; + int l = transparentEnding.length(); + int n = p - l; + if (n >= 0) { + String labelEnding = label.substring(n, n + l); + if (labelEnding.equals(transparentEnding)) { + p = n; + break; + } + } + } + // check for trailing spaces #2 + while (p > 0 && label.charAt(p - 1) == ' ') { + p--; + } + // make sure there is something left to attach a mnemonic to + if (p > 0) { + label.insert(p, mnemonic); + } + } + + /** + * Given a string, this starts at the first character and iterates until + * it finds a character not previously used as a mnemonic on this page. + * Not normally called from other classes, but rather by the setMnemonic + * methods in this class. + * @param label String to which to generate and apply the mnemonic + * @return input String with '&' inserted in front of the unique character + */ + public String setUniqueMnemonic(String label) + { + + // Kludge for now + // If there is already a mnemonic, remove it + label = removeMnemonic(label); + //int iMnemonic = label.indexOf( MNEMONIC_CHAR ); + //if( iMnemonic >= 0 && iMnemonic < label.length() - 1 ){ + //mnemonics.append( label.charAt( iMnemonic + 1 ) ); + //return label; + //} + + int labelLen = label.length(); + if (labelLen == 0) + return label; + else if ((labelLen == 1) && label.equals("?")) + return label; + StringBuffer newLabel = new StringBuffer(label); + int mcharPos = findUniqueMnemonic(label); + if (mcharPos != -1) + newLabel.insert(mcharPos,MNEMONIC_CHAR); + // if no unique character found, then + // find a new arbitrary one from the alphabet... + else + { + mcharPos = findUniqueMnemonic(candidateChars); + if (mcharPos != -1) + { + String addedMnemonic = "(" + MNEMONIC_CHAR + candidateChars.charAt(mcharPos) + ")"; + insertMnemonic(newLabel, addedMnemonic); + } + } + return newLabel.toString(); + } // end getUniqueMnemonic + /** + * 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 + */ + public static String applyMnemonic(String label, char mnemonicChar) + { + int labelLen = label.length(); + if (labelLen == 0) + return label; + StringBuffer newLabel = new StringBuffer(label); + int mcharPos = findCharPos(label, mnemonicChar); + if (mcharPos != -1) + newLabel.insert(mcharPos,MNEMONIC_CHAR); + else + { + String addedMnemonic = new String("("+MNEMONIC_CHAR + mnemonicChar + ")"); + insertMnemonic(newLabel, addedMnemonic); + } + return newLabel.toString(); + } // end getUniqueMnemonic + /** + * Given a char, find its position in the given string + */ + private static int findCharPos(String label, char charToFind) + { + int pos = -1; + for (int idx=0; (pos==-1) && (idx 0)) + button.setText(setUniqueMnemonic(text)); + } + /** + * If a button is removed from a dialog window, call this method to remove its mnemonic from the list for this dialog. + * This frees it up for another button to use. + */ + public void removeMnemonic(Button button) + { + String text = button.getText(); + if (text == null) + return; + int idx = text.indexOf(MNEMONIC_CHAR); + if (idx >= 0) + { + StringBuffer buffer = new StringBuffer(text); + char mchar = buffer.charAt(idx+1); // the char after the & + buffer.deleteCharAt(idx); // delete the & + boolean found = false; + for (int mdx=0; !found && (mdx < mnemonics.length()); mdx++) + if (mnemonics.charAt(mdx) == mchar) + { + found = true; + mnemonics.deleteCharAt(mdx); + } + + button.setText(buffer.toString()); + } + } + /** + * Helper method to strip the mnemonic from a string. + * Useful if using Eclipse supplied labels + */ + public static String removeMnemonic(String text) + { + int idx = text.indexOf(MNEMONIC_CHAR); + if (idx >= 0) + { + StringBuffer buffer = new StringBuffer(text); + char mchar = buffer.charAt(idx+1); // the char after the & + buffer.deleteCharAt(idx); // delete the & + + // in case of already appended (&X), remove the remaining (X) + if ( buffer.length() > (1 + idx) && idx > 1 && buffer.charAt(idx+1) == ')' && buffer.charAt(idx-1) == '(' ) + buffer.delete(idx - 1, idx + 2); + return buffer.toString(); + } + else + return text; + } + /** + * Remove and free up mnemonic + */ + public String removeAndFreeMnemonic(String text) + { + int idx = text.indexOf(MNEMONIC_CHAR); + if (idx >= 0) + { + StringBuffer buffer = new StringBuffer(text); + char mchar = buffer.charAt(idx+1); // the char after the & + buffer.deleteCharAt(idx); // delete the & + boolean found = false; + for (int mdx=0; !found && (mdx < mnemonics.length()); mdx++) + if (mnemonics.charAt(mdx) == mchar) + { + found = true; + mnemonics.deleteCharAt(mdx); + } + return buffer.toString(); + } + else + return text; + } + + /** + * 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. + * @return the mnemonic if assigned, else a blank character. + */ + public static char getMnemonic(String text) + { + int idx = text.indexOf(MNEMONIC_CHAR); + if (idx >= 0) + return text.charAt(idx+1); + else + return ' '; + } + + /** + * 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. + */ + public void setMnemonics(Composite parent) + { + Control children[] = parent.getChildren(); + if (children != null) + { + //com.ibm.etools.systems.SystemPlugin.getDefault().logMessage("setMnemonics: child count = " + children.length); + Control currChild = null; + boolean bSetText = false; + for (int idx=0; idx < children.length; idx++) + { + currChild = children[idx]; + // composite? Recurse + // d54732: but do not 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 anyway (KM) + if ((currChild instanceof Composite) && + (!applyMnemonicsToPrecedingLabels || (applyMnemonicsToPrecedingLabels && + !(currChild instanceof Combo) && !(currChild instanceof InheritableEntryField)))) + setMnemonics((Composite)currChild); + // button? select and apply unique mnemonic... + else if (currChild instanceof Button) + { + Button currButton = (Button)currChild; + String text = currButton.getText(); + if ((text!=null) && (text.trim().length()>0)) + { + currButton.setText(setUniqueMnemonic(text)); + bSetText = true; + } + } + // entry field or combo box? select and apply unique mnemonic to preceding label... + else if (applyMnemonicsToPrecedingLabels && (idx>0) && ((currChild instanceof Text) || (currChild instanceof Combo) || (currChild instanceof InheritableEntryField)) && + (children[idx-1] instanceof Label)) + { + Label currLabel = (Label)children[idx-1]; + String text = currLabel.getText(); + if ((text!=null) && (text.trim().length()>0)) + { + currLabel.setText(setUniqueMnemonic(text)); + bSetText = true; + } + } + } + if ( bSetText == true ) + parent.layout(true); // in case a (x) was appended, we need to layout the controls again + } + } + + /** + * Given a menu, this method walks all the items and assigns each a unique + * memnonic. Also handles casdading submenus. + * Call this after populating the menu. + */ + public void setMnemonics(Menu menu) + { + MenuItem[] children = menu.getItems(); + if ((children != null) && (children.length>0)) + { + MenuItem currChild = null; + for (int idx=0; idx < children.length; idx++) + { + currChild = children[idx]; + String text = currChild.getText(); + if ((text!=null)&&(text.length()>0)) + { + if (text.indexOf(MNEMONIC_CHAR) < 0) // bad things happen when setting mnemonics twice! + { + Image image = currChild.getImage(); + currChild.setText(setUniqueMnemonic(text)); + if (image != null) + currChild.setImage(image); + } + } + } + } + } + + /** + * Given a menu, this method walks all the items and assigns each a unique + * memnonic. Also handles casdading submenus. + *

+ * Also, since while we are at it, this overloaded method also sets a given ArmListener + * to each menu item, perhaps for the purpose of displaying tooltip text. + * It makes sense to do this when doing mnemonics because both must be done for every menu item + * with text and must be done exactly once for each. + *

+ * Call this after populating the menu. + */ + public void setMnemonicsAndArmListener(Menu menu, ArmListener listener) + { + MenuItem[] children = menu.getItems(); + if ((children != null) && (children.length>0)) + { + MenuItem currChild = null; + for (int idx=0; idx < children.length; idx++) + { + currChild = children[idx]; + String text = currChild.getText(); + if ((text!=null)&&(text.length()>0)) + { + int mnemonicIndex = text.indexOf(MNEMONIC_CHAR); + if (mnemonicIndex < 0) // bad things happen when setting mnemonics twice! + { + Image image = currChild.getImage(); + currChild.setText(setUniqueMnemonic(text)); + if (image != null) + currChild.setImage(image); + currChild.addArmListener(listener); + } + else + // hmm, already has a mnemonic char. Either it is an Eclipse/BP-supplied action, or we have been here before. + // The distinction is important as want to add an Arm listener, but only once! + { + // for now we do the brute force ugly thing... + Image image = currChild.getImage(); + + // need to adjust any action that already has this mnemonic + char c = text.charAt(mnemonicIndex + 1); + + // anything already have this? + if (!isUniqueMnemonic(c)) + { + // if so, we need to adjust existing action + for (int n = 0; n < idx; n++) + { + MenuItem oChild = children[n]; + String oText = oChild.getText(); + char oldN = getMnemonic(oText); + if (oldN == c) + { + // this one now needs to change + String cleanText = removeMnemonic(oText); + oChild.setText(setUniqueMnemonic(cleanText)); + } + } + } + + text = removeAndFreeMnemonic(text); + currChild.setText(setUniqueMnemonic(text)); + if (image != null) + currChild.setImage(image); + currChild.removeArmListener(listener); // just in case + currChild.addArmListener(listener); + } + } + } + } + } + + /** + * 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) + { + this.onPrefPage = page; + 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) + { + this.onWizardPage = page; + return this; + } + + /** + * Set whether to apply mnemonics to labels preceding text fields, combos and inheritable entry fields. + * This is for consistency with Eclipse. Only set to false 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 true to apply mnemonic to preceding labels, false otherwise. + * @return this instance, for convenience + */ + public Mnemonics setApplyMnemonicsToPrecedingLabels(boolean apply) { + this.applyMnemonicsToPrecedingLabels = apply; + return this; + } + +} \ 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 new file mode 100644 index 00000000000..6dd7e691acf --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemBaseForm.java @@ -0,0 +1,303 @@ +/******************************************************************************** + * 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 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. + *

+ * 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. + *

+ * 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 //, ISystemMessages +{ + + 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.
+ * 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 {@link #addPageCompleteListener(ISystemPageCompleteListener)} + */ + protected void setPageComplete(boolean complete) + { + this.complete = complete; + if (pageCompleteListeners != null) + { + for (int idx=0; idx + * 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. + *

+ */ + +public class SystemConnectionForm + implements Listener, ISystemMessages, ISystemUserIdConstants, + SelectionListener, Runnable, IRunnableWithProgress +{ + + public static final boolean CREATE_MODE = false; + public static final boolean UPDATE_MODE = true; + public static String lastSystemType = null; + + + // 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; + + // 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[] restrictSystemTypesTo; + protected String defaultSystemType, 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 = USERID_LOCATION_CONNECTION; + protected boolean callerInstanceOfWizardPage, callerInstanceOfSystemPromptDialog, callerInstanceOfPropertyPage; + protected boolean userIdFromSystemTypeDefault; + protected boolean updateMode = false; + protected boolean initDone = 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; + + /** + * 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 = SystemPlugin.getTheSystemRegistry().getActiveSystemProfileNames(); + callerInstanceOfWizardPage = (caller instanceof WizardPage); + callerInstanceOfSystemPromptDialog = (caller instanceof SystemPromptDialog); + callerInstanceOfPropertyPage = (caller instanceof PropertyPage); + + userIdValidator = new ValidatorUserId(true); // false => allow empty? Yes. + defaultUserId = ""; + } + + // ------------------------------------------------------------- + // 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 + */ + public void restrictSystemType(String systemType) + { + if (systemType.equals("*")) + return; + this.restrictSystemTypesTo = new String[1]; + this.restrictSystemTypesTo[0] = systemType; + if (defaultSystemType == null) + defaultSystemType = systemType; + } + /** + * Call this to restrict the system types that the user is allowed to choose + */ + public void restrictSystemTypes(String[] systemTypes) + { + if (systemTypes == null) + return; + else if ((systemTypes.length==1) && (systemTypes[0].equals("*"))) + return; + this.restrictSystemTypesTo = systemTypes; + if (defaultSystemType == null) + defaultSystemType = systemTypes[0]; + } + + + /** + * Initialize input fields to current values in update mode. + * Note in update mode we do NOT allow users to change the system type. + * This must be called after 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. + * This must be called after 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; + defaultSystemType = conn.getSystemType(); + defaultConnectionName = conn.getAliasName(); + defaultHostName = conn.getHostName(); + defaultUserId = conn.getLocalDefaultUserId(); + defaultDescription = conn.getDescription(); + defaultProfile = conn.getSystemProfile().getName(); + defaultWorkOffline = conn.isOffline(); + + if (updateMode) + { + defaultProfileNames = new String[1]; + defaultProfileNames[0] = defaultProfile; + } + + if (contentsCreated) + doInitializeFields(); + } + + /** + * Preset the connection name + */ + public void setConnectionName(String name) + { + defaultConnectionName = name; + } + /** + * Preset the host name + */ + public void setHostName(String name) + { + defaultHostName = name; + } + + + /** + * 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 = SystemPlugin.getPluginMessage(MSG_HOSTNAME_VERIFYING); + } + + try + { + getRunnableContext().run(true, true, this); + } + catch (InterruptedException e) + { + // user canceled + ok = false; + controlInError = textHostName; + } + catch (InvocationTargetException e) + { + // error found + errorMessage = SystemPlugin.getPluginMessage(MSG_HOSTNAME_NOTFOUND); + errorMessage.makeSubstitution(currentHostName); + controlInError = textHostName; + } + } + } + + // 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.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 = USERID_LOCATION_CONNECTION; // edit this connection's local value + else + userIdLocation = USERID_LOCATION_DEFAULT_SYSTEMTYPE; // edit the preference value + } + else + userIdLocation = USERID_LOCATION_NOTSET; + SystemPreferencesManager.getPreferencesManager().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 + * + * @since RSE 6.0 + */ + private boolean enableOfflineCB() + { + // disabled offline checkbox for new connections + if (!updateMode) + { + return false; + } + + return SystemPlugin.getDefault().getSystemTypeEnableOffline(defaultSystemType); + } + + /** + * Return user-entered System Type. + * Call this after finish ends successfully. + */ + public String getSystemType() + { + if (textSystemType != null) + return textSystemType.getText().trim(); + else + 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 ""; + } + + /** + * 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 + * ISystemUserIdConstants + */ + public int getUserIdLocation() + { + if ((textUserId != null) && (textUserId.getText().trim().length()>0)) + return userIdLocation; + else + return 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) + { + contentsCreated = true; + 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, ""); + 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, SystemPlugin.HELPPREFIX + "ccon0001"); + } + } + + if (!updateMode) + SystemWidgetHelpers.createLabel(composite_prompts, " ", 2); // filler + + // SYSTEMTYPE PROMPT IN UPDATE MODE OR RESTRICTED MODE + if (updateMode || ((restrictSystemTypesTo != null) && (restrictSystemTypesTo.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,""); + textSystemTypeReadOnly.setToolTipText(SystemResources.RESID_CONNECTION_SYSTEMTYPE_READONLY_TIP); + } + else + singleTypeMode = true; + } + + if (updateMode) + SystemWidgetHelpers.createLabel(composite_prompts, " ", nbrColumns); // filler + + // 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, SystemPlugin.HELPPREFIX + "ccon0002"); + + // 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); + textSystemType = SystemWidgetHelpers.createSystemTypeCombo(composite_prompts,null,restrictSystemTypesTo); + textSystemType.setToolTipText(SystemResources.RESID_CONNECTION_SYSTEMTYPE_TIP); + SystemWidgetHelpers.setHelp(textSystemType, SystemPlugin.HELPPREFIX + "ccon0003"); + } + + // 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 = RemoteSystemsPreferencePage.getSystemTypePreference(); + if ((defaultSystemType == null) || (defaultSystemType.length() == 0)) + defaultSystemType = lastSystemType; + if ((defaultSystemType == null) || (defaultSystemType.length() == 0)) + defaultSystemType = textSystemType.getItem(0); + } + + textHostName = SystemWidgetHelpers.createHostNameCombo(composite_prompts,null,defaultSystemType); + textHostName.setToolTipText(SystemResources.RESID_CONNECTION_HOSTNAME_TIP); + SystemWidgetHelpers.setHelp(textHostName, SystemPlugin.HELPPREFIX + "ccon0004"); + + // 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, SystemPlugin.HELPPREFIX + "ccon0005"); + } + + // 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, SystemPlugin.HELPPREFIX + "ccon0006"); + + // VERIFY HOST NAME CHECKBOX + SystemWidgetHelpers.createLabel(composite_prompts, " ", nbrColumns); // filler + 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.getPreferencesManager().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, SystemPlugin.HELPPREFIX + "wofp0000"); + } + + if (!initDone) + doInitializeFields(); + + 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(); + } + } + ); + 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.getText()!=null)) + caller.systemTypeSelected(textSystemType.getText(), true); + else if ((restrictSystemTypesTo!=null) && (restrictSystemTypesTo.length==1)) + caller.systemTypeSelected(restrictSystemTypesTo[0], true); + + if (textUserId == null) + userIdLocation = USERID_LOCATION_NOTSET; + + return composite_prompts; // composite; + } + + /** + * 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); + String currSystemType = textSystemType.getText().trim(); + textHostName.setItems(SystemPlugin.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(""); + 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 == SystemPlugin.getPluginMessage(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 SystemNewConnectionWizard) { + SystemNewConnectionWizard connWizard = (SystemNewConnectionWizard)wizard; + AbstractSystemWizardPage mainPage = (AbstractSystemWizardPage)(connWizard.getMainPage()); + + 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 (restrictSystemTypesTo != null) + { + if (textSystemTypeReadOnly != null) + textSystemTypeReadOnly.setText(restrictSystemTypesTo[0]); + if (defaultSystemType == null) + defaultSystemType = restrictSystemTypesTo[0]; + } + else if (defaultSystemType != null) + { + if (textSystemTypeReadOnly != null) + textSystemTypeReadOnly.setText(defaultSystemType); + } + } + // ...selectable: + else + { + if (defaultSystemType == null) + { + defaultSystemType = RemoteSystemsPreferencePage.getSystemTypePreference(); + if ((defaultSystemType == null) || (defaultSystemType.length()==0)) + defaultSystemType = lastSystemType; + } + if (defaultSystemType != null) + { + int selIdx = textSystemType.indexOf(defaultSystemType); + if (selIdx >= 0) + textSystemType.select(selIdx); + } + else + { + textSystemType.select(0); + defaultSystemType = textSystemType.getText(); + } + } + + // --------------- + // connection name + // --------------- + if (defaultConnectionName != null) + textConnectionName.setText(defaultConnectionName); + textConnectionName.setTextLimit(connectionNameLength); + + // ----------- + // host name + // ----------- + 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); + } + + initDone = true; + } + + /** + * Initialize userId values. + * We have to reset after user changes the system type + */ + private void initializeUserIdField(String systemType, String currentUserId) + { + // --------------- + // default user id + // --------------- + String parentUserId = SystemPreferencesManager.getPreferencesManager().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(""); + 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 ISystemValidator object. + * If the ISystemValidator 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 ISystemValidator object. + * If the ISystemValidator reports an error the error message is displayed + * in the Dialog's message line. + * @see #setHostNameValidator(ISystemValidator) + */ + protected SystemMessage validateHostNameInput() + { + String hostName = textHostName.getText().trim(); + if (connectionNameEmpty) // d43191 + internalSetConnectionName(hostName); + errorMessage= null; + if (hostValidator != null) + errorMessage= hostValidator.validate(hostName); + else if (getHostName().length() == 0) + errorMessage = SystemPlugin.getPluginMessage(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 ISystemValidator object. + * If the ISystemValidator 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 = SystemPlugin.getPluginMessage(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 = textSystemType.getText().trim(); + 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); + } + + // --------------------------------------------------------------- + // STATIC METHODS FOR GETTING A CONNECTION NAME VALIDATOR... + // --------------------------------------------------------------- + + /** + * Reusable method to return a name validator for renaming a connection. + * @param 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 = SystemPlugin.getTheSystemRegistry().getHostAliasNames(profile); + if (conn != null) // hmm, line 1 of this method will crash if this is the case! + v.removeElement(conn.getAliasName()); + ValidatorConnectionName connNameValidator = new ValidatorConnectionName(v); + return connNameValidator; + } + /** + * Reusable method to return a name validator for renaming a connection. + * @param 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 = SystemPlugin.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 = SystemPlugin.getTheSystemRegistry(); + ISystemProfile[] profiles = sr.getActiveSystemProfiles(); + ISystemValidator[] connNameValidators = new ISystemValidator[profiles.length]; + for (int idx=0; idx + * Only exposes core set of MenuManager methods. Rest can be + * accessed by calling getMenuManger(). + */ +public class SystemMenuManager //implements IMenuManager + implements ISystemContextMenuConstants +{ + 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 GROUP EACH ACTION SHOULD BE ADDED TO, SO WE FORCE + * YOU TO CALL APPENDTOGROUP! + * + public void add(IAction action) + { + mgr.add(action); + }*/ + + /** + * Method declared on IContributionManager. + * Append an action to the menu. + *

+ * Intercepted so we can direct appends to certain groups into appropriate cascading submenus. + *

+ * @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. + *

+ * Intercepted so we can direct appends to certain groups into appropriate cascading submenus. + *

+ * @param groupName group to append to. See {@link org.eclipse.rse.ui.ISystemContextMenuConstants}. + * @param submenu submenu 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. + *

+ * Intercepted so we can direct appends to certain groups into appropriate cascading submenus. + *

+ * @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. + *

+ * Intercepted so we can direct appends to certain groups into appropriate cascading submenus. + *

+ * @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 GROUPS AND DECIDING PER 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; + } + + private IMenuManager getSpecialSubMenu(String groupName) + { + IMenuManager subMenu = null; + menuCreated = false; + if (groupName!=null) + { + if (groupName.equals(GROUP_NEW)) + { + if (newSubMenu == null) + { + newSubMenu = (new SystemCascadingNewAction()).getSubMenu(); + mgr.appendToGroup(GROUP_NEW, newSubMenu); + menuCreated = true; + } + subMenu = newSubMenu; + } + /* + else if (groupName.equals(GROUP_GOTO)) + { + if (gotoSubMenu == null) + { + gotoSubMenu = (new SystemCascadingGoToAction()).getSubMenu(); + mgr.appendToGroup(GROUP_GOTO, gotoSubMenu); + menuCreated = true; + } + subMenu = gotoSubMenu; + } + */ + else if (groupName.equals(GROUP_EXPANDTO)) + { + if (expandtoSubMenu == null) + { + expandtoSubMenu = (new SystemCascadingExpandToAction()).getSubMenu(); + mgr.appendToGroup(GROUP_EXPANDTO, expandtoSubMenu); + menuCreated = true; + } + subMenu = expandtoSubMenu; + } + else if (groupName.equals(GROUP_OPENWITH)) + { + if (openwithSubMenu == null) + { + openwithSubMenu = (new SystemCascadingOpenWithAction()).getSubMenu(); + mgr.appendToGroup(GROUP_OPENWITH, openwithSubMenu); + menuCreated = true; + } + subMenu = openwithSubMenu; + } + else if (groupName.equals(GROUP_BROWSEWITH)) + { + if (browsewithSubMenu == null) + { + browsewithSubMenu = (new SystemCascadingBrowseWithAction()).getSubMenu(); + mgr.appendToGroup(GROUP_BROWSEWITH, browsewithSubMenu); + menuCreated = true; + } + subMenu = browsewithSubMenu; + } + else if (groupName.equals(GROUP_COMPAREWITH)) + { + if (comparewithSubMenu == null) + { + comparewithSubMenu = (new SystemCascadingCompareWithAction()).getSubMenu(); + mgr.appendToGroup(GROUP_COMPAREWITH, comparewithSubMenu); + menuCreated = true; + } + subMenu = comparewithSubMenu; + } + else if (groupName.equals(GROUP_REPLACEWITH)) + { + if (replacewithSubMenu == null) + { + replacewithSubMenu = (new SystemCascadingReplaceWithAction()).getSubMenu(); + mgr.appendToGroup(GROUP_REPLACEWITH, replacewithSubMenu); + menuCreated = true; + } + subMenu = replacewithSubMenu; + } + else if (groupName.equals(GROUP_WORKWITH)) + { + if (workwithSubMenu == null) + { + workwithSubMenu = (new SystemCascadingWorkWithAction()).getSubMenu(); + mgr.appendToGroup(GROUP_WORKWITH, workwithSubMenu); + menuCreated = true; + } + subMenu = workwithSubMenu; + } + else if (groupName.equals(GROUP_VIEWER_SETUP)) + { + if (viewSubMenu == null) + { + viewSubMenu = (new SystemCascadingViewAction()).getSubMenu(); + mgr.appendToGroup(GROUP_VIEWER_SETUP, viewSubMenu); + menuCreated = true; + } + subMenu = viewSubMenu; + } + else if (groupName.equals(GROUP_STARTSERVER)) + { + if (serverSubMenu == null) + { + serverSubMenu = (new SystemCascadingRemoteServersAction()).getSubMenu(); + mgr.appendToGroup(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(MENU_NEW)) + groupName = GROUP_NEW; + else if (menuID.equals(MENU_GOTO)) + groupName = GROUP_GOTO; + else if (menuID.equals(MENU_EXPANDTO)) + groupName = GROUP_EXPANDTO; + else if (menuID.equals(MENU_OPENWITH)) + groupName = GROUP_OPENWITH; + else if (menuID.equals(MENU_BROWSEWITH)) + groupName = GROUP_BROWSEWITH; + else if (menuID.equals(MENU_COMPAREWITH)) + groupName = GROUP_COMPAREWITH; + else if (menuID.equals(MENU_REPLACEWITH)) + groupName = GROUP_REPLACEWITH; + else if (menuID.equals(MENU_WORKWITH)) + groupName = GROUP_WORKWITH; + else if (menuID.equals(MENU_STARTSERVER)) + groupName = 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/SystemProfileForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemProfileForm.java new file mode 100644 index 00000000000..60074902fa7 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemProfileForm.java @@ -0,0 +1,263 @@ +/******************************************************************************** + * 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.wizard.WizardPage; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +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.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. + *

+ * May be used to populate a dialog or a wizard page. + */ + +public class SystemProfileForm + implements Listener, ISystemMessages +{ + + // GUI widgets + protected Label profileLabel; + protected Control verbage; + //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 showVerbage = 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 showVerbage. Specify true to show first-time-user verbage. + */ + public SystemProfileForm(ISystemMessageLine msgLine, Object caller, ISystemProfile profile, boolean showVerbage) + { + this.msgLine = msgLine; + this.caller = caller; + this.profile = profile; + this.showVerbage = showVerbage; + callerInstanceOfWizardPage = (caller instanceof WizardPage); + callerInstanceOfSystemPromptDialog = (caller instanceof SystemPromptDialog); + nameValidator = SystemPlugin.getTheSystemRegistry().getSystemProfileManager().getProfileNameValidator(profile); + } + + /** + * 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); + + // VERBAGE LABEL + if (showVerbage) + { + verbage = SystemWidgetHelpers.createVerbage( + composite_prompts, SystemResources.RESID_PROFILE_PROFILENAME_VERBAGE, nbrColumns, false, 200); + SystemWidgetHelpers.createLabel(composite_prompts, "", nbrColumns); // dummy line for spacing + } + + // 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; + else + { + } + if (errMsg != null) + { + 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); + } + + // --------------------------------------------- + // 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 ISystemValidator object. + * If the ISystemValidator 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); + } + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPropertyResources.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPropertyResources.java new file mode 100644 index 00000000000..1bd1d9a56bc --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPropertyResources.java @@ -0,0 +1,51 @@ +/******************************************************************************** + * 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; + +import org.eclipse.osgi.util.NLS; + +public class SystemPropertyResources extends NLS +{ + private static String BUNDLE_NAME = "org.eclipse.rse.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_DESCRIPTION_LABEL; + public static String RESID_PROPERTY_DESCRIPTION_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); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPropertyResources.properties b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPropertyResources.properties new file mode 100644 index 00000000000..1bae7213902 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPropertyResources.properties @@ -0,0 +1,34 @@ +################################################################################ +# 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. +################################################################################ + +############################################################## +# PROPERTY VALUES... +############################################################## +# NLS_MESSAGEFORMAT_NONE + +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_PROPERTY_DESCRIPTION_LABEL=Description +RESID_PROPERTY_DESCRIPTION_TOOLTIP=Description of resource + +RESID_TERM_NOTAPPLICABLE=Not applicable +RESID_TERM_NOTAVAILABLE=Not available +RESID_PORT_DYNAMICSELECT=(First-available) +RESID_PROPERTY_INHERITED=(Inherited) + +RESID_PROPERTY_FILTERTYPE_VALUE=Remote system filter \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemResources.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemResources.java new file mode 100644 index 00000000000..301da49e3a5 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemResources.java @@ -0,0 +1,1227 @@ +/******************************************************************************** + * 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; + +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.ui.SystemResources";//$NON-NLS-1$ + + /** + * Current release as a number (multiplied by 10). E.g. 30 is for release + * 3.0. + */ + public static final int CURRENT_RELEASE = 700; // updated to new release +/** + * Current release as a string. + */ + public static final String CURRENT_RELEASE_NAME = "7.0.0"; + + + // 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_APPLY_LABEL; + public static String BUTTON_APPLY_TOOLTIP; + public static String BUTTON_RESET_LABEL; + public static String BUTTON_RESET_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_LOCAL; + 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_VERBAGE; + 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_VERBAGE; + + // GENERIC SINGLE-SELECT RENAME DIALOG... + + public static String RESID_SIMPLE_RENAME_PROMPT_LABEL; + public static String RESID_SIMPLE_RENAME_PROMPT_TOOLTIP; + + + + 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_RESOURCEPROMPT_LABEL; + public static String RESID_DELETE_RESOURCEPROMPT_TOOLTIP; + + public static String RESID_DELETE_TIP; + + public static String RESID_DELETE_WARNING_LABEL; + public static String RESID_DELETE_WARNING_TOOLTIP; + + public static String RESID_DELETE_WARNINGLOCAL_LABEL; + public static String RESID_DELETE_WARNINGLOCAL_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; + public static String RESID_COPY_TARGET_FILTER_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; + public static String RESID_MOVE_TARGET_FILTER_PROMPT; + + // GENERIC RESOURCE NAME COLLISION DIALOG... + public static String RESID_COLLISION_RENAME_TITLE; + public static String RESID_COLLISION_RENAME_VERBAGE; + public static String RESID_COLLISION_RENAME_LABEL; + public static String RESID_COLLISION_RENAME_TOOLTIP; + + // GENERIC SELECT CONNECTION DIALOG... + public static String RESID_SELECTCONNECTION_TITLE; + public static String RESID_SELECTCONNECTION_VERBAGE; + + // ------------------------- + // 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_VERBAGE; + + // RENAME DEFAULT PROFILE WIZARD PAGE... + public static String RESID_RENAMEDEFAULTPROFILE_PAGE1_TITLE; + + public static String RESID_RENAMEDEFAULTPROFILE_PAGE1_DESCRIPTION; + + public static String RESID_PROFILE_PROFILENAME_LABEL; + public static String RESID_PROFILE_PROFILENAME_TIP; + public static String RESID_PROFILE_PROFILENAME_VERBAGE; + + + // 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_TOOLTIP; + 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_SUBSYSTEMPAGE_FILES_DESCRIPTION; + public static String RESID_NEWCONN_SUBSYSTEMPAGE_FILES_TITLE; + public static String RESID_NEWCONN_SUBSYSTEMPAGE_FILES_VERBAGE1; + public static String RESID_NEWCONN_SUBSYSTEMPAGE_FILES_VERBAGE2; + 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_LABEL; + 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_HOSTNAME_READONLY_LABEL; + public static String RESID_CONNECTION_HOSTNAME_READONLY_TIP; + + public static String RESID_CONNECTION_VERIFYHOSTNAME_LABEL; + public static String RESID_CONNECTION_VERIFYHOSTNAME_TOOLTIP; + + public static String RESID_CONNECTION_USERID_LABEL; + public static String RESID_CONNECTION_USERID_TIP; + + 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_DEFAULTPORT_LABEL; + public static String RESID_CONNECTION_DEFAULTPORT_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; + + // CHANGE SYSTEM CONNECTION DIALOG... + public static String RESID_CHGCONN_TITLE; + + // SET DEFAULT USERID PER SYSTEM TYPE DIALOG... + public static String RESID_USERID_PER_SYSTEMTYPE_TITLE; + public static String RESID_USERID_PER_SYSTEMTYPE_SYSTEMTYPE_LABEL; + public static String RESID_USERID_PER_SYSTEMTYPE_SYSTEMTYPE_TOOLTIP; + public static String RESID_USERID_PER_SYSTEMTYPE_LABEL; + public static String RESID_USERID_PER_SYSTEMTYPE_TOOLTIP; + + + + // 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; + + public static String RESID_NEWFILTER_POOLTIP; + + // NAME PAGE (page 2) OF NEW FILTER WIZARD... + public static String RESID_NEWFILTER_PAGE2_DESCRIPTION; + + public static String RESID_NEWFILTER_PAGE2_NAME_VERBAGE; + + public static String RESID_NEWFILTER_PAGE2_POOL_VERBAGE; + + public static String RESID_NEWFILTER_PAGE2_POOL_VERBAGE_TIP; + + public static String RESID_NEWFILTER_PAGE2_PROFILE_VERBAGE; + + 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_VERBAGE; + public static String RESID_NEWFILTER_PAGE3_POOLS_VERBAGE; + + public static String RESID_FILTERALIAS_LABEL; + public static String RESID_FILTERALIAS_TIP; + public static String RESID_FILTERPARENTPOOL_LABEL; + public static String RESID_FILTERPARENTPOOL_TIP; + public static String RESID_FILTERSTRINGS_LABEL; + public static String RESID_FILTERSTRINGS_TIP; + + + // 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; + public static String RESID_CHGFILTER_BUTTON_CREATE_LABEL; + public static String RESID_CHGFILTER_BUTTON_CREATE_TOOLTIP; + + + // CREATE UNNAMED FILTER DIALOG... + public static String RESID_CRTFILTER_TITLE; + + // RENAME SYSTEM FILTER DIALOG... + public static String RESID_RENAME_FILTER_TITLE; + + public static String RESID_RENAME_FILTER_PROMPT; + + // COPY SYSTEM FILTER DIALOG... + public static String RESID_COPY_FILTER_TITLE; + + public static String RESID_COPY_FILTER_PROMPT; + + // NEW SYSTEM FILTER STRING WIZARD... + public static String RESID_NEWFILTERSTRING_TITLE; + public static String RESID_NEWFILTERSTRING_ADD_TITLE; + public static String RESID_NEWFILTERSTRING_PAGE1_TITLE; + public static String RESID_NEWFILTERSTRING_PAGE1_DESCRIPTION; + + public static String RESID_NEWFILTERSTRING_PREFIX_LABEL; + public static String RESID_NEWFILTERSTRING_PREFIX_TOOLTIP; + public static String RESID_NEWFILTERSTRING_PREFIX_PROMPT; + + public static String RESID_FILTERSTRING_STRING_LABEL; + public static String RESID_FILTERSTRING_STRING_TIP; + + // CHANGE FILTER STRING ACTION AND DIALOG... + public static String RESID_CHGFILTERSTRING_PREFIX_LABEL; + public static String RESID_CHGFILTERSTRING_PREFIX_TOOLTIP; + public static String RESID_CHGFILTERSTRING_TITLE; + public static String RESID_CHGFILTERSTRING_PREFIX_PROMPT; + + // 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; + + public static String RESID_TESTFILTERSTRING_TREE_TIP; + + + // WORK WITH HISTORY DIALOG... + public static String RESID_WORKWITHHISTORY_TITLE; + public static String RESID_WORKWITHHISTORY_VERBAGE; + public static String RESID_WORKWITHHISTORY_PROMPT; + public static String RESID_WORKWITHHISTORY_BUTTON_LABEL; + 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_TIP; + + 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; + + + // 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_USERACTION_VALUE; + public static String RESID_TEAMVIEW_CATEGORY_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_USERACTIONS_LABEL; + public static String RESID_TEAMVIEW_CATEGORY_USERACTIONS_TOOLTIP; + + public static String RESID_TEAMVIEW_CATEGORY_COMPILECMDS_LABEL; + public static String RESID_TEAMVIEW_CATEGORY_COMPILECMDS_TOOLTIP; + + public static String RESID_TEAMVIEW_CATEGORY_TARGETS_LABEL; + public static String RESID_TEAMVIEW_CATEGORY_TARGETS_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; + + + // ------------------------------ + // PROPERTY PAGE STRINGS... + // ------------------------------ + // SYSTEMREGISTRY PROPERTIES PAGE... + public static String RESID_SYSTEMREGISTRY_TEXT; + + public static String RESID_SYSTEMREGISTRY_CONNECTIONS; + + // SUBSYSTEM PROPERTIES PAGE... + public static String RESID_SUBSYSTEM_TITLE; + 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_PORT_INHERITBUTTON_INHERIT_TIP; + public static String RESID_SUBSYSTEM_PORT_INHERITBUTTON_LOCAL_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_USERID_INHERITBUTTON_INHERIT_TIP; + public static String RESID_SUBSYSTEM_USERID_INHERITBUTTON_LOCAL_TIP; + + public static String RESID_SUBSYSTEM_SSL_LABEL; + public static String RESID_SUBSYSTEM_SSL_TIP; + + public static String RESID_SUBSYSTEM_ENVVAR_TITLE; + 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_TITLE; + 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_TITLE; + 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_TITLE_LABEL; + 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_TITLE; + public static String RESID_PP_FILTERSTRING_TYPE_VALUE; + + public static String RESID_PP_FILTERSTRING_STRING_LABEL; + public static String RESID_PP_FILTERSTRING_STRING_TOOLTIP; + + 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_TITLE; + 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_VERBAGE; + + // REMOTE SERVER LAUNCH PROPERTIES PAGE... + public static String RESID_PROP_SERVERLAUNCHER_MEANS; + public static String RESID_PROP_SERVERLAUNCHER_MEANS_LABEL; + 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_CONNECTION_NAME; + + 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_ROOT_TITLE; + + 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_DESCRIPTION; + + 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; + + // Unable to load message + public static String RESID_MSG_UNABLETOLOAD; + + // Default filter pool name + public static String RESID_DEFAULT_FILTERPOOL; + + public static String RESID_PERCONNECTION_FILTERPOOL; + + // RSE Communication Perferences + public static String RESID_PREF_COMMUNICATIONS_TITLE; + public static String RESID_PREF_DAEMON_PORT_LABEL; + public static String RESID_PREF_DAEMON_PORT_TOOLTIP; + public static String RESID_PREF_DAEMON_AUTOSTART_LABEL; + public static String RESID_PREF_DAEMON_AUTOSTART_TOOLTIP; + + public static String RESID_PREF_IP_ADDRESS_LABEL; + public static String RESID_PREF_IP_AUTO_LABEL; + public static String RESID_PREF_IP_AUTO_TOOLTIP; + public static String RESID_PREF_IP_MANUAL_LABEL; + public static String RESID_PREF_IP_MANUAL_TOOLTIP; + public static String RESID_PREF_IP_MANUAL_ENTER_LABEL; + public static String RESID_PREF_IP_MANUAL_ENTER_TOOLTIP; + + // 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; + public static String RESID_OFFLINE_WORKOFFLINE_DESCRIPTION; + + // ------------------------------------------- + // remote search view constants + // ------------------------------------------- + + // Search view constants + public static String RESID_SEARCH_VIEW_DEFAULT_TITLE; + + // 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_SYSTEMTYPE_PREFIX_LABEL; + public static String RESID_PREF_SYSTEMTYPE_PREFIX_TOOLTIP; + + public static String RESID_PREF_USERID_PREFIX_LABEL; + public static String RESID_PREF_USERID_PREFIX_TOOLTIP; + + 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_USEDEFERREDQUERIES_PREFIX_LABEL; + public static String RESID_PREF_USEDEFERREDQUERIES_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_IMPORT_TO_PROJECT_LABEL; + public static String ACTION_IMPORT_TO_PROJECT_TOOLTIP; + + public static String ACTION_EXPORT_FROM_PROJECT_LABEL; + public static String ACTION_EXPORT_FROM_PROJECT_TOOLTIP; + + public static String ACTION_NEWFILE_LABEL; + public static String ACTION_NEWFILE_TOOLTIP; + + public static String ACTION_DAEMON_START_LABEL; + public static String ACTION_DAEMON_START_TOOLTIP; + + public static String ACTION_DAEMON_STOP_LABEL; + public static String ACTION_DAEMON_STOP_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_LABEL; + public static String ACTION_CASCADING_EXPAND_TOOLTIP; + + public static String ACTION_CASCADING_EXPAND_TO_LABEL; + public static String ACTION_CASCADING_EXPAND_TO_TOOLTIP; + + public static String ACTION_CASCADING_EXPAND_ALL_LABEL; + public static String ACTION_CASCADING_EXPAND_ALL_TOOLTIP; + + public static String ACTION_CASCADING_EXPAND_BY_LABEL; + public static String ACTION_CASCADING_EXPAND_BY_TOOLTIP; + + public static String ACTION_CASCADING_EXPAND_WORKWITH_LABEL; + public static String ACTION_CASCADING_EXPAND_WORKWITH_TOOLTIP; + + public static String ACTION_CASCADING_VIEW_LABEL; + public static String ACTION_CASCADING_VIEW_TOOLTIP; + + public static String ACTION_CASCADING_USERID_LABEL; + public static String ACTION_CASCADING_USERID_TOOLTIP; + + public static String ACTION_CASCADING_PREFERENCES_LABEL; + public static String ACTION_CASCADING_PREFERENCES_TOOLTIP; + + public static String ACTION_CASCADING_TEAM_LABEL; + public static String ACTION_CASCADING_TEAM_TOOLTIP; + + public static String ACTION_TEAM_SYNC_LABEL; + public static String ACTION_TEAM_SYNC_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_ACTIVATE_LABEL; + public static String ACTION_PROFILE_ACTIVATE_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_NEWCONN_LABEL; + public static String ACTION_NEWCONN_TOOLTIP; + + public static String ACTION_ANOTHERCONN_LABEL; + public static String ACTION_ANOTHERCONN_TOOLTIP; + + public static String ACTION_UPDATECONN_LABEL; + public static String ACTION_UPDATECONN_TOOLTIP; + + public static String ACTION_NEWFILTERSTRING_LABEL; + public static String ACTION_NEWFILTERSTRING_TOOLTIP; + + public static String ACTION_ADDFILTERSTRING_LABEL; + public static String ACTION_ADDFILTERSTRING_TOOLTIP; + + public static String ACTION_UPDATEFILTERSTRING_LABEL; + public static String ACTION_UPDATEFILTERSTRING_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_NEWNESTEDFILTER_LABEL; + public static String ACTION_NEWNESTEDFILTER_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_ADDFILTERPOOLREF_LABEL; + public static String ACTION_ADDFILTERPOOLREF_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_SIMPLERENAME_LABEL; + public static String ACTION_SIMPLERENAME_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_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_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_CONTENT_ASSIST; + public static String ACTION_SHOW_TOOLTIP_INFORMATION; + + + 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_TEAM_BROWSEHISTORY_LABEL; + public static String ACTION_TEAM_BROWSEHISTORY_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_ERROR_LIST_LABEL; + public static String ACTION_ERROR_LIST_TOOLTIP; + + public static String ACTION_FIND_FILES_LABEL; + public static String ACTION_FIND_FILES_TOOLTIP; + + public static String ACTION_SEARCH_LABEL; + public static String ACTION_SEARCH_TOOLTIP; + + public static String ACTION_CANCEL_FIND_FILES_LABEL; + public static String ACTION_CANCEL_FIND_FILES_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_CASCADE_LABEL; + public static String ACTION_OPENEXPLORER_CASCADE_TOOLTIP; + + public static String ACTION_OPENEXPLORER_SAMEPERSP_LABEL; + public static String ACTION_OPENEXPLORER_SAMEPERSP_TOOLTIP; + + public static String ACTION_OPENEXPLORER_DIFFPERSP_LABEL; + public static String ACTION_OPENEXPLORER_DIFFPERSP_TOOLTIP; + + public static String ACTION_OPENEXPLORER_DIFFPERSP2_LABEL; + public static String ACTION_OPENEXPLORER_DIFFPERSP2_TOOLTIP; + + public static String ACTION_REMOTE_PROPERTIES_LABEL; + public static String ACTION_REMOTE_PROPERTIES_TOOLTIP; + + public static String ACTION_VIEWFORM_REFRESH_LABEL; + public static String ACTION_VIEWFORM_REFRESH_TOOLTIP; + + public static String ACTION_VIEWFORM_GETLIST_LABEL; + public static String ACTION_VIEWFORM_GETLIST_TOOLTIP; + + public static String ACTION_COMMANDSVIEW_SAVEASFILTER_LABEL; + public static String ACTION_COMMANDSVIEW_SAVEASFILTER_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_BY_LABEL; + public static String ACTION_EXPAND_BY_TOOLTIP; + + public static String ACTION_EXPAND_ALL_LABEL; + public static String ACTION_EXPAND_ALL_TOOLTIP; + + public static String ACTION_EXPAND_OTHER_LABEL; + public static String ACTION_EXPAND_OTHER_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; + + public static String ACTION_SELECTCONNECTION_LABEL; + public static String ACTION_SELECTCONNECTION_TOOLTIP; + + public static String RESID_CHANGE_PREFIX_LABEL; + public static String RESID_CHANGE_PREFIX_TOOLTIP; + + public static String RESID_CHANGEVIAENTRY_PREFIX_LABEL; + public static String RESID_CHANGEVIAENTRY_PREFIX_TOOLTIP; + + public static String RESID_ADDVIAENTRY_PREFIX_LABEL; + public static String RESID_ADDVIAENTRY_PREFIX_TOOLTIP; + + public static String RESID_COPYFROM_PREFIX_LABEL; + public static String RESID_COPYFROM_PREFIX_TOOLTIP; + + public static String RESID_COPYTO_PREFIX_LABEL; + public static String RESID_COPYTO_PREFIX_TOOLTIP; + + public static String RESID_DUPLICATE_PREFIX_LABEL; + public static String RESID_DUPLICATE_PREFIX_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_CONNECTOR_SERVICES_LABEL; + public static String RESID_PROPERTIES_CONNECTOR_SERVICES_TOOLTIP; + 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; + + + public static String ACTION_COMPILE_NOPROMPT_LABEL; + + // RSE Model Objects + public static String RESID_MODELOBJECTS_FILTERSTRING_DESCRIPTION; + public static String RESID_MODELOBJECTS_HOSTPOOL_DESCRIPTION; + public static String RESID_MODELOBJECTS_PROFILE_DESCRIPTION; + public static String RESID_MODELOBJECTS_SERVERLAUNCHER_DESCRIPTION; + public static String RESID_MODELOBJECTS_REFERENCINGOBJECT_DESCRIPTION; + public static String RESID_MODELOBJECTS_FILTER_DESCRIPTION; + public static String RESID_MODELOBJECTS_FILTERPOOL_DESCRIPTION; + public static String RESID_MODELOBJECTS_MODELOBJECT_DESCRIPTION; + + // 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; + + static { + // load message values from bundle file + NLS.initializeMessages(BUNDLE_NAME, SystemResources.class); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemResources.properties b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemResources.properties new file mode 100644 index 00000000000..7970c6a294b --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemResources.properties @@ -0,0 +1,1410 @@ +################################################################################ +# 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. +################################################################################ + +# NLS_MESSAGEFORMAT_NONE + +############################################################## +# 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_APPLY_LABEL=Apply +BUTTON_APPLY_TOOLTIP=Press to apply pending changes +BUTTON_RESET_LABEL=Reset +BUTTON_RESET_TOOLTIP=Press to reset to original values + +TERM_YES=Yes +TERM_NO=No +TERM_TRUE=True +TERM_FALSE=False +TERM_LOCAL=Local +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_CONNECTION_NAME=%1 in profile %2 +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_ROOT_TITLE=Remote Systems Overall Preferences +RESID_PREF_SYSTEMTYPE_PREFIX_LABEL=Default System Type +RESID_PREF_SYSTEMTYPE_PREFIX_TOOLTIP=Default for New Connection wizard +RESID_PREF_USERID_PREFIX_LABEL=Overall Default User ID +RESID_PREF_USERID_PREFIX_TOOLTIP=Overall default, overriddable per system type +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_USEDEFERREDQUERIES_PREFIX_LABEL=Use deferred queries in the Remote Systems view +RESID_PREF_USEDEFERREDQUERIES_PREFIX_TOOLTIP=Select this if, when expanding nodes in the Remote Systems view, you would like queries to happen asynchronously +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 + +############################################################## +# Preference pages for general communications +############################################################## +RESID_PREF_COMMUNICATIONS_TITLE=RSE Communications Preferences +RESID_PREF_DAEMON_PORT_LABEL=RSE communications daemon port number (1 - 65536) +RESID_PREF_DAEMON_PORT_TOOLTIP=Enter the local port number for the daemon to listen on +RESID_PREF_DAEMON_AUTOSTART_LABEL=Start RSE communications daemon on Workbench startup +RESID_PREF_DAEMON_AUTOSTART_TOOLTIP=Select the checkbox to start daemon on startup + +RESID_PREF_IP_ADDRESS_LABEL= Workstation network address +RESID_PREF_IP_AUTO_LABEL= Automatically detect IP address of workstation +RESID_PREF_IP_AUTO_TOOLTIP= Allow automatic detection of the IP address of your workstation. This setting should work in most cases +RESID_PREF_IP_MANUAL_LABEL= Specify IP address or host name of workstation +RESID_PREF_IP_MANUAL_TOOLTIP= Specify the IP address or host name of your workstation +RESID_PREF_IP_MANUAL_ENTER_LABEL= IP address or host name: +RESID_PREF_IP_MANUAL_ENTER_TOOLTIP= Enter the IP address or host name of your workstation + +############################################################## +# 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_PROMPT_TOOLTIP=Enter unique new resource 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_VERBAGE=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_VERBAGE=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_TIP=Confirm delete request + +RESID_DELETE_RESOURCEPROMPT_LABEL=Selected resource(s) type: +RESID_DELETE_RESOURCEPROMPT_TOOLTIP=Type of object(s) being deleted +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 +RESID_DELETE_WARNINGLOCAL_LABEL=WARNING! Local objects are permanently deleted! +RESID_DELETE_WARNINGLOCAL_TOOLTIP=You are confirming permanent deletion of the selected resource(s) from the local 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 +RESID_COPY_TARGET_FILTER_PROMPT=Select the filter 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 +RESID_MOVE_TARGET_FILTER_PROMPT=Select the filter to move into + +#============================================================= +# GENERIC COPY/MOVE NAME-COLLISION DIALOG... +#============================================================= +RESID_COLLISION_RENAME_TITLE=Duplicate Name Collision +RESID_COLLISION_RENAME_VERBAGE=A resource named "&1" already exists. +RESID_COLLISION_RENAME_LABEL=Rename to +RESID_COLLISION_RENAME_TOOLTIP=Enter unique new resource name + + +#============================================================= +# USERID PER SYSTEMTYPE DIALOG... +#============================================================= +RESID_USERID_PER_SYSTEMTYPE_TITLE=Default User ID Preference +RESID_USERID_PER_SYSTEMTYPE_SYSTEMTYPE_LABEL=System type: +RESID_USERID_PER_SYSTEMTYPE_SYSTEMTYPE_TOOLTIP=The system type to set the default user ID for +RESID_USERID_PER_SYSTEMTYPE_LABEL=User ID +RESID_USERID_PER_SYSTEMTYPE_TOOLTIP=Enter default user ID to use for all connections of this system type + + +#============================================================= +# SELECT CONNECTION DIALOG... +#============================================================= +RESID_SELECTCONNECTION_TITLE=Select Connection +RESID_SELECTCONNECTION_VERBAGE=Select a connection + +#============================================================= +# NEW PROFILE WIZARD... +#============================================================= +RESID_NEWPROFILE_TITLE=New +RESID_NEWPROFILE_PAGE1_TITLE=Remote System Profile +RESID_NEWPROFILE_PAGE1_DESCRIPTION=Define profile to hold connections +RESID_NEWPROFILE_VERBAGE=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_TOOLTIP=Expand to create a new connection to a remote system +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 +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 + +#============================================================= +# 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_VERBAGE1=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_VERBAGE2=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_RENAMEDEFAULTPROFILE_PAGE1_TITLE=Name personal profile +RESID_RENAMEDEFAULTPROFILE_PAGE1_DESCRIPTION=Uniquely name user profile +RESID_PROFILE_PROFILENAME_LABEL=Profile +RESID_PROFILE_PROFILENAME_TIP=New name for the profile +RESID_PROFILE_PROFILENAME_VERBAGE=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_CHGCONN_TITLE=Change Connection + +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_LABEL=System type +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_HOSTNAME_READONLY_LABEL=Host name +RESID_CONNECTION_HOSTNAME_READONLY_TIP=Hostname or IP address of system this connects to + +RESID_CONNECTION_USERID_LABEL=User ID +RESID_CONNECTION_USERID_TIP=User ID to use when connecting + +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 Systems Explorer servers + +RESID_CONNECTION_DEFAULTPORT_LABEL=Default port +RESID_CONNECTION_DEFAULTPORT_TIP=Default port for subsystems + +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_TEXT=RemoteSystemsConnections project +RESID_SYSTEMREGISTRY_CONNECTIONS=Connections + +#============================================================= +# SUBSYSTEM PROPERTY PAGE DIALOG... +#============================================================= +RESID_SUBSYSTEM_TITLE=Properties for Subsystem +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_PORT_INHERITBUTTON_INHERIT_TIP=Click to explicitly set the port number +RESID_SUBSYSTEM_PORT_INHERITBUTTON_LOCAL_TIP=Click to use first available port +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 +RESID_SUBSYSTEM_USERID_INHERITBUTTON_INHERIT_TIP=Click to explicitly set the user ID for this subsystem +RESID_SUBSYSTEM_USERID_INHERITBUTTON_LOCAL_TIP=Click to inherit the user ID from the connection + +# 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 + +# Single signon (Kerberos) Properties Page + +# Environment Properties Page +RESID_SUBSYSTEM_ENVVAR_TITLE= Environment Variables +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_MEANS_LABEL=Launcher +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_TITLE=Properties for Filter Pool +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_TITLE=Properties for Filter Pool Reference +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_TITLE_LABEL=Properties for Filter +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_TITLE=Properties for Filter String +RESID_PP_FILTERSTRING_TYPE_VALUE=Filter string + +#============================================================= +# FILTERSTRING PROPERTIES PAGE... +#============================================================= +RESID_PP_FILTERSTRING_TITLE=Properties for Filter String + +RESID_PP_FILTERSTRING_TYPE_VALUE==Filter string + +RESID_PP_FILTERSTRING_STRING_LABEL=String +RESID_PP_FILTERSTRING_STRING_TOOLTIP=The actual 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_TITLE=Properties for SubSystem Factory +RESID_PP_SUBSYSFACTORY_VERBAGE=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 +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_VERBAGE=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_VERBAGE=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_VERBAGE=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_VERBAGE_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_VERBAGE=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 the Change action from its pop-up menu. +RESID_NEWFILTER_PAGE3_POOLS_VERBAGE=Tip: Too many filters? Turn on "Show filter pools in Remote Systems view." Select Preferences from the Window pulldown, then Remote Systems. + +RESID_FILTERALIAS_LABEL=Filter name: +RESID_FILTERALIAS_TIP=Enter filter name unique for this filter pool +RESID_FILTERPARENTPOOL_LABEL=Parent filter pool: +RESID_FILTERPARENTPOOL_TIP=Filter pool in which this filter will be created +RESID_FILTERSTRINGS_LABEL=Filter Strings +RESID_FILTERSTRINGS_TIP=Strings to filter by. Use the pop-up menu for additional actions +RESID_NEWFILTER_POOLTIP=Tip: too many filters? Turn on "Show filter pools in Remote Systems view." Select Preferences from the Windows 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_LIST_NEWITEM=New filter string +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 +RESID_CHGFILTER_BUTTON_CREATE_LABEL=Create +RESID_CHGFILTER_BUTTON_CREATE_TOOLTIP=Press to create a new filter string in this filter + +#============================================================= +# CREATE UNNAMED FILTER DIALOG... +#============================================================= +RESID_CRTFILTER_TITLE=Create Filter + +#============================================================= +# RENAME FILTER DIALOG... +#============================================================= +RESID_RENAME_FILTER_TITLE=Rename Filter +RESID_RENAME_FILTER_PROMPT=Enter the new filter name +#============================================================= +# COPY FILTER DIALOG... +#============================================================= +RESID_COPY_FILTER_TITLE=Copy Filter +RESID_COPY_FILTER_PROMPT=Select system to copy to +#============================================================= +# NEW FILTER STRING ACTION AND WIZARD... +#============================================================= +RESID_NEWFILTERSTRING_TITLE=New System Filter +RESID_NEWFILTERSTRING_ADD_TITLE=Add... +RESID_NEWFILTERSTRING_PAGE1_TITLE=System Filter String +RESID_NEWFILTERSTRING_PAGE1_DESCRIPTION=Create a new filter string + +RESID_NEWFILTERSTRING_PREFIX_LABEL=Add... +RESID_NEWFILTERSTRING_PREFIX_TOOLTIP=Add a new filter string + +RESID_NEWFILTERSTRING_PREFIX_PROMPT=Enter a filter string + +RESID_FILTERSTRING_STRING_LABEL=Filter string: +RESID_FILTERSTRING_STRING_TIP=Enter a filter string + +#============================================================= +# CHANGE FILTER STRING ACTION AND DIALOG... +#============================================================= +RESID_CHGFILTERSTRING_PREFIX_LABEL=Change... +RESID_CHGFILTERSTRING_PREFIX_TOOLTIP=Change selected filter string +RESID_CHGFILTERSTRING_TITLE=Change Filter String +RESID_CHGFILTERSTRING_PREFIX_PROMPT=Edit the 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 +RESID_TESTFILTERSTRING_TREE_TIP=Results of resolving the filter string + + +#============================================================= +# SELECT REMOTE OBJECT DIALOG... +#============================================================= +# unused +#RESID_SELECTREMOTEOBJECT_PREFIX_QUICKFILTERSTRINGS_LABEL=Quick filter string: +#RESID_SELECTREMOTEOBJECT_PREFIX_QUICKFILTERSTRINGS_TOOLTIP=Enter simple or generic name to change contents of tree view +#RESID_SELECTREMOTEOBJECT_PREFIX_GETLISTBUTTON_LABEL=Get list +#RESID_SELECTREMOTEOBJECT_PREFIX_GETLISTBUTTON_TOOLTIP=Resolves entered filter string and populates tree +#RESID_SELECTREMOTEOBJECT_EXISTINGFILTERSTRINGS=Existing filter strings + +#============================================================= +# PROMPT FOR PASSWORD DIALOG... +#============================================================= +RESID_PASSWORD_TITLE=Enter Password +RESID_PASSWORD_LABEL=Password +RESID_PASSWORD_TIP=Enter password for connecting +RESID_PASSWORD_USERID_LABEL=User ID +RESID_PASSWORD_USERID_TIP=Enter user ID. It will be remembered +#NOTE TO TRANSLATER: FOLLOWING LABEL MUST HAVE 2 SPACES IN FRONT OF IT +# yantzi: artemis 6.0, chagned to save user ID to be consistent with password prompt +RESID_PASSWORD_USERID_ISPERMANENT_LABEL= Save user ID +RESID_PASSWORD_USERID_ISPERMANENT_TIP=Select to make user ID change permanent +RESID_PASSWORD_SAVE_LABEL= Save password +RESID_PASSWORD_SAVE_TOOLTIP= Save the password for the specified hostname and user ID + +#============================================================= +# 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_VERBAGE=Remove or re-order history for this GUI control +RESID_WORKWITHHISTORY_PROMPT=History +RESID_WORKWITHHISTORY_BUTTON_LABEL=... +RESID_WORKWITHHISTORY_BUTTON_TIP=Bring up the Work With History dialog + +#============================================================= +# Team View +#============================================================= +RESID_TEAMVIEW_SUBSYSFACTORY_VALUE=SubSystem factory +RESID_TEAMVIEW_USERACTION_VALUE=User action +RESID_TEAMVIEW_CATEGORY_VALUE=Category + + +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_USERACTIONS_LABEL=User actions +RESID_TEAMVIEW_CATEGORY_USERACTIONS_TOOLTIP=Lists all user actions defined in this profile, per subsystem type that contains them. + +RESID_TEAMVIEW_CATEGORY_COMPILECMDS_LABEL=Compile commands +RESID_TEAMVIEW_CATEGORY_COMPILECMDS_TOOLTIP=Lists all compile commands defined in this profile, per subsystem type that contains them. + +RESID_TEAMVIEW_CATEGORY_TARGETS_LABEL=Targets +RESID_TEAMVIEW_CATEGORY_TARGETS_TOOLTIP=Lists all targets defined in this profile, per subsystem type that contains them. Targets are used in remote-enabled projects. + + +#============================================================= +# 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_LABEL=Expand +ACTION_CASCADING_EXPAND_TOOLTIP=Expand children with or without subsetting criteria +ACTION_CASCADING_EXPAND_TO_LABEL=Expand To +ACTION_CASCADING_EXPAND_TO_TOOLTIP=Expand children with subsetting criteria +ACTION_CASCADING_EXPAND_ALL_LABEL=All +ACTION_CASCADING_EXPAND_ALL_TOOLTIP=Expand to show all children +ACTION_CASCADING_EXPAND_BY_LABEL=By New Expansion Filter... +ACTION_CASCADING_EXPAND_BY_TOOLTIP=Specify subsetting criteria for children +ACTION_CASCADING_EXPAND_WORKWITH_LABEL=History... +ACTION_CASCADING_EXPAND_WORKWITH_TOOLTIP=Work with history of expansion filters + +ACTION_CASCADING_VIEW_LABEL=View +ACTION_CASCADING_VIEW_TOOLTIP=Set viewing options + +ACTION_CASCADING_USERID_LABEL=Default User ID +ACTION_CASCADING_USERID_TOOLTIP=Set default user ID per remote system type + +ACTION_CASCADING_PREFERENCES_LABEL=Preferences +ACTION_CASCADING_PREFERENCES_TOOLTIP=Go to the appropriate preferences page + +ACTION_CASCADING_TEAM_LABEL=Team +ACTION_CASCADING_TEAM_TOOLTIP=Team repository related actions +ACTION_TEAM_SYNC_LABEL=Synchronize with Stream +ACTION_TEAM_SYNC_TOOLTIP=Send and receive changes to and from team repository + +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_ACTIVATE_LABEL=Active +ACTION_PROFILE_ACTIVATE_TOOLTIP=Toggle profile between active and not active + +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_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_UPDATECONN_LABEL=Change +ACTION_UPDATECONN_TOOLTIP=Change information + +ACTION_NEWFILTERSTRING_LABEL=Filter String... +ACTION_NEWFILTERSTRING_TOOLTIP=Create new filter string for this filter + +ACTION_ADDFILTERSTRING_LABEL=Add... +ACTION_ADDFILTERSTRING_TOOLTIP=Create new filter string + +ACTION_UPDATEFILTER_LABEL=Change... +ACTION_UPDATEFILTER_TOOLTIP=Change this filter's name or contents + +ACTION_UPDATEFILTERSTRING_LABEL=Change +ACTION_UPDATEFILTERSTRING_TOOLTIP=Change this filter string + +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_NEWNESTEDFILTER_LABEL=Nested Filter... +ACTION_NEWNESTEDFILTER_TOOLTIP=Create new filter inside this filter + +ACTION_UPDATEFILTER_LABEL=Change... +ACTION_UPDATEFILTER_TOOLTIP=Work with the filter strings in this filter + +ACTION_NEWFILTERPOOL_LABEL=Filter Pool... +ACTION_NEWFILTERPOOL_TOOLTIP=Create new pool to hold filters + +ACTION_ADDFILTERPOOLREF_LABEL=Add Filter Pool Reference +ACTION_ADDFILTERPOOLREF_TOOLTIP=Add a reference to another existing filter pool + +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_SIMPLERENAME_LABEL=Rename... +ACTION_SIMPLERENAME_TOOLTIP=Rename selected resources + +ACTION_IMPORT_TO_PROJECT_LABEL= Import To Project... +ACTION_IMPORT_TO_PROJECT_TOOLTIP= Import contents of selected folder to a project + +ACTION_EXPORT_FROM_PROJECT_LABEL= Export From Project... +ACTION_EXPORT_FROM_PROJECT_TOOLTIP= Export contents of project to the selected folder + +ACTION_REFRESH_ALL_LABEL=Refresh All +ACTION_REFRESH_ALL_TOOLTIP=Refresh all resource information + +ACTION_REFRESH_LABEL=Refresh +ACTION_REFRESH_TOOLTIP=Refresh information of selected resource + + +ACTION_DELETE_LABEL=Delete... +ACTION_DELETE_TOOLTIP=Prompts for confirmation to delete selected resources + +ACTION_RENAME_LABEL=Rename... +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_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_TEAM_BROWSEHISTORY_LABEL=Show in Resource History +ACTION_TEAM_BROWSEHISTORY_TOOLTIP=Display the version history of this resource + +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_ERROR_LIST_LABEL=Show Subsequent Problems in Error List +ACTION_ERROR_LIST_TOOLTIP=Display all errors, warnings and informational messages that appear from here on in this shell in the Remote Error List view. + +ACTION_FIND_FILES_LABEL=Find Files... +ACTION_FIND_FILES_TOOLTIP=Search for files under the selected resource + +ACTION_SEARCH_LABEL=Search... +ACTION_SEARCH_TOOLTIP=Opens a dialog to search for text and files + +ACTION_CANCEL_FIND_FILES_LABEL=Cancel Find Files +ACTION_CANCEL_FIND_FILES_TOOLTIP=Terminate find files operation + +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_CASCADE_LABEL=Open Explorer +ACTION_OPENEXPLORER_CASCADE_TOOLTIP=Explore this resource in its own view + +ACTION_OPENEXPLORER_SAMEPERSP_LABEL=In Same Perspective +ACTION_OPENEXPLORER_SAMEPERSP_TOOLTIP=Open a new Remote Systems view rooted at this resource + +ACTION_OPENEXPLORER_DIFFPERSP_LABEL=In New Perspective +ACTION_OPENEXPLORER_DIFFPERSP_TOOLTIP=Open a new Remote System Explorer perspective rooted at this resource + +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_REMOTE_PROPERTIES_LABEL=Properties +ACTION_REMOTE_PROPERTIES_TOOLTIP=Shows remote object properties + +ACTION_VIEWFORM_REFRESH_LABEL=Refresh +ACTION_VIEWFORM_REFRESH_TOOLTIP=Refresh all resource information from disk + +ACTION_VIEWFORM_GETLIST_LABEL=Get List +ACTION_VIEWFORM_GETLIST_TOOLTIP=Retrieve list and populate tree view + + +ACTION_COMMANDSVIEW_SAVEASFILTER_LABEL=Save as Command Set +ACTION_COMMANDSVIEW_SAVEASFILTER_TOOLTIP=Save the command as a new Command Set + + +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_BY_LABEL=Expand By +ACTION_EXPAND_BY_TOOLTIP=Expand with subsetting + +ACTION_EXPAND_ALL_LABEL=All +ACTION_EXPAND_ALL_TOOLTIP=Show all contents + +ACTION_EXPAND_OTHER_LABEL=All +ACTION_EXPAND_OTHER_TOOLTIP=Specify subset criteria for expansion + +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 + +ACTION_DAEMON_START_LABEL=Start Communications Daemon +ACTION_DAEMON_START_TOOLTIP=Start the RSE communications daemon +ACTION_DAEMON_STOP_LABEL=Stop Communications Daemon +ACTION_DAEMON_STOP_TOOLTIP=Stop the RSE communications daemon + +ACTION_SELECTCONNECTION_LABEL=Select Connection +ACTION_SELECTCONNECTION_TOOLTIP=Bring up a dialog for selecting a connection + +RESID_USERID_PER_SYSTEMTYPE_LABEL=Default User ID +RESID_USERID_PER_SYSTEMTYPE_TOOLTIP=Set default user ID per remote system type + +#============================================================= +# Common actions OR menuitems. All actions support: +# .label for button/menu-item text +# .tooltip for hover help on pushbuttons +#============================================================= +RESID_CHANGE_PREFIX_LABEL=Change +RESID_CHANGE_PREFIX_TOOLTIP=Change selected item + +RESID_CHANGEVIAENTRY_PREFIX_LABEL=Change +RESID_CHANGEVIAENTRY_PREFIX_TOOLTIP=Replace selected list item with entry field contents + +RESID_ADDVIAENTRY_PREFIX_LABEL=Add +RESID_ADDVIAENTRY_PREFIX_TOOLTIP=Add entry field contents to list + +RESID_COPYFROM_PREFIX_LABEL=Copy From... +RESID_COPYFROM_PREFIX_TOOLTIP=Copy items here from another source + +RESID_COPYTO_PREFIX_LABEL=Copy To... +RESID_COPYTO_PREFIX_TOOLTIP=Copy selected items + +RESID_DUPLICATE_PREFIX_LABEL=Duplicate +RESID_DUPLICATE_PREFIX_TOOLTIP=Create copy of selected item + + +############################################################## +# Content Assist action +############################################################## +ACTION_CONTENT_ASSIST=Content Assist@Ctrl+SPACE +ACTION_SHOW_TOOLTIP_INFORMATION=Show Tooltip Description@F2 + +############################################################## +# COMMON POPUP MENU ITEMS. MNEMONICS WILL BE ASSIGNED AUTOMATICALLY, DON'T SET THEM HERE. +# THESE ARE MENU-ONLY ITEMS, VS MENU OR BUTTON ACTIONS. +# THEY GENERALLY ARE USED IN THE SYSTEM TREE VIEW SOMEWHERE. +############################################################## + + + + +############################################################## +# ERROR MESSAGES +############################################################## + +RESID_MSG_UNABLETOLOAD=Unable to load message &1 + + +############################################################## +# REMOTE FILE SYSTEM TRANSLATABLE STRINGS +############################################################## +#============================================================= +# DEFAULT FILTERS... +#============================================================= +#============================================================= +# NEW FILE FILTER WIZARD... +#============================================================= + +#============================================================= +# NEW FILE FILTER STRING WIZARD... +#============================================================= + + +#============================================================= +# CHANGE FILE FILTER DIALOG... +#============================================================= + +#============================================================= +# CHANGE FILE FILTER STRING DIALOG... +#============================================================= + +#============================================================= +# SELECT DIRECTORY DIALOG... +#============================================================= + + +#============================================================= +# SELECT FILE DIALOG... +#============================================================= + + +#============================================================= +# SELECT FILE OR MEMBER DIALOG... +#============================================================= + + +#============================================================= +# PROMPT FOR HOME FOLDER DIALOG... +#============================================================= + + +#============================================================= +# FILE SUBSYSTEM ACTIONS... +#============================================================= + + + + + + + + +#============================================================= +# REMOTE FILE SYSTEM PROPERTY VALUES +#============================================================= + +#============================================================= +# REMOTE FILE PROPERTIES PAGE... +#============================================================= + +#============================================================= +# RE-USABLE COMPOSITE FILE SYSTEM WIDGETS +#============================================================= +#============================================================= +# REMOTE FILE SYSTEM EXCEPTION ERROR MESSAGES +#============================================================= + +#============================================================= +# REMOTE FILE SYSTEM ERROR MESSAGES +#============================================================= + +# Remote editing progress monitor messages + +# Remote edit functionality + +# iSeries Editor Save As... Dialog + +# CODE editor + +# Default Filter Pool names +RESID_DEFAULT_FILTERPOOL=%1 Filter Pool +RESID_PERCONNECTION_FILTERPOOL=%1 Filter Pool for connection %2 + +# Default Team profile name + +#============================================================== +# Signon Information Preferences Page +#============================================================== +RESID_PREF_SIGNON_DESCRIPTION= The following user IDs have password information associated with them: + +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_VIEW_DEFAULT_TITLE= Remote Search +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 + +################################################################################### +############################ Table View Dlgs ############################ +################################################################################### +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. + + + +################################################################################### +############################ 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 +RESID_OFFLINE_WORKOFFLINE_DESCRIPTION= 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= + * The first label is set to not grab excess horizontal space, while the second one is, since + * its contents are variable. + *

+ * To help with initial sizing, the widthHint of the second is set to 100. + *

+ * 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); + ((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 verbage 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 verbage text to display + * @param span Horizontal span + * @param border true if you want a border around the verbage + * @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 createVerbage(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 verbage (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. + *

+ * 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 verbage + * @param widthHint number of pixels to limit width to before wrapping. 200 is a reasonable number + * @return Label created. + */ + public static Label createLabeledVerbage(Composite parent, String labelText, String tooltip, int span, boolean border, int widthHint) { + previousLabel = createLabel(parent, appendColon(labelText)); + Label verbage = createVerbage(parent, labelText, span, border, widthHint); + setToolTipText(previousLabel, tooltip); + setToolTipText(verbage, tooltip); + return verbage; + } + + /** + * 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 GridLayout composite to put the field into. + * @param 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. + *

+ * 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 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. + *

+ * 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 GridLayout composite to put the field into. + * @param 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 bundle ResourceBundle of tooltip text + * @param id bundle key for 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. + *

+ * 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. + *

+ * 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. + *

+ * Assign the listener to the passed in implementer of Listener. + *

+ * A historical combobox is one that persists its contents between sessions. The management + * of that persistence is handled for you!. + *

+ * @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. + *

+ * Assign the listener to the passed in implementer of Listener. + *

+ * 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. + *

+ * @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 OR specify factory OR specify factoryCategory + * OR 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 OR specify systemTypes OR specify factoryCategory + * OR 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 OR specify factory OR specify systemTypes OR 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 OR specify factory OR specify factory Id OR 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, String[] 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.addSelectionListener(listener); + boolean 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; + combo.setLayoutData(data); + } else { + ((GridData) combo.getLayoutData()).horizontalSpan = horizontalSpan; + ((GridData) combo.getLayoutData()).horizontalAlignment = GridData.FILL; + ((GridData) combo.getLayoutData()).grabExcessHorizontalSpace = true; + ((GridData) combo.getLayoutData()).widthHint = minwidth; + } + return combo; + } + + /** + * Creates a readonly system type combination box. + * Does NOT create the leading prompt or anything except the combo. + */ + public static Combo createSystemTypeCombo(Composite parent, Listener listener) { + return createSystemTypeCombo(parent, listener, null); + } + + /** + * Creates a readonly system type combination box with the given system types. + * Does NOT create the leading prompt or anything except the combo. + */ + public static Combo createSystemTypeCombo(Composite parent, Listener listener, String[] systemTypes) { + Combo combo = createReadonlyCombo(parent, listener, SystemResources.RESID_CONNECTION_SYSTEMTYPE_TIP); + String[] typeItems = ((systemTypes == null) ? SystemPlugin.getDefault().getSystemTypeNames(true) : // true ==> include "local" + systemTypes); + combo.setItems(typeItems); + combo.select(0); + return combo; + } + + /** + * Creates a hostname combination box. It if prefilled with all previously specified hostnames + * for the given system type. + *

+ * Does NOT create the leading prompt or anything except the combo. + */ + public static Combo createHostNameCombo(Composite parent, Listener listener, String 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(SystemPlugin.getTheSystemRegistry().getHostNames(systemType)); + combo.select(0); + return combo; + } + + + + + + /** + * Create an entry field controlled by an inherit/override switch button + *

+ * 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 tooltip text for the toggle. Can be null + * @param tooltip 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 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). + *

+ * 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); + } + + /** + * 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 static char STANDARD_COLON = ':'; + private 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 + * @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"); + 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) { + 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/DisplayDialogAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/DisplayDialogAction.java new file mode 100644 index 00000000000..6aecd17dd74 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/DisplayDialogAction.java @@ -0,0 +1,60 @@ +/******************************************************************************** + * 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.dialogs.Dialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +/** + * DisplayDialogAction can be used to display a JFace Dialog when + * not running on the UI thread and no shell is availble. For example: + * + * Display.getDefault().syncExec(new DisplayDialogAction(myDialog)); + * + */ +public class DisplayDialogAction implements Runnable { + + + private Dialog _dialog; + + /** + * Constructor for DisplayDialogAction. + * + * @param dialog The dialog to be displayed. + */ + public DisplayDialogAction(Dialog dialog) { + _dialog = dialog; + } + + /** + * @see java.lang.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()) + { + _dialog.open(); + finished = true; + } + } + } + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..b777be31142 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/DisplaySystemMessageAction.java @@ -0,0 +1,64 @@ +/******************************************************************************** + * 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 { + + + private SystemMessage message; + private 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 new file mode 100644 index 00000000000..3ca7006fce0 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemAction.java @@ -0,0 +1,111 @@ +/******************************************************************************** + * 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 systems 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 systems 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 new file mode 100644 index 00000000000..e13e98b3233 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemCopyTargetSelectionCallback.java @@ -0,0 +1,33 @@ +/******************************************************************************** + * 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 new file mode 100644 index 00000000000..72f18109ac3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemDialogAction.java @@ -0,0 +1,57 @@ +/******************************************************************************** + * 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 systems 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/ISystemDynamicPopupMenuExtension.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemDynamicPopupMenuExtension.java new file mode 100644 index 00000000000..fb197d33fdc --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemDynamicPopupMenuExtension.java @@ -0,0 +1,44 @@ +/******************************************************************************** + * 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.actions; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.widgets.Shell; + +/** + * Required interface for use in making contributions view the + * adapter menu extension extension point (org.eclipse.rse.core.dynamicPopupMenuActions). + */ +public interface ISystemDynamicPopupMenuExtension +{ + /** + * Returns true if this menu extension supports the specified selection. + * @param selection the resources to contriubte menu items to + * @return true if the extension will be used for menu population + */ + public boolean supportsSelection(IStructuredSelection selection); + + /** + * Populates the menu with specialized actions. + * @param shell the shell + * @param menu the menu to contribute actions to + * @param menuGroup the defect menu group to add actions to + * @param selection the resources to contriubte menu items to + * + */ + public void populateMenu(Shell shell, IMenuManager menu, IStructuredSelection selection, String menuGroup); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemDynamicPopupMenuExtensionManager.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemDynamicPopupMenuExtensionManager.java new file mode 100644 index 00000000000..4b7c976d85f --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemDynamicPopupMenuExtensionManager.java @@ -0,0 +1,23 @@ +/******************************************************************************** + * 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.actions; +/** + * @author dmcknigh + */ +public interface ISystemDynamicPopupMenuExtensionManager { + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..815353eaddc --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemWizardAction.java @@ -0,0 +1,25 @@ +/******************************************************************************** + * 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 systems 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/SystemAbstractPopupMenuExtensionAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemAbstractPopupMenuExtensionAction.java new file mode 100644 index 00000000000..53878e750ff --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemAbstractPopupMenuExtensionAction.java @@ -0,0 +1,393 @@ +/******************************************************************************** + * 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 java.util.Iterator; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IActionDelegate; +import org.eclipse.ui.IObjectActionDelegate; +import org.eclipse.ui.IWorkbenchPart; + + +/** + * This is a base class to simplify the creation of actions supplied via the + * org.eclipse.rse.core.popupMenus extension point. + *

+ * The only method you must implement is {@link #run()}. + * You may optionally override {@link #getEnabled(Object[])} + *

+ * Convenience methods are: + *

    + *
  • {@link #getShell()} + *
  • {@link #getProxyAction()} + *
  • {@link #getSelection()} + *
  • {@link #getSelectionCount()} + *
  • {@link #getSelectedRemoteObjects()} + *
  • {@link #getFirstSelectedRemoteObject()} + *
  • {@link #getRemoteAdapter(Object)} + * + *
  • {@link #getSubSystem()} + *
  • {@link #getSubSystemFactory()} + *
  • {@link #getSystemConnection()} + * + *
  • {@link #getRemoteObjectName(Object obj, ISystemRemoteElementAdapter adapter)} + *
  • {@link #getRemoteObjectSubSystemFactoryId(Object obj, ISystemRemoteElementAdapter adapter)} + *
  • {@link #getRemoteObjectTypeCategory(Object obj, ISystemRemoteElementAdapter adapter)} + *
  • {@link #getRemoteObjectType(Object obj, ISystemRemoteElementAdapter adapter)} + *
  • {@link #getRemoteObjectSubType(Object obj, ISystemRemoteElementAdapter adapter)} + *
  • {@link #getRemoteObjectSubSubType(Object obj, ISystemRemoteElementAdapter adapter)} + *
+ * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter + * @see org.eclipse.rse.ui.dialogs.SystemPromptDialog + */ +public abstract class SystemAbstractPopupMenuExtensionAction implements IObjectActionDelegate +{ + protected IWorkbenchPart viewPart = null; + protected IStructuredSelection sel = null; + protected IAction proxyAction; + protected Shell shell; + protected static final Object[] EMPTY_ARRAY = new Object[0]; + + /** + * Constructor + */ + public SystemAbstractPopupMenuExtensionAction() + { + super(); + } + + // ------------------------ + // OVERRIDABLE METHODS... + // ------------------------ + + /** + * The user has selected this action. This is where the actual code for the action goes. + */ + public abstract void run(); + + /** + * The user has selected one or more objects. This is an opportunity to enable/disable + * this action based on the current selection. By default, it is always enabled. Return + * false to disable it. + */ + public boolean getEnabled(Object[] currentlySelected) + { + return true; + } + + // --------------------------------- + // IOBJECTACTIONDELEGATE METHODS... + // --------------------------------- + + /** + * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart) + */ + public void setActivePart(IAction action, IWorkbenchPart part) + { + this.viewPart = part; + this.proxyAction = action; + this.shell = part.getSite().getShell(); + } + /** + * Get the current view part. + * Handy for things like getting the shell. + */ + public IWorkbenchPart getActivePart() + { + return viewPart; + } + + /** + * The Eclipse-supplied proxy action has been selected to run. + * This is the foreward to us, the actual action. This method's default + * implementation is to simply call {@link #run()}. + * + * @see IActionDelegate#run(IAction) + */ + public void run(IAction action) + { + run(); + } + + /** + * Called by Eclipse when the user selects something. Our opportunity + * to enable or disable this menu item. The default implementation of this + * method calls getEnabled to determine if the proxy action should be enabled + * or not, then calls setEnabled on that proxy action with the result. + * + * @see IActionDelegate#selectionChanged(IAction, ISelection) + */ + public void selectionChanged(IAction action, ISelection sel) + { + if (!action.isEnabled()) + return; // defect 43471: we were overriding the enableFor attribute enablement + if (sel instanceof IStructuredSelection) + { + this.sel = (IStructuredSelection)sel; + action.setEnabled(getEnabled(getSelectedRemoteObjects())); + } + else + { + this.sel = null; + action.setEnabled(false); + } + } + + // --------------------------------------------- + // CONVENIENCE METHODS FOR SUBCLASSES TO USE... + // --------------------------------------------- + /** + * For toggle actions (attribute state specified in action tag), set the toggle state + */ + public void setChecked(boolean checked) + { + proxyAction.setChecked(checked); + } + + /** + * Change the enabled state of the action + */ + public void setEnabled(boolean enabled) + { + proxyAction.setEnabled(enabled); + } + + /** + * Return the proxy action for this action delegate + */ + public IAction getProxyAction() + { + return proxyAction; + } + + /** + * Return the shell hosting this action + */ + public Shell getShell() + { + return shell; + } + + /** + * Retrieve the current selected objects as a structured selection + */ + public IStructuredSelection getSelection() + { + return sel; + } + /** + * Retrieve the number of items currently selected + */ + public int getSelectionCount() + { + return ((sel==null)?0:sel.size()); + } + + /** + * Retrieve the currently selected objects as an array of Object objects. + * Array may be length 0, but will never be null, for convenience. + * To do anything interesting with the object, you will also need to retrieve its adapter + * @see #getRemoteAdapter(Object) + */ + public Object[] getSelectedRemoteObjects() + { + Object[] seld = new Object[(sel!=null) ? sel.size() : 0]; + if (sel == null) + return seld; + Iterator i = sel.iterator(); + int idx=0; + while (i.hasNext()) + seld[idx++] = i.next(); + return seld; + } + /** + * Retrieve the first selected object, for convenience. + * Will be null if there is nothing selected + * To do anything interesting with the object, you will also need to retrieve its adapter + * @see #getRemoteAdapter(Object) + */ + public Object getFirstSelectedRemoteObject() + { + if (sel == null) + return null; + return sel.getFirstElement(); + } + /** + * Retrieve the adapters of the currently selected objects as an array of ISystemRemoteElementAdapter objects. + * Array may be length 0, but will never be null, for convenience. + */ + public ISystemRemoteElementAdapter[] getSelectedRemoteObjectAdapters() + { + ISystemRemoteElementAdapter[] seld = new ISystemRemoteElementAdapter[(sel!=null) ? sel.size() : 0]; + if (sel == null) + return seld; + Iterator i = sel.iterator(); + int idx=0; + while (i.hasNext()) + seld[idx++] = getRemoteAdapter(i.next()); + return seld; + } + /** + * Retrieve the adapter of the first selected object as an ISystemRemoteElementAdapter object, for convenience. + * Will be null if there is nothing selected + */ + public ISystemRemoteElementAdapter getFirstSelectedRemoteObjectAdapter() + { + if (sel == null) + return null; + return getRemoteAdapter(sel.getFirstElement()); + } + + /** + * Returns the implementation of ISystemRemoteElementAdapter for the given + * object. Returns null if this object does not adaptable to this. + */ + public ISystemRemoteElementAdapter getRemoteAdapter(Object o) + { + if (!(o instanceof IAdaptable)) + return (ISystemRemoteElementAdapter)Platform.getAdapterManager().getAdapter(o,ISystemRemoteElementAdapter.class); + return (ISystemRemoteElementAdapter)((IAdaptable)o).getAdapter(ISystemRemoteElementAdapter.class); + } + + /** + * Returns the name of the given remote object, given its remote object adapter. + * Same as adapter.getName(obj); + */ + public String getRemoteObjectName(Object obj, ISystemRemoteElementAdapter adapter) + { + return adapter.getName(obj); + } + /** + * Returns the id of the subsystem factory of the given remote object, given its remote object adapter. + * Same as adapter.getSubSystemFactoryId(obj); + */ + public String getRemoteObjectSubSystemFactoryId(Object obj, ISystemRemoteElementAdapter adapter) + { + return adapter.getSubSystemFactoryId(obj); + } + /** + * Returns the type category of the given remote object, given its remote object adapter. + * Same as adapter.getRemoteTypeCategory(obj); + */ + public String getRemoteObjectTypeCategory(Object obj, ISystemRemoteElementAdapter adapter) + { + return adapter.getRemoteTypeCategory(obj); + } + /** + * Returns the type of the given remote object, given its remote object adapter. + * Same as adapter.getRemoteType(obj); + */ + public String getRemoteObjectType(Object obj, ISystemRemoteElementAdapter adapter) + { + return adapter.getRemoteType(obj); + } + /** + * Returns the subtype of the given remote object, given its remote object adapter. + * Same as adapter.getRemoteSubType(obj); + */ + public String getRemoteObjectSubType(Object obj, ISystemRemoteElementAdapter adapter) + { + return adapter.getRemoteSubType(obj); + } + /** + * Returns the sub-subtype of the given remote object, given its remote object adapter. + * Same as adapter.getRemoteSubSubType(obj); + */ + public String getRemoteObjectSubSubType(Object obj, ISystemRemoteElementAdapter adapter) + { + return adapter.getRemoteSubSubType(obj); + } + /** + * Returns the subsystem from which the selected remote objects were resolved. + */ + public ISubSystem getSubSystem() + { + ISystemRemoteElementAdapter ra = getFirstSelectedRemoteObjectAdapter(); + if (ra != null) + return ra.getSubSystem(getFirstSelectedRemoteObject()); + else + return null; + } + /** + * Returns the subsystem factory which owns the subsystem from which the selected remote objects were resolved + */ + public ISubSystemConfiguration getSubSystemFactory() + { + ISubSystem ss = getSubSystem(); + if (ss != null) + return ss.getSubSystemConfiguration(); + else + return null; + } + + /** + * Return the SystemConnection from which the selected remote objects were resolved + */ + public IHost getSystemConnection() + { + IHost conn = null; + ISystemRemoteElementAdapter ra = getFirstSelectedRemoteObjectAdapter(); + if (ra != null) + { + ISubSystem ss = ra.getSubSystem(getFirstSelectedRemoteObject()); + if (ss != null) + conn = ss.getHost(); + } + return conn; + } + + + + + + /** + * Debug method to print out details of given selected object... + */ + public void printTest() + { + System.out.println("Testing. Number of selected objects = "+getSelectionCount()); + Object obj = getFirstSelectedRemoteObject(); + if (obj == null) + System.out.println("selected obj is null"); + else + { + ISystemRemoteElementAdapter adapter = getRemoteAdapter(obj); + System.out.println(); + System.out.println("REMOTE INFORMATION FOR FIRST SELECTION"); + System.out.println("--------------------------------------"); + System.out.println("Remote object name................: " + getRemoteObjectName(obj,adapter)); + System.out.println("Remote object subsystem factory id: " + getRemoteObjectSubSystemFactoryId(obj,adapter)); + System.out.println("Remote object type category.......: " + getRemoteObjectTypeCategory(obj,adapter)); + System.out.println("Remote object type ...............: " + getRemoteObjectType(obj,adapter)); + System.out.println("Remote object subtype ............: " + getRemoteObjectSubType(obj,adapter)); + System.out.println("Remote object subsubtype .........: " + getRemoteObjectSubSubType(obj,adapter)); + System.out.println(); + } + System.out.println(); + } + +} \ 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 new file mode 100644 index 00000000000..7bc7189f206 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseAction.java @@ -0,0 +1,818 @@ +/******************************************************************************** + * 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 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.SystemAdapterHelpers; +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.model.IHost; +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.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. + *

+ * What this offers beyond the basic Action class: + *

    + *
  • 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. + *
  • 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. + *
  • 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. + *
  • 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()); + *
  • 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. + *
  • 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.
  • + *
+ * There are many constructors but they can be broken down into permutations of the following info: + *
    + *
  • 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. + *
  • Images. There are four flavors of constructors that take an image, and four identical that do not. + *
+ * + *

To use this dialog, subclass it and override the following methods

: + * + *
  • {@link #run()}, where you place the code to do the actual work when this action is invoked. + *
  • {@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. + *
  • {@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. + * + *

    In addition to the methods you must override, you can optionally call various methods to configure + * this action:

    + * + *
  • {@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. + *
  • {@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. + *
  • {@link #setHelp(String)} to set the ID of the F1 context help for this action. + *
  • {@link #setContextMenuGroup(String)} to set the menu group in which to place this action, when used in menus. + *
  • {@link #allowOnMultipleSelection(boolean)} to specify if this action is to be enabled or disabled when multiple + * objects are selected. The default is disabled. + *
  • {@link #setSelectionSensitive(boolean)} to specify if this action's enabled state is not sensitive to what + * is currently selected. + * + *

    Further, the code you write can use the properties captured by this action and retrievable by the getter methods + * supplied by this class.

    + * + * @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 AS_PUSH_BUTTON, AS_CHECK_BOX, + * AS_DROP_DOWN_MENU, AS_RADIO_BUTTON, and AS_UNSPECIFIED. + * @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); + } + } + + /** + * 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 getAdapter(Object o) + { + return SystemAdapterHelpers.getAdapter(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"); + 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); + } + /** + * 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); + } + /** + * 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: + *
      + *
    • Disables the action if the selection is not a structured selection. Should never happen. + *
    • Disables the action if more than one item is selected and allowOnMultipleSelection is false. + *
    • Converts the selection to a structured selection and calls updateSelection. Uses returned + * boolean value to setEnabled() this action. + *
    + */ + public void selectionChanged(SelectionChangedEvent event) + { + ISelection selection = event.getSelection(); + if (traceSelections) + issueTraceMessage("INSIDE SELECTIONCHANGED. Selection null? " + (selection==null)); + 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)); + if ( !(selection instanceof IStructuredSelection) ) + { + if (selectionSensitive) + setEnabled(false); + if (traceSelections) + System.out.println(this.getClass().getName() + ". Returning false in setSelection. selection= " + selection); + return; + } + if (selectionSensitive) + { + // see comment in setShell + //this.previousSelections.add(this.sSelection); + } + sSelection = (IStructuredSelection)selection; + if (!selectionSensitive || (selection == null)) + { + if (traceSelections) + System.out.println(this.getClass().getName() + ". Returning. selectionSensitive = " + selectionSensitive); + 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()); + } + 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. Only call this if your action is displayed in a toolbar + * or non-popup menu, 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); + + + 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. + *

    + * The default implementation of this method: + *

      + *
    • Returns false if calling checkObjectType on any object in the selection list returns false. + *
    • Returns true otherwise. + *
    + * If desired, override this method for a different algorithm to decide enablement. + */ + public boolean updateSelection(IStructuredSelection selection) + { + boolean enable = true; + Iterator e= ((IStructuredSelection) 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"); + } + + /** + * 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=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 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 + copyDlg.setTitle(singleTitle); + } + + return copyDlg; + } + + protected abstract String[] getOldNames(); + protected abstract Object[] getOldObjects(); + /** + * Get the verbage 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. + *

    + * 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() + { + ISystemRegistry sr = SystemPlugin.getTheSystemRegistry(); + IRunnableContext irc = sr.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 + * If you decide to override this, it is your responsibility to issue the error + * message to the user and return false here. + *

    + * @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 + */ + public void copyComplete() {} + + // ---------------------------------- + // 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 + *

  • They need to take the parent Shell object in the constructor or later perhaps via setParent + *
  • They need to be able to set the input value for the dialog. This is typically related to + * what is currently selected. + *
  • They need to be able to get the output value from the dialog. This can be queried by + * calling getValue after the action runs. + * + *

    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. + *

    + *

    To use this dialog, subclass it and override the following methods

    : + * + *
  • {@link #createDialog(Shell)} + *
  • {@link #getDialogValue(Dialog)} + *
  • {@link #run()} but ONLY if you don't want the default implementation of this method. + * + *

    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:

    + * + *
  • {@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. + *
  • {@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. + *
  • {@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. + *
  • {@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. + * + * + */ +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. + *

    + * Use this when the dialog itself will process all selected items at once. + *

    + * 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: + *

      + *
    • calls abstract method createDialog() to get the dialog + * object. Child classes must implement this method. + *
    • 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. + *
    • calls dlg.open(getShell()) on the dialog to display it. + *
    • 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. + *
    + * 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. + *

    + * Please note that if NO ITEMS are selected, we will still call createDialog + * but not call setInput. + *

    + * 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!"); + 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); + } + + int rc = 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. + *

    + * 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(); + *

    + * 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 new file mode 100644 index 00000000000..d5099bff64d --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseDummyAction.java @@ -0,0 +1,31 @@ +/******************************************************************************** + * 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); + 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 new file mode 100644 index 00000000000..cde645c72e5 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseSubMenuAction.java @@ -0,0 +1,475 @@ +/******************************************************************************** + * 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 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.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 + +{ + + protected 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 owning shell. If you pass null now, be sure to call setShell 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 parent The owning shell. If you pass null now, be sure to call setShell 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 parent The owning shell. If you pass null now, be sure to call setShell 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 parent The owning shell. If you pass null now, be sure to call setShell 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 parent The owning shell. If you pass null now, be sure to call setShell 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; + } + + + /** + * Must be overridden + *

    Example of this:

    + *

    
    +	 *  menu.add(new MyAction1());
    +	 * 
    + * @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); + } + 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); + } + //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. "); + } + + 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; idxDefine 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. + *
  • Override {@link #createWizard()} to instantiate, configure and return your wizard. + *
  • 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. + * + */ +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". + *

    + * 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: + *

      + *
    • Calls abstract createWizard() method to get wizard instance + *
    • If wizard implements ISystemWizard, calls setInputValue(...), passing in + * getValue() if not null, else passing in getFirstSelection() if not null. + *
    • Instantiates a WizardDialog object with the wizard object from createWizard(). + * Returns this to run() in our parent class which then opens this dialog. + *
    + * + */ + protected 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); + } + + + 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); + + /* + * Don't do the following here as it is redundant! The run method in the parent SystemBaseDialogAction + * does this already + Object wizardInputValue = null; + if (getValue() != null) + wizardInputValue = getValue(); + else + wizardInputValue = getFirstSelection(); + if (wizardInputValue != null) + ((SystemWizardDialog)dialog).setInputObject(wizardInputValue); + */ + } + 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(); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingBrowseWithAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingBrowseWithAction.java new file mode 100644 index 00000000000..6e2b73e3b3c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingBrowseWithAction.java @@ -0,0 +1,49 @@ +/******************************************************************************** + * 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.IMenuManager; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.SystemResources; + + +/** + * 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; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingCompareWithAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingCompareWithAction.java new file mode 100644 index 00000000000..ebf10a73d45 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingCompareWithAction.java @@ -0,0 +1,49 @@ +/******************************************************************************** + * 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.IMenuManager; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.SystemResources; + + +/** + * 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; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingExpandToAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingExpandToAction.java new file mode 100644 index 00000000000..2bdbba0d45c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingExpandToAction.java @@ -0,0 +1,49 @@ +/******************************************************************************** + * 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.IMenuManager; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.SystemResources; + + +/** + * 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; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingGoToAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingGoToAction.java new file mode 100644 index 00000000000..4e9389ed7c9 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingGoToAction.java @@ -0,0 +1,81 @@ +/******************************************************************************** + * 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.IMenuManager; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.view.SystemViewPart; +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; + setCreateMenuEachTime(false); + setPopulateMenuEachTime(false); + 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; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingGotoActionOLD.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingGotoActionOLD.java new file mode 100644 index 00000000000..b33b914342e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingGotoActionOLD.java @@ -0,0 +1,48 @@ +/******************************************************************************** + * 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.IMenuManager; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.SystemResources; + + +/** + * A cascading menu action for "View->" + */ +public class SystemCascadingGotoActionOLD extends SystemBaseSubMenuAction +{ + + /** + * Constructor + */ + public SystemCascadingGotoActionOLD() + { + super(SystemResources.ACTION_CASCADING_GOTO_LABEL, SystemResources.ACTION_CASCADING_GOTO_TOOLTIP, null); + setMenuID(ISystemContextMenuConstants.MENU_GOTO); + 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; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingNewAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingNewAction.java new file mode 100644 index 00000000000..c11482cb189 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingNewAction.java @@ -0,0 +1,48 @@ +/******************************************************************************** + * 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.IMenuManager; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.SystemResources; + + +/** + * 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; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingOpenWithAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingOpenWithAction.java new file mode 100644 index 00000000000..925c13ea700 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingOpenWithAction.java @@ -0,0 +1,49 @@ +/******************************************************************************** + * 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.IMenuManager; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.SystemResources; + + +/** + * 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; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingPreferencesAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingPreferencesAction.java new file mode 100644 index 00000000000..604b3a11940 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingPreferencesAction.java @@ -0,0 +1,85 @@ +/******************************************************************************** + * 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.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.swt.widgets.Shell; + + + +/** + * A cascading menu action for "Preferences->". + * @see org.eclipse.rse.ui.actions.SystemShowPreferencesPageAction + */ +public class SystemCascadingPreferencesAction + extends SystemBaseSubMenuAction implements IMenuListener +{ + + /** + * Constructor + */ + public SystemCascadingPreferencesAction(Shell shell) + { + super(SystemResources.ACTION_CASCADING_PREFERENCES_LABEL, SystemResources.ACTION_CASCADING_PREFERENCES_TOOLTIP, shell); + setMenuID(ISystemContextMenuConstants.MENU_PREFERENCES); + setCreateMenuEachTime(false); + setPopulateMenuEachTime(false); + setSelectionSensitive(false); + + setHelp(SystemPlugin.HELPPREFIX+"actnpref"); + } + + /** + * @see SystemBaseSubMenuAction#getSubMenu() + */ + public IMenuManager populateSubMenu(IMenuManager ourSubMenu) + { + // WE DON'T WANT TO FIRE UP ALL PLUGINS THAT USE OUR EXTENSION POINT, + // AT THE TIEM WE ARE CREATING OUR VIEW! SO WE DEFER IT UNTIL THIS CASCADING + // MENU IS FIRST EXPANDED... + ourSubMenu.addMenuListener(this); + ourSubMenu.setRemoveAllWhenShown(true); + //menu.setEnabled(true); + ourSubMenu.add(new SystemBaseAction("dummy",null)); + + return ourSubMenu; + } + + /** + * Called when submenu is about to show + */ + public void menuAboutToShow(IMenuManager ourSubMenu) + { + //System.out.println("In menuAboutToShow!"); + setBusyCursor(true); + ourSubMenu.add(new Separator(ISystemContextMenuConstants.GROUP_ADDITIONS)); // user or BP/ISV additions + SystemShowPreferencesPageAction[] prefPageActions = SystemPlugin.getDefault().getShowPreferencePageActions(); + if (prefPageActions!=null) + { + for (int idx=0; idx". 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(SystemPlugin.HELPPREFIX+"actnsrsv"); + } + + /** + * @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)); + 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" + */ +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; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingUserIdPerSystemTypeAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingUserIdPerSystemTypeAction.java new file mode 100644 index 00000000000..1773c4a8525 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingUserIdPerSystemTypeAction.java @@ -0,0 +1,69 @@ +/******************************************************************************** + * 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.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.SystemType; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.swt.widgets.Shell; + + + +/** + * A cascading menu action for "Set Default UserId->" + */ +public class SystemCascadingUserIdPerSystemTypeAction + extends SystemBaseSubMenuAction + implements IMenuListener +{ + + /** + * Constructor + */ + public SystemCascadingUserIdPerSystemTypeAction(Shell shell) + { + super(SystemResources.ACTION_CASCADING_USERID_LABEL, SystemResources.ACTION_CASCADING_USERID_TOOLTIP, shell); + setCreateMenuEachTime(false); + setPopulateMenuEachTime(false); + setSelectionSensitive(false); + + setHelp(SystemPlugin.HELPPREFIX+"actn0010"); + } + + /** + * @see SystemBaseSubMenuAction#getSubMenu() + */ + public IMenuManager populateSubMenu(IMenuManager menu) + { + menu.addMenuListener(this); + menu.setRemoveAllWhenShown(true); + //menu.setEnabled(true); + menu.add(new SystemBaseAction("dummy",null)); + return menu; + } + + /** + * Called when submenu is about to show + */ + public void menuAboutToShow(IMenuManager ourSubMenu) + { + SystemType[] types = SystemPlugin.getTheSystemTypes(SystemPlugin.INCLUDE_LOCAL_NO); // false => do not include local + for (int idx=0; idx" + */ +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; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingWorkWithAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingWorkWithAction.java new file mode 100644 index 00000000000..addbdc66d90 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingWorkWithAction.java @@ -0,0 +1,48 @@ +/******************************************************************************** + * 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.IMenuManager; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.SystemResources; + + +/** + * 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; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemClearAllPasswordsAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemClearAllPasswordsAction.java new file mode 100644 index 00000000000..0bdf764f99f --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemClearAllPasswordsAction.java @@ -0,0 +1,115 @@ +/******************************************************************************** + * 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.actions; + + +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.IConnectorService; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.SystemResourceChangeEvent; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.SystemResources; +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.isPasswordCached(); + + 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.isPasswordCached()) + { + // get the user id + String userId = system.getUserId(); + + // clear userid/password from memory and fire event + //DKM and disk now + system.clearPasswordCache(true); + SystemPlugin.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/ui/actions/SystemClearPasswordAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemClearPasswordAction.java new file mode 100644 index 00000000000..4d7b1d93da0 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemClearPasswordAction.java @@ -0,0 +1,99 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.IConnectorService; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.SystemResourceChangeEvent; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.swt.widgets.Shell; + + + +/** + * This is the action for clearing in-memory userId and password cache + */ +public class SystemClearPasswordAction extends SystemBaseAction + implements ISystemMessages +{ + + /** + * 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(SystemPlugin.HELPPREFIX+"actn0049"); + } + + /** + * 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() || + !(((ISubSystem)obj).getConnectorService().isPasswordCached())) { + return false; + } + else { + return true; + } + } + + /** + * Called when this action is selection from the popup menu. + */ + public void run() + { + ISubSystem ss = (ISubSystem)getFirstSelection(); + try { + IConnectorService system = ss.getConnectorService(); + + // get the user id + String userId = system.getUserId(); + + // clear userid/password from memory and fire event + //DKM and disk now + system.clearPasswordCache(true); + SystemPlugin.getTheSystemRegistry().fireEvent(new SystemResourceChangeEvent(ss, + ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE, + ss.getHost())); + + /* DKM - this is now done in clearPasswordCache + * + // now get rid of userid/password from disk + String systemType = ss.getSystem().getSystemType(); + String hostName = system.getHostName(); + PasswordPersistenceManager.getInstance().remove(systemType, hostName, userId); + */ + } + 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/ui/actions/SystemCollapseAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCollapseAction.java new file mode 100644 index 00000000000..912d57c7e50 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCollapseAction.java @@ -0,0 +1,101 @@ +/******************************************************************************** + * 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 java.util.Iterator; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.ISystemResourceChangeListener; +import org.eclipse.rse.model.SystemResourceChangeEvent; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.SystemResources; +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 Systems Explorer tree view + */ +public class SystemCollapseAction extends SystemBaseAction + +{ + + // see defect 41203 + + /** + * Constructor + */ + public SystemCollapseAction(Shell parent) + { + super(SystemResources.ACTION_COLLAPSE_SELECTED_LABEL, SystemResources.ACTION_COLLAPSE_SELECTED_TOOLTIP, + parent); + allowOnMultipleSelection(true); + setContextMenuGroup(ISystemContextMenuConstants.GROUP_EXPAND); + setAccelerator('-'); + setHelp(SystemPlugin.HELPPREFIX+"actn0024"); + 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= ((IStructuredSelection) selection).iterator(); + ISystemViewElementAdapter adapter = null; + while (!enable && e.hasNext()) + { + Object selectedObject = e.next(); + adapter = getAdapter(selectedObject); + if (adapter != null) + { + if (adapter.hasChildren(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 = SystemPlugin.getTheSystemRegistry(); + if ((viewer != null) && (viewer instanceof ISystemResourceChangeListener)) + { + sr.fireEvent((ISystemResourceChangeListener)viewer, + new SystemResourceChangeEvent("dummy", + ISystemResourceChangeEvents.EVENT_COLLAPSE_SELECTED, null)); + } + else + sr.fireEvent(new SystemResourceChangeEvent("dummy", ISystemResourceChangeEvents.EVENT_COLLAPSE_SELECTED, null)); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCollapseAllAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCollapseAllAction.java new file mode 100644 index 00000000000..b8d634f48e9 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCollapseAllAction.java @@ -0,0 +1,81 @@ +/******************************************************************************** + * 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.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.ISystemResourceChangeListener; +import org.eclipse.rse.model.SystemResourceChangeEvent; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Shell; + + +/** + * The action allows users to collapse the entire Remote Systems Explorer tree view. + */ +public class SystemCollapseAllAction extends SystemBaseAction + // +{ + + // See defect 41203 + + /** + * Constructor + */ + public SystemCollapseAllAction(Shell parent) + { + super(SystemResources.ACTION_COLLAPSE_ALL_LABEL, SystemResources.ACTION_COLLAPSE_ALL_TOOLTIP, + SystemPlugin.getDefault().getImageDescriptorFromIDE(ISystemIconConstants.ICON_IDE_COLLAPSEALL_ID), // D54577 + parent); + setHoverImageDescriptor(SystemPlugin.getDefault().getImageDescriptorFromIDE("elcl16/collapseall.gif")); //$NON-NLS-1$ + allowOnMultipleSelection(true); + setContextMenuGroup(ISystemContextMenuConstants.GROUP_EXPAND); // should never be used + setSelectionSensitive(false); + + setHelp(SystemPlugin.HELPPREFIX+"actn0023"); + 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 = SystemPlugin.getTheSystemRegistry(); + if ((viewer != null) && (viewer instanceof ISystemResourceChangeListener)) + { + sr.fireEvent((ISystemResourceChangeListener)viewer, + new SystemResourceChangeEvent("false", + ISystemResourceChangeEvents.EVENT_COLLAPSE_ALL, null)); + } + else + sr.fireEvent(new SystemResourceChangeEvent("false", ISystemResourceChangeEvents.EVENT_COLLAPSE_ALL, null)); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCommonDeleteAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCommonDeleteAction.java new file mode 100644 index 00000000000..0e9cad94a01 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCommonDeleteAction.java @@ -0,0 +1,205 @@ +/******************************************************************************** + * 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.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.SystemAdapterHelpers; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemDeleteTarget; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.dialogs.SystemDeleteDialog; +import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; +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: + *

      + *
    1. 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. + *
    2. When used without an ISystemDeleteTarget, in which case you need to call wasCancelled() after + * running the action, and then do your own delete. + *
    + *

    + * 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.core.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.ui.dialogs.SystemDeleteDialog + */ +public class SystemCommonDeleteAction + extends SystemBaseDialogAction + implements ISystemIconConstants +{ + private String promptLabel; + + /** + * 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(SystemPlugin.HELPPREFIX+"actn0021"); + } + + /** + * 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) + { + 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. + *

    + * 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) + { + SystemDeleteDialog dlg = new SystemDeleteDialog(shell); + if (promptLabel != null) + dlg.setPromptLabel(promptLabel); + Object firstSelection = getFirstSelection(); + 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; + } + + public class DeleteRunnable implements IRunnableWithProgress + { + private ISystemDeleteTarget _target; + public DeleteRunnable(ISystemDeleteTarget target) + { + _target = target; + } + + public void run(IProgressMonitor monitor) + { + _target.doDelete(monitor); // deletes all the currently selected items + } + } + + /** + * Required by parent. + * In our case, we overload it to also perform the deletion, but only if using a delete target, + * else it is up to the caller to call wasCancelled() and if not true, do their own deletion. + */ + protected Object getDialogValue(Dialog dlg) + { + if (!((SystemDeleteDialog)dlg).wasCancelled() && (getDeleteTarget() != null)) + { + ISystemDeleteTarget target = getDeleteTarget(); + DeleteRunnable delRunnable = new DeleteRunnable(target); + IRunnableContext runnableContext = getRunnableContext(dlg.getShell()); + try + { + runnableContext.run(false, true, delRunnable); + } + catch (Exception e) + { + } + SystemPlugin.getTheSystemRegistry().clearRunnableContext(); + setEnabled(target.canDelete()); + } + return null; + } + + protected IRunnableContext getRunnableContext(Shell shell) + { + IRunnableContext irc = SystemPlugin.getTheSystemRegistry().getRunnableContext(); + if (irc != null) + { + return irc; + } + else + { + irc = new ProgressMonitorDialog(shell); + SystemPlugin.getTheSystemRegistry().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/ui/actions/SystemCommonRenameAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCommonRenameAction.java new file mode 100644 index 00000000000..c97ad22bff0 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCommonRenameAction.java @@ -0,0 +1,236 @@ +/******************************************************************************** + * 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.dialogs.Dialog; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.ISystemRenameTarget; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.dialogs.SystemRenameDialog; +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: + *

      + *
    1. 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. + *
    2. 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. + *
    + *

    + * 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.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, verbage; + + /** + * 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, + SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_RENAME_ID), parent); + allowOnMultipleSelection(true); + setProcessAllSelections(true); + renameTarget = target; + setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE); + setHelp(SystemPlugin.HELPPREFIX+"actn0018"); + } + + /** + * 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 verbage 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 setMultiSelectVerbage(String verbage) + { + this.verbage = verbage; + } + + /** + * 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, verbage 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, verbage 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. + *

    + * 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) + { + // multi-select + if (getSelection().size() > 1) + { + SystemRenameDialog dlg = new SystemRenameDialog(parent); + if (nameValidator != null) + dlg.setNameValidator(nameValidator); + if (multiSelectionHelp != null) + dlg.setHelp(multiSelectionHelp); + if (verbage != null) + dlg.setVerbage(verbage); + return dlg; + } + // single-select + else + { + 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; + } + } + + /** + * 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; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCommonSelectAllAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCommonSelectAllAction.java new file mode 100644 index 00000000000..579bfce945a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCommonSelectAllAction.java @@ -0,0 +1,72 @@ +/******************************************************************************** + * 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.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.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(SystemPlugin.getResourceBundle(), ISystemConstants.ACTION_SELECTALL, null, parent); TODO: XLATE! + super("Select All", (ImageDescriptor)null, parent); + setSelectionProvider(selProvider); + this.target = target; + allowOnMultipleSelection(false); + setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE); + //setHelp(SystemPlugin.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()); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemConnectAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemConnectAction.java new file mode 100644 index 00000000000..f1a315daf33 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemConnectAction.java @@ -0,0 +1,75 @@ +/******************************************************************************** + * 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.core.ISystemTypes; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.swt.widgets.Shell; + +//import org.eclipse.rse.core.ui.SystemMessage; + + +/** + * This is the action for connecting to the remote subsystem + */ +public class SystemConnectAction extends SystemBaseAction + implements ISystemMessages +{ + /** + * 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(SystemPlugin.HELPPREFIX+"actn0047"); + } + /** + * 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(); + try { + if (ss.getHost().getSystemType().equals(ISystemTypes.SYSTEMTYPE_WINDOWS)) + ss.connect(getShell()); + else + ss.connect(getShell(), true); + } 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/ui/actions/SystemConnectAllSubSystemsAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemConnectAllSubSystemsAction.java new file mode 100644 index 00000000000..b4d779bb9a8 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemConnectAllSubSystemsAction.java @@ -0,0 +1,112 @@ +/******************************************************************************** + * 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 java.util.ArrayList; +import java.util.List; + +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.IConnectorService; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.swt.widgets.Shell; + + +//import com.ibm.etools.systems.*; +/** + * This is the action for connecting all subsystems for a given connection. + */ +public class SystemConnectAllSubSystemsAction extends SystemBaseAction + implements ISystemMessages +{ + + 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 = SystemPlugin.getTheSystemRegistry(); + //setHelp(SystemPlugin.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) && + !sr.areAllSubSystemsConnected((IHost)obj)) + { + return true; + } + else + { + return false; + } + } + + /** + * Called when this action is selection from the popup menu. + */ + public void run() + { + List failedSystems = new ArrayList(); + IHost conn = (IHost)getFirstSelection(); + try + { + Shell shell = getShell(); + ISubSystem[] subsystems = conn.getSubSystems(); + for (int i = 0; i < subsystems.length; i++) + { + ISubSystem subsystem = subsystems[i]; + IConnectorService system = subsystem.getConnectorService(); + if (!subsystem.isConnected() && !failedSystems.contains(system)) + { + try + { + subsystem.connect(shell, false); + } + catch (Exception e) + { + failedSystems.add(system); + + // 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 + if (e instanceof InterruptedException) { + break; + } + }// msg already shown + } + } + } + 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/ui/actions/SystemCopyConnectionAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCopyConnectionAction.java new file mode 100644 index 00000000000..b11670ea5ed --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCopyConnectionAction.java @@ -0,0 +1,248 @@ +/******************************************************************************** + * 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 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.SystemPlugin; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.model.ISystemRegistry; +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.SystemResources; +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 + implements ISystemMessages +{ + private ISystemRegistry sr = null; + private SystemSimpleContentElement initialSelectionElement = null; + /** + * Constructor for SystemCopyConnectionAction + */ + public SystemCopyConnectionAction(Shell parent) + { + super(parent, SystemResources.ACTION_COPY_CONNECTION_LABEL, MODE_COPY); + sr = SystemPlugin.getTheSystemRegistry(); + setHelp(SystemPlugin.HELPPREFIX+"actn0019"); + setDialogHelp(SystemPlugin.HELPPREFIX+"dccn0000"); + } + + /** + * We override from parent to do unique checking... + *

    + * We intercept to ensure only connections from the same profile are selected. + *

    + * @see SystemBaseAction#updateSelection(IStructuredSelection) + */ + public boolean updateSelection(IStructuredSelection selection) + { + boolean enable = true; + ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry(); + ISystemProfile prevProfile = null; + Iterator e= ((IStructuredSelection) 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(IProgressMonitor, Object, Object, String) + */ + protected boolean doCopy(IProgressMonitor monitor, Object targetContainer, Object oldObject, String newName) + throws Exception + { + IHost oldConnection = (IHost)oldObject; + String oldName = oldConnection.getAliasName(); + //SystemPlugin.logDebugMessage(this.getClass().getName(),"starting to copy "+oldName+" to "+newName); + ISystemProfile targetProfile = (ISystemProfile)targetContainer; + IHost newConn = sr.copyHost(monitor, oldConnection, targetProfile, newName); + 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 SystemPlugin.getPluginMessage(MSG_COPYCONNECTIONS_PROGRESS); + } + /** + * @see SystemBaseCopyAction#getCopyingMessage( String) + */ + protected SystemMessage getCopyingMessage(String oldName) + { + return SystemPlugin.getPluginMessage(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 + * This is overridden in SystemMoveRemoteFileAction + */ + public SystemMessage isValid(IHost selectedConnection, Object[] selectedObjects, ISystemRemoteElementAdapter[] remoteAdaptersForSelectedObjects) + { + return null; + } + + /** + * We override from parent to do unique checking... + *

    + * We simply ensure every selected object has a system view element adapter. + *

    + * @see SystemBaseAction#updateSelection(IStructuredSelection) + */ + public boolean updateSelection(IStructuredSelection selection) + { + boolean enable = true; + Iterator e = ((IStructuredSelection) 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; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemDisconnectAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemDisconnectAction.java new file mode 100644 index 00000000000..7286e4ddc70 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemDisconnectAction.java @@ -0,0 +1,71 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.swt.widgets.Shell; + + + +/** + * This is the action for disconnecting from a remote subsystem. + */ +public class SystemDisconnectAction extends SystemBaseAction + implements ISystemMessages +{ + + /** + * 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(SystemPlugin.HELPPREFIX+"actn0048"); + } + /** + * 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(getShell()); + } 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/ui/actions/SystemDisconnectAllSubSystemsAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemDisconnectAllSubSystemsAction.java new file mode 100644 index 00000000000..ba5bd778b3b --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemDisconnectAllSubSystemsAction.java @@ -0,0 +1,75 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.swt.widgets.Shell; + + +//import com.ibm.etools.systems.*; +/** + * This is the action forconnecting all subsystems for a given connection. + */ +public class SystemDisconnectAllSubSystemsAction extends SystemBaseAction + implements ISystemMessages +{ + + 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(false); + setContextMenuGroup(ISystemContextMenuConstants.GROUP_CONNECTION); + sr = SystemPlugin.getTheSystemRegistry(); + // TODO help for connect all + //setHelp(SystemPlugin.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) || + !(sr.isAnySubSystemConnected((IHost)obj) )) + return false; + else + return true; + } + + /** + * Called when this action is selection from the popup menu. + */ + public void run() + { + IHost conn = (IHost)getFirstSelection(); + try { + sr.disconnectAllSubSystems(conn); + } 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/ui/actions/SystemDynamicPopupMenuExtensionManager.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemDynamicPopupMenuExtensionManager.java new file mode 100644 index 00000000000..20f17b7c066 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemDynamicPopupMenuExtensionManager.java @@ -0,0 +1,73 @@ +/******************************************************************************** + * 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.actions; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.widgets.Shell; + +/** + * + * Singleton class for managing adapter menu extensions. + * View adapters that support this feature, should call populateMenu to allow for + * extended menu contributions. + */ +public class SystemDynamicPopupMenuExtensionManager implements + ISystemDynamicPopupMenuExtensionManager +{ + private static SystemDynamicPopupMenuExtensionManager _instance = new SystemDynamicPopupMenuExtensionManager(); + + private List _extensions; + + private SystemDynamicPopupMenuExtensionManager() + { + _extensions= new ArrayList(); + } + + public static SystemDynamicPopupMenuExtensionManager getInstance() + { + return _instance; + } + + public void registerMenuExtension(ISystemDynamicPopupMenuExtension ext) + { + _extensions.add(ext); + } + + /** + * Actions are added to a contribution menu. + * @param shell the shell + * @param menu the menu to contribute to + * @param selection(s) are processed to determine the resource source file + * @param menuGroup the default menu group to add actions to + * @return the menu is populated with actions + */ + public void populateMenu(Shell shell, IMenuManager menu,IStructuredSelection selection, String menuGroup) + { + for (int i = 0; i <_extensions.size(); i++) + { + ISystemDynamicPopupMenuExtension extension = (ISystemDynamicPopupMenuExtension)_extensions.get(i); + if (extension.supportsSelection(selection)) + { + extension.populateMenu(shell, menu,selection, menuGroup); + } + } + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemExpandAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemExpandAction.java new file mode 100644 index 00000000000..283a9bd042a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemExpandAction.java @@ -0,0 +1,101 @@ +/******************************************************************************** + * 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 java.util.Iterator; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.ISystemResourceChangeListener; +import org.eclipse.rse.model.SystemResourceChangeEvent; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.SystemResources; +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 Systems Explorer tree view + */ +public class SystemExpandAction extends SystemBaseAction + +{ + + // see defect 41203 + + /** + * Constructor + */ + public SystemExpandAction(Shell parent) + { + super(SystemResources.ACTION_EXPAND_SELECTED_LABEL,SystemResources.ACTION_EXPAND_SELECTED_TOOLTIP, + parent); + allowOnMultipleSelection(true); + setContextMenuGroup(ISystemContextMenuConstants.GROUP_EXPAND); + setAccelerator('+'); + setHelp(SystemPlugin.HELPPREFIX+"actn0025"); + setAvailableOffline(true); +} + + /** + *

    + * 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= ((IStructuredSelection) selection).iterator(); + ISystemViewElementAdapter adapter = null; + while (!enable && e.hasNext()) + { + Object selectedObject = e.next(); + adapter = getAdapter(selectedObject); + if (adapter != null) + { + if (adapter.hasChildren(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 = SystemPlugin.getTheSystemRegistry(); + if ((viewer != null) && (viewer instanceof ISystemResourceChangeListener)) + { + sr.fireEvent((ISystemResourceChangeListener)viewer, + new SystemResourceChangeEvent("dummy", + ISystemResourceChangeEvents.EVENT_EXPAND_SELECTED, null)); + } + else + sr.fireEvent(new SystemResourceChangeEvent("dummy", ISystemResourceChangeEvents.EVENT_EXPAND_SELECTED, null)); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemMoveConnectionAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemMoveConnectionAction.java new file mode 100644 index 00000000000..4ad5d3d6ef3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemMoveConnectionAction.java @@ -0,0 +1,256 @@ +/******************************************************************************** + * 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 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.SystemPlugin; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.model.ISystemRegistry; +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.SystemResources; +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 + implements ISystemMessages +{ + + private ISystemRegistry sr = null; + 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! + sr = SystemPlugin.getTheSystemRegistry(); + setHelp(SystemPlugin.HELPPREFIX+"actn0020"); + setDialogHelp(SystemPlugin.HELPPREFIX+"dmcn0000"); + } + + /** + * We override from parent to do unique checking... + *

    + * We intercept to ensure only connections from the same profile are selected. + *

    + * @see SystemBaseAction#updateSelection(IStructuredSelection) + */ + public boolean updateSelection(IStructuredSelection selection) + { + if (sr.getActiveSystemProfiles().length <= 1) + return false; + boolean enable = true; + ISystemProfile prevProfile = null; + Iterator e= ((IStructuredSelection) 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(IProgressMonitor, Object, Object, String) + */ + protected boolean doCopy(IProgressMonitor monitor, Object targetContainer, Object oldObject, String newName) + throws Exception + { + IHost oldConnection = (IHost)oldObject; + String oldName = oldConnection.getAliasName(); + //SystemPlugin.logDebugMessage(this.getClass().getName(),"starting to copy "+oldName+" to "+newName); + ISystemProfile targetProfile = (ISystemProfile)targetContainer; + IHost newConn = sr.moveHost(monitor, oldConnection, targetProfile, newName); + 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 SystemPlugin.getPluginMessage(MSG_MOVECONNECTIONS_PROGRESS); + } + /** + * @see SystemBaseCopyAction#getCopyingMessage( String) + */ + protected SystemMessage getCopyingMessage(String oldName) + { + return SystemPlugin.getPluginMessage(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 + * We intercept to ensure only connections from the same profile are selected. + *

    + * @see SystemBaseAction#updateSelection(IStructuredSelection) + */ + public boolean updateSelection(IStructuredSelection selection) + { + boolean enable = true; + ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry(); + prevProfile = null; + Iterator e= ((IStructuredSelection) 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 = SystemPlugin.getDefault().getSystemRegistry(); + SystemSortableSelection[] sortableArray = SystemSortableSelection.makeSortableArray(getSelection()); + IHost conn = null; + for (int idx=0; idx + * We intercept to ensure only connections from the same profile are selected. + *

    + * @see SystemBaseAction#updateSelection(IStructuredSelection) + */ + public boolean updateSelection(IStructuredSelection selection) + { + boolean enable = true; + ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry(); + prevProfile = null; + Iterator e= ((IStructuredSelection) 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 = SystemPlugin.getDefault().getSystemRegistry(); + + SystemSortableSelection[] sortableArray = SystemSortableSelection.makeSortableArray(getSelection()); + IHost conn = null; + for (int idx=0; idx + * Our default implementation is to return SystemNewConnectionWizard. + */ + protected IWizard createWizard() + { + SystemNewConnectionWizard newConnWizard = new SystemNewConnectionWizard(); + if (!fromPopupMenu && (sp!=null)) + { + setSelection(sp.getSelection()); + } + + newConnWizard.setCurrentlySelectedConnection(currConn); + if (restrictSystemTypesTo != null) + newConnWizard.restrictSystemTypes(restrictSystemTypesTo); + if (defaultHostName != null) + newConnWizard.setHostName(defaultHostName); + if (defaultConnectionName != null) + newConnWizard.setConnectionName(defaultConnectionName); + return newConnWizard; + } + + /** + * Set the current selected connection so we can better intelligently set + * the defaults. + */ + public void setCurrentConnection(IHost conn) + { + this.currConn = conn; + } + /** + * Call this to restrict the system type that the user is allowed to choose + */ + public void restrictSystemType(String systemType) + { + restrictSystemTypesTo = new String[1]; + restrictSystemTypesTo[0] = systemType; + } + /** + * Call this to restrict the system types that the user is allowed to choose + */ + public void restrictSystemTypes(String[] systemTypes) + { + this.restrictSystemTypesTo = systemTypes; + } + /** + * Preset the connection name + */ + public void setConnectionName(String name) + { + defaultConnectionName = name; + } + /** + * Preset the host name + */ + public void setHostName(String name) + { + defaultHostName = name; + } + + /** + * Override of parent method so we can deduce currently selected connection (direct or indirect if child object selected). + */ + public boolean updateSelection(IStructuredSelection selection) + { + boolean enable = super.updateSelection(selection); + if (enable) + { + 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(); + } + } + setCurrentConnection(conn); + } + return enable; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemNewConnectionFromExistingConnectionAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemNewConnectionFromExistingConnectionAction.java new file mode 100644 index 00000000000..b33183b1b9e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemNewConnectionFromExistingConnectionAction.java @@ -0,0 +1,41 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.swt.widgets.Shell; + + +/** + * The action that displays the Create Another Connection wizard + */ +public class SystemNewConnectionFromExistingConnectionAction extends SystemNewConnectionAction + +{ + + /** + * Constructor + * @param shell The parent shell to host the new wizard + */ + public SystemNewConnectionFromExistingConnectionAction(Shell shell) + { + super(shell, SystemResources.ACTION_ANOTHERCONN_LABEL, SystemResources.ACTION_ANOTHERCONN_TOOLTIP, false, true, null); + setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW); + setHelp(SystemPlugin.HELPPREFIX+"actn0015"); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemNewProfileAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemNewProfileAction.java new file mode 100644 index 00000000000..2ee8ff82196 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemNewProfileAction.java @@ -0,0 +1,111 @@ +/******************************************************************************** + * 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.wizard.IWizard; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.model.SystemStartHere; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.view.team.SystemTeamView; +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..." + */ + public SystemNewProfileAction(Shell parent) + { + super(SystemResources.ACTION_NEWPROFILE_LABEL, SystemResources.ACTION_NEWPROFILE_TOOLTIP, SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWPROFILE_ID), parent); + setSelectionSensitive(false); + setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW); + setHelp(SystemPlugin.HELPPREFIX+"actn0003"); + } + /** + * Constructor for SystemNewProfileAction where you can choose between "New profile..." and "New -> Profile" + */ + 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, + SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWPROFILE_ID), parent); + setSelectionSensitive(false); + if (cascading) + setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW); + else + setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW_NONCASCADING); + setHelp(SystemPlugin.HELPPREFIX+"actn0003"); + } + + /** + * Refresh the enabled state + */ + public void refreshEnablement() + { + setEnabled(isEnabled()); + } + + /** + * 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. + */ + public boolean isEnabled() + { + // defect 43428... + ISystemProfile defaultProfile = SystemStartHere.getSystemProfileManager().getDefaultPrivateSystemProfile(); + if (defaultProfile != null) + return false; + else + return true; + } + /** + * The default processing for the run method calls createDialog, which + * in turn calls this method to return an instance of our wizard. + *

    + * Our default implementation is to call SystemNewProfileWizard. + */ + 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. + */ + protected void postProcessWizard(IWizard wizard) + { + if (getViewer() instanceof SystemTeamView) + { + getViewer().refresh(); + } + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemOpenExplorerPerspectiveAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemOpenExplorerPerspectiveAction.java new file mode 100644 index 00000000000..b38427b8713 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemOpenExplorerPerspectiveAction.java @@ -0,0 +1,130 @@ +/******************************************************************************** + * 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.core.runtime.IAdaptable; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.model.ISystemPromptableObject; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.view.SystemPerspectiveLayout; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IPerspectiveDescriptor; +import org.eclipse.ui.IPerspectiveRegistry; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.OpenInNewWindowAction; + + +/** + * The action allows users to open a new Remote Systems Explorer perspective, anchored + * by the currently selected resource. + */ +public class SystemOpenExplorerPerspectiveAction + extends SystemBaseAction + +{ + //private boolean replaceEnabled = true; + private IWorkbenchWindow window; + private IPerspectiveRegistry reg; + private IPerspectiveDescriptor desc = null; + + /** + * Constructor + */ + public SystemOpenExplorerPerspectiveAction(Shell parent, IWorkbenchWindow currentWorkbenchWindow) + { + super(SystemResources.ACTION_OPENEXPLORER_DIFFPERSP2_LABEL, SystemResources.ACTION_OPENEXPLORER_DIFFPERSP2_TOOLTIP, + SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_PERSPECTIVE_ID), + parent); + this.window = currentWorkbenchWindow; + this.reg = PlatformUI.getWorkbench().getPerspectiveRegistry(); + this.desc = reg.findPerspectiveWithId(SystemPerspectiveLayout.ID); + + allowOnMultipleSelection(false); + setContextMenuGroup(ISystemContextMenuConstants.GROUP_OPEN); + setHelp(SystemPlugin.HELPPREFIX+"actn0016"); + } + + /** + * We override from parent to do unique checking... + *

    + * We intercept to ensure only connections from the same profile are selected. + *

    + * @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() + { + /* OLD RELEASE 1 CODE + IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore(); + String perspectiveSetting = + store.getString(IWorkbenchPreferenceConstants.OPEN_NEW_PERSPECTIVE); + runWithPerspectiveValue(desc, perspectiveSetting); + */ + OpenInNewWindowAction workbenchOpenAction = // NEW FOR RELEASE 2 + new OpenInNewWindowAction(window,getPageInput()); + 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/ui/actions/SystemOpenRSEPerspectiveAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemOpenRSEPerspectiveAction.java new file mode 100644 index 00000000000..b402d077d44 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemOpenRSEPerspectiveAction.java @@ -0,0 +1,42 @@ +/******************************************************************************** + * 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.Action; +import org.eclipse.rse.core.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(); + } + +} \ 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 new file mode 100644 index 00000000000..bfb0c22eac5 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPasteFromClipboardAction.java @@ -0,0 +1,350 @@ +/******************************************************************************** + * 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 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.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.model.IHost; +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.SystemResources; +import org.eclipse.rse.ui.validators.IValidatorRemoteSelection; +import org.eclipse.rse.ui.view.ISystemDragDropAdapter; +import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; +import org.eclipse.rse.ui.view.SystemDNDTransferRunnable; +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 ISystemMessages, 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), + //SystemPlugin.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(SystemPlugin.HELPPREFIX + "actn0117"); + } + + public void run() + { + if (_selection != null) + { + pasteClipboardToSelection(_selection); + } + } + + + private void pasteClipboardToSelection(Object target) + { + List srcObjects = SystemPlugin.getTheSystemRegistry().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) + { + ISubSystem targetSubSystem = targetAdapter.getSubSystem(target); + 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 - 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); + } + + ISchedulingRule[] rules = (ISchedulingRule[])rulesList.toArray(new ISchedulingRule[rulesList.size()]); + MultiRule rule = new MultiRule(rules); + //runnable.setRule(rule); + } + } + runnable.schedule(); + SystemPlugin.getTheSystemRegistry().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. + *

    + * 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... + *

    + * We simply ensure every selected object is an IRemoteFile + *

    + * @see SystemBaseAction#updateSelection(IStructuredSelection) + */ + public boolean updateSelection(IStructuredSelection selection) + { + if (hasSource()) + { + boolean enable = true; + Iterator e = ((IStructuredSelection) 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 = SystemPlugin.getTheSystemRegistry().getRunnableContext(); + if (irc != null) + { + return irc; + } + else + { + /* + // for other cases, use statusbar + IWorkbenchWindow win = SystemPlugin.getActiveWorkbenchWindow(); + if (win != null) + { + Shell winShell = SystemPlugin.getActiveWorkbenchShell(); + if (winShell != null && !winShell.isDisposed() && winShell.isVisible()) + { + SystemPlugin.logInfo("Using active workbench window as runnable context"); + shell = winShell; + return win; + } + else + { + win = null; + } + } + */ + + irc = new ProgressMonitorDialog(shell); + SystemPlugin.getTheSystemRegistry().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/SystemPreferenceQualifyConnectionNamesAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceQualifyConnectionNamesAction.java new file mode 100644 index 00000000000..2b023ae3066 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceQualifyConnectionNamesAction.java @@ -0,0 +1,73 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.internal.model.SystemPreferenceChangeEvent; +import org.eclipse.rse.model.ISystemPreferenceChangeEvents; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.ui.SystemResources; +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 + +{ + + private ISystemRegistry sr = null; + /** + * Constructor + */ + public SystemPreferenceQualifyConnectionNamesAction(Shell parent) + { + super(SystemResources.ACTION_QUALIFY_CONNECTION_NAMES_LABEL,SystemResources.ACTION_QUALIFY_CONNECTION_NAMES_TOOLTIP, + parent); + setSelectionSensitive(false); + allowOnMultipleSelection(true); + sr = SystemPlugin.getTheSystemRegistry(); + setChecked(sr.getQualifiedHostNames()); + + setHelp(SystemPlugin.HELPPREFIX+"actn0008"); + } + + /** + * This is the method called when the user selects this action. + * @see org.eclipse.jface.action.Action#run() + */ + public void run() + { + boolean newState = isChecked(); + sr.setQualifiedHostNames(newState); + firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_QUALIFYCONNECTIONNAMES, + !newState,newState); // defect 41794 + } + + /** + * Fire a preference change event + */ + private void firePreferenceChangeEvent(int type, boolean oldValue, boolean newValue) + { + SystemPlugin.getDefault().getSystemRegistry().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/ui/actions/SystemPreferenceRestoreStateAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceRestoreStateAction.java new file mode 100644 index 00000000000..dd81600c206 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceRestoreStateAction.java @@ -0,0 +1,72 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.core.SystemPreferencesManager; +import org.eclipse.rse.internal.model.SystemPreferenceChangeEvent; +import org.eclipse.rse.model.ISystemPreferenceChangeEvents; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.ui.SystemResources; +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 = SystemPlugin.getTheSystemRegistry(); + setChecked(SystemPreferencesManager.getPreferencesManager().getRememberState()); + + setHelp(SystemPlugin.HELPPREFIX+"aprefres"); + } + + /** + * 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.getPreferencesManager().setRememberState(newState); + firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_RESTORESTATE, + !newState,newState); + } + + /** + * Fire a preference change event + */ + private void firePreferenceChangeEvent(int type, boolean oldValue, boolean newValue) + { + SystemPlugin.getDefault().getSystemRegistry().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/ui/actions/SystemPreferenceShowFilterPoolsAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceShowFilterPoolsAction.java new file mode 100644 index 00000000000..d2fda542ee9 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceShowFilterPoolsAction.java @@ -0,0 +1,72 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.core.SystemPreferencesManager; +import org.eclipse.rse.internal.model.SystemPreferenceChangeEvent; +import org.eclipse.rse.model.ISystemPreferenceChangeEvents; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.swt.widgets.Shell; + + +/** + * The action allows users to decide whether or not to show filter pools in the remote systems 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.getPreferencesManager().getShowFilterPools()); + setSelectionSensitive(false); + + setHelp(SystemPlugin.HELPPREFIX+"actn0011"); + } + + /** + * 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.getPreferencesManager().setShowFilterPools(newState); + firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_SHOWFILTERPOOLS, + !newState,newState); // defect 41794 + } + + /** + * Fire a preference change event + */ + private void firePreferenceChangeEvent(int type, boolean oldValue, boolean newValue) + { + SystemPlugin.getDefault().getSystemRegistry().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/ui/actions/SystemPreferenceUserIdPerSystemTypeAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceUserIdPerSystemTypeAction.java new file mode 100644 index 00000000000..bfb71676b94 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceUserIdPerSystemTypeAction.java @@ -0,0 +1,83 @@ +/******************************************************************************** + * 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.dialogs.Dialog; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.SystemPreferencesManager; +import org.eclipse.rse.core.SystemType; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.ui.dialogs.SystemUserIdPerSystemTypeDialog; +import org.eclipse.swt.widgets.Shell; + + +/** + * A selectable system type overall default userId action. + */ +public class SystemPreferenceUserIdPerSystemTypeAction extends SystemBaseDialogAction + +{ + + private SystemType systemType; + + /** + * Constructor + */ + public SystemPreferenceUserIdPerSystemTypeAction(Shell parent, SystemType systemType) + { + super(systemType.getName()+"...",null,parent); + this.systemType = systemType; + setSelectionSensitive(false); + + setHelp(SystemPlugin.HELPPREFIX+"actn0010"); + } + + /** + * @see SystemBaseAction#updateSelection(IStructuredSelection) + */ + public boolean updateSelection(IStructuredSelection selection) + { + boolean enable = true; + return enable; + } + + /* + * Override of parent + * @see #run() + */ + protected Dialog createDialog(Shell parent) + { + return new SystemUserIdPerSystemTypeDialog(parent, systemType); + } + + /** + * Required by parent. We use it to return the userId. Note the actual update is done! + */ + protected Object getDialogValue(Dialog dlg) + { + String userId = null; + SystemUserIdPerSystemTypeDialog uidDlg = (SystemUserIdPerSystemTypeDialog)dlg; + if (!uidDlg.wasCancelled()) + { + userId = uidDlg.getUserId(); + SystemPreferencesManager.getPreferencesManager().setDefaultUserId(systemType.getName(), userId); + SystemPlugin.getTheSystemRegistry().fireEvent(ISystemResourceChangeEvents.PROPERTYSHEET_UPDATE_EVENT); + } + return userId; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemProfileNameCopyAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemProfileNameCopyAction.java new file mode 100644 index 00000000000..f5b1b462140 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemProfileNameCopyAction.java @@ -0,0 +1,224 @@ +/******************************************************************************** + * 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.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.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.internal.model.SystemProfileManager; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.model.ISystemProfileManager; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.dialogs.SystemCopyProfileDialog; +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 ISystemMessages, 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 = SystemPlugin.getTheSystemRegistry(); + setSelectionSensitive(true); + allowOnMultipleSelection(false); + setHelp(SystemPlugin.HELPPREFIX+"actndupr"); + } + + /** + * 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() + { + ISystemRegistry sr = SystemPlugin.getTheSystemRegistry(); + IRunnableContext irc = sr.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(monitor, profile,newName,makeActive); + 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 = SystemPlugin.getPluginMessage(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, SystemPlugin.getPluginMessage(MSG_OPERATION_FAILED).makeSubstitution(exc.getMessage())); + msgDlg.open(); + SystemBasePlugin.logError("Copy profile 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, SystemPlugin.getPluginMessage(MSG_OPERATION_CANCELLED)); + msgDlg.open(); + } + + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemProfileNameSelectAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemProfileNameSelectAction.java new file mode 100644 index 00000000000..0689c23cfc0 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemProfileNameSelectAction.java @@ -0,0 +1,59 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.internal.model.SystemProfileManager; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.model.ISystemProfileManager; +import org.eclipse.rse.model.ISystemRegistry; +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.getSystemProfileManager(); + setChecked(mgr.isSystemProfileActive(profile.getName())); + setSelectionSensitive(false); + + setHelp(SystemPlugin.HELPPREFIX+"actn0004"); + } + + + /** + * This is the method called when the user selects this action. + * @see org.eclipse.jface.action.Action#run() + */ + public void run() + { + ISystemRegistry sr = SystemPlugin.getTheSystemRegistry(); + sr.setSystemProfileActive(profile, isChecked()); + } +} \ 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 new file mode 100644 index 00000000000..d7239eeeba4 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRefreshAction.java @@ -0,0 +1,98 @@ +/******************************************************************************** + * 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 java.util.Iterator; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.model.ISystemContainer; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.ISystemResourceChangeListener; +import org.eclipse.rse.model.SystemResourceChangeEvent; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.swt.widgets.Shell; + + +/** + * The action allows users to refresh the selected node in the Remote Systems 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, + SystemPlugin.getDefault().getImageDescriptorFromIDE(ISystemIconConstants.ICON_IDE_REFRESH_ID), // D54577 + parent); + allowOnMultipleSelection(true); + setContextMenuGroup(ISystemContextMenuConstants.GROUP_BUILD); + setHelp(SystemPlugin.HELPPREFIX+"actn0017"); + 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 = SystemPlugin.getTheSystemRegistry(); + if (_selection != null) + { + Iterator iter = _selection.iterator(); + while(iter.hasNext()) + { + Object obj = iter.next(); + + if (obj instanceof ISystemContainer) + { + ((ISystemContainer)obj).markStale(true); + } + sr.fireEvent(new SystemResourceChangeEvent(obj, ISystemResourceChangeEvents.EVENT_REFRESH, obj)); + } + } + else + { + 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 new file mode 100644 index 00000000000..549bce06e49 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRefreshAllAction.java @@ -0,0 +1,102 @@ +/******************************************************************************** + * 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 java.util.Iterator; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.model.ISystemContainer; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.SystemResourceChangeEvent; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.swt.widgets.Shell; + + +/** + * The action allows users to refresh the entire Remote Systems 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(SystemPlugin.HELPPREFIX+"actn0009"); + } + + 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 = SystemPlugin.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/SystemRemotePropertiesAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemotePropertiesAction.java new file mode 100644 index 00000000000..37f144056c8 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemotePropertiesAction.java @@ -0,0 +1,162 @@ +/******************************************************************************** + * 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 java.text.MessageFormat; +import java.util.Iterator; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.preference.PreferenceManager; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPropertyPageExtensionManager; +import org.eclipse.rse.ui.GenericMessages; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.internal.dialogs.PropertyDialog; +import org.eclipse.ui.internal.dialogs.PropertyPageManager; + + +/** + * The action shows properties for remote objects + */ +public class SystemRemotePropertiesAction + extends SystemBaseAction + +{ + + /** + * Constructor + */ + public SystemRemotePropertiesAction(Shell shell) + { + super(SystemResources.ACTION_REMOTE_PROPERTIES_LABEL, SystemResources.ACTION_REMOTE_PROPERTIES_TOOLTIP,shell); + allowOnMultipleSelection(false); + setContextMenuGroup(ISystemContextMenuConstants.GROUP_PROPERTIES); + } + + /** + * We override from parent to do unique checking... + *

    + * It is too expense to check for registered property pages at popup time, so we just return true. + *

    + * @see SystemBaseAction#updateSelection(IStructuredSelection) + */ + public boolean updateSelection(IStructuredSelection selection) + { + boolean enable = true; + return enable; + } + + /** + * Returns the name of the given element. + * @param element the element + * @return the name of the element + */ + private String getName(Object element) + { + return getAdapter(element).getName(element); + } + /** + * Returns whether the provided object has pages registered in the property page + * manager. + */ + public boolean hasPropertyPagesFor(Object object) + { + //PropertyPageContributorManager manager = PropertyPageContributorManager.getManager(); + return getOurPropertyPageManager().hasContributorsFor(getRemoteAdapter(object), object); + } + /** + * Get the remote property page extension manager + */ + private SystemPropertyPageExtensionManager getOurPropertyPageManager() + { + return SystemPropertyPageExtensionManager.getManager(); + } + /** + * Returns whether this action is actually applicable to the current selection. + * Returns true if there are any registered property pages applicable for the + * given input object. + *

    + * This method is generally too expensive to use when updating the enabled state + * of the action. + *

    + * + * @return true if there are property pages for the currently + * selected element, and false otherwise + */ + public boolean isApplicableForSelection() + { + return hasPropertyPagesFor(getFirstSelection()); + } + /** + * The PropertyDialogAction implementation of this + * IAction method performs the action by opening the Property Page + * Dialog for the current selection. If no pages are found, an informative + * message dialog is presented instead. + */ + public void run() + { + PropertyPageManager pageManager = new PropertyPageManager(); + String title = "";//$NON-NLS-1$ + + // get selection + //Object element = getFirstSelection(); + IAdaptable element = (IAdaptable)getFirstSelection(); + if (element == null) + return; + ISystemRemoteElementAdapter adapter = getRemoteAdapter(element); + if (adapter == null) + return; + + // load pages for the selection + // fill the manager with contributions from the matching contributors + getOurPropertyPageManager().contribute(pageManager, getRemoteAdapter(element), element); + //PropertyPageContributorManager.getManager().contribute(pageManager, element); + + Shell shell = getShell(); + + // testing if there are pages in the manager + Iterator pages = pageManager.getElements(PreferenceManager.PRE_ORDER).iterator(); + String name = getName(element); + if (!pages.hasNext()) { + MessageDialog.openInformation( + shell, + GenericMessages.PropertyDialog_messageTitle, + MessageFormat.format(GenericMessages.PropertyDialog_noPropertyMessage, new Object[] {name})); + return; + } + else + { + title = MessageFormat.format(GenericMessages.PropertyDialog_propertyMessage, new Object[] {name}); + } + + PropertyDialog propertyDialog = new PropertyDialog(shell, pageManager, getSelection()); + propertyDialog.create(); + propertyDialog.getShell().setText(title); + + + + // TODO - hack to make this work in 3.1 + String id = PlatformUI.PLUGIN_ID + ".property_dialog_context"; + PlatformUI.getWorkbench().getHelpSystem().setHelp(propertyDialog.getShell(), id); + + propertyDialog.open(); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemoteServerStartAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemoteServerStartAction.java new file mode 100644 index 00000000000..ddbf08c7bbb --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemoteServerStartAction.java @@ -0,0 +1,59 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +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 + implements ISystemMessages +{ + 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(SystemPlugin.HELPPREFIX+"actnstsv"); + } + + /** + * 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); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemoteServerStopAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemoteServerStopAction.java new file mode 100644 index 00000000000..5d6a5ac289d --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemoteServerStopAction.java @@ -0,0 +1,59 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +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 + implements ISystemMessages +{ + 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(SystemPlugin.HELPPREFIX+"actnspsv"); + } + + /** + * 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); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemResolveFilterStringAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemResolveFilterStringAction.java new file mode 100644 index 00000000000..823d68187b8 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemResolveFilterStringAction.java @@ -0,0 +1,76 @@ +/******************************************************************************** + * 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.dialogs.Dialog; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.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. + *

    + * 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) + { + dlg = new SystemResolveFilterStringDialog(shell, subsystem, filterString); + + return dlg; + } // end createDialog() + + /** + * Return selected object. If multiple objects are selected, + * returns the first selected object. + */ + public Object getSelectedObject() + { + return getValue(); + } + +} // end class SystemResolveFilterStringAction \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRunAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRunAction.java new file mode 100644 index 00000000000..5616d8ca22d --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRunAction.java @@ -0,0 +1,94 @@ +/******************************************************************************** + * 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.resource.ImageDescriptor; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +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, + SystemPlugin.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(SystemPlugin.HELPPREFIX+"actn0100"); + } + + + /** + * @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()); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSelectConnectionAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSelectConnectionAction.java new file mode 100644 index 00000000000..6ef2efb2cc4 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSelectConnectionAction.java @@ -0,0 +1,187 @@ +/******************************************************************************** + * 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.dialogs.Dialog; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.dialogs.SystemSelectConnectionDialog; +import org.eclipse.swt.widgets.Shell; + + +/** + * Use this action to put up a dialog allowing users to select one or + * more connections. + */ +public class SystemSelectConnectionAction extends SystemBaseDialogAction +{ + private boolean multiSelect; + private boolean showPropertySheetInitialState; + private boolean showPropertySheet; + private String message; + private boolean showNewConnectionPrompt = true; + private String[] systemTypes; + private String systemType; + private IHost defaultConn; + private Object result; + + /** + * Constructor + */ + public SystemSelectConnectionAction(Shell shell) + { + super(SystemResources.ACTION_SELECTCONNECTION_LABEL, SystemResources.ACTION_SELECTCONNECTION_TOOLTIP,null, shell); + } + + /** + * Set the connection to default the selection to + */ + public void setDefaultConnection(IHost conn) + { + this.defaultConn = conn; + } + /** + * Restrict to certain system types + * @param systemTypes the system types to restrict what connections are shown and what types of connections + * the user can create + * @see org.eclipse.rse.core.ISystemTypes + */ + public void setSystemTypes(String[] systemTypes) + { + this.systemTypes = systemTypes; + } + /** + * Restrict to a certain system type + * @param systemType the system type to restrict what connections are shown and what types of connections + * the user can create + * @see org.eclipse.rse.core.ISystemTypes + */ + public void setSystemType(String systemType) + { + this.systemType = systemType; + } + /** + * Set to true/false if a "New Connection..." special connection is to be shown for creating new connections. + * Defaault is true. + */ + public void setShowNewConnectionPrompt(boolean show) + { + this.showNewConnectionPrompt = show; + } + /** + * Set the label text shown at the top of the dialog + */ + public void setInstructionLabel(String message) + { + this.message = message; + } + + /** + * Show the property sheet on the right hand side, to show the properties of the + * selected object. + *

    + * This overload always shows the property sheet + *

    + * Default is false + */ + public void setShowPropertySheet(boolean show) + { + this.showPropertySheet = show; + } + /** + * Show the property sheet on the right hand side, to show the properties of the + * selected object. + *

    + * This overload shows a Details>>> button so the user can decide if they want to see the + * property sheet. + *

    + * @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) + { + this.showPropertySheet = show; + this.showPropertySheetInitialState = initialState; + } + + /** + * Set multiple selection mode. Default is single selection mode + *

    + * If you turn on multiple selection mode, you must use the getSelectedObjects() + * method to retrieve the list of selected objects. + *

    + * 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) + { + this.multiSelect = multiple; + } + + /** + * Return the selected connection in single select mode + */ + public IHost getSystemConnection() + { + if (result instanceof IHost) + return (IHost)result; + else if (result instanceof IHost[]) + return ((IHost[])result)[0]; + else + return null; + } + + + /* (non-Javadoc) + * @see org.eclipse.rse.core.ui.actions.SystemBaseDialogAction#createDialog(org.eclipse.swt.widgets.Shell) + */ + protected Dialog createDialog(Shell shell) + { + SystemSelectConnectionDialog selectDlg = new SystemSelectConnectionDialog(shell); + if (defaultConn != null) + selectDlg.setDefaultConnection(defaultConn); + if (systemTypes != null) + selectDlg.setSystemTypes(systemTypes); + else if (systemType != null) + selectDlg.setSystemType(systemType); + selectDlg.setShowNewConnectionPrompt(showNewConnectionPrompt); + if (message != null) + selectDlg.setInstructionLabel(message); + if (showPropertySheet) + selectDlg.setShowPropertySheet(showPropertySheet,showPropertySheetInitialState); + selectDlg.setMultipleSelectionMode(multiSelect); + return selectDlg; + } + + /* (non-Javadoc) + * @see org.eclipse.rse.core.ui.actions.SystemBaseDialogAction#getDialogValue(org.eclipse.jface.dialogs.Dialog) + */ + protected Object getDialogValue(Dialog dlg) + { + SystemSelectConnectionDialog selectDlg = (SystemSelectConnectionDialog)dlg; + result = selectDlg.getOutputObject(); + return result; + } + + + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSeparatorAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSeparatorAction.java new file mode 100644 index 00000000000..77221c3243e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSeparatorAction.java @@ -0,0 +1,58 @@ +/******************************************************************************** + * 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.Separator; +import org.eclipse.jface.resource.ImageDescriptor; +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); + realAction = true; + } + /** + * Constructor for SystemSeparatorAction when you just want the separator + */ + public SystemSeparatorAction() + { + super("_separator_",(ImageDescriptor)null,null); + 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; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemShowInMonitorAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemShowInMonitorAction.java new file mode 100644 index 00000000000..cc94dfe5fc4 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemShowInMonitorAction.java @@ -0,0 +1,103 @@ +/******************************************************************************** + * 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 java.util.Iterator; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.view.ISystemViewElementAdapter; +import org.eclipse.rse.ui.view.monitor.SystemMonitorUI; +import org.eclipse.rse.ui.view.monitor.SystemMonitorViewPart; +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, + SystemPlugin.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 = ((IStructuredSelection) selection).iterator(); + Object selected = e.next(); + + if (selected != null && selected instanceof IAdaptable) + { + ISystemViewElementAdapter va = (ISystemViewElementAdapter) ((IAdaptable) selected).getAdapter(ISystemViewElementAdapter.class); + if (va.hasChildren(selected)) + { + _selected = selected; + enable = true; + } + } + + return enable; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemShowInTableAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemShowInTableAction.java new file mode 100644 index 00000000000..0061a4d88d9 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemShowInTableAction.java @@ -0,0 +1,102 @@ +/******************************************************************************** + * 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 java.util.Iterator; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.view.ISystemViewElementAdapter; +import org.eclipse.rse.ui.view.SystemTableViewPart; +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, + SystemPlugin.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); + } + 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 = ((IStructuredSelection) selection).iterator(); + Object selected = e.next(); + + if (selected != null && selected instanceof IAdaptable) + { + ISystemViewElementAdapter va = (ISystemViewElementAdapter) ((IAdaptable) selected).getAdapter(ISystemViewElementAdapter.class); + if (va.hasChildren(selected)) + { + _selected = selected; + enable = true; + } + } + + return enable; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemShowPreferencesPageAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemShowPreferencesPageAction.java new file mode 100644 index 00000000000..40784f1b33e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemShowPreferencesPageAction.java @@ -0,0 +1,217 @@ +/******************************************************************************** + * 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 com.ibm.etools.systems.model.*; +//import com.ibm.etools.systems.model.impl.*; +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.core.SystemPlugin; +import org.eclipse.ui.IActionDelegate; +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 Prefences dialog, but only rooted at a given + * preference page (it will include its children underneath), including the + * child pages registered under that page ("category"). + *

    + * This is used by the org.eclipse.rse.core.remoteSystemsViewPreferencesActions + * extension point. + * @see org.eclipse.rse.ui.actions.SystemCascadingPreferencesAction + */ +public class SystemShowPreferencesPageAction extends SystemBaseAction implements IViewActionDelegate +{ + + private PreferenceManager preferenceManager; + private String[] preferencePageIDs; + private String preferencePageCategory; + + /** + * Constructor. We are instantiated inside {@link SystemPlugin#getPreferencePageActionPlugins()} + * for each extension of our extension point org.eclipse.rse.core.remoteSystemsViewPreferencesActions + */ + public SystemShowPreferencesPageAction() + { + super("temp label", null); + } + + /** + * 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 IActionDelegate#run(IAction) + */ + public void run(IAction action) + { + run(); + } + + + /** + * @see IActionDelegate#selectionChanged(IAction, 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) + { + 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"; + + 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 + *

  • button/menuitem label -> appends ".label" to key + *
  • button/menuitem tooltip -> appends ".tooltip" to key + *
  • button/menuitem description on status line -> appends ".description" to key + *
  • title of generic prompt dialog box displayed -> appends ".title" + *
  • prompt text in generic prompt dialog box displayed -> appends ".prompt" + * + * @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; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSubMenuManager.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSubMenuManager.java new file mode 100644 index 00000000000..300bdc18249 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSubMenuManager.java @@ -0,0 +1,403 @@ +/******************************************************************************** + * 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.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.core.SystemBasePlugin; +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. + *

    + * The state-setting methods including setShell, setSelection and setValue. + */ +public class SystemSubMenuManager + extends MenuManager + //implements ISelectionChangedListener + //implements ISystemAction +{ + 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+"'"); + 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); + } + + } + + /** + * 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); + } + + } + /** + * 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); + } + + 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); + } + } + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSubMenuManagerForTesting.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSubMenuManagerForTesting.java new file mode 100644 index 00000000000..888a8071560 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSubMenuManagerForTesting.java @@ -0,0 +1,180 @@ +/******************************************************************************** + * 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.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.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. + *

    + * The state-setting methods including setShell, setSelection and setValue. + *

    + * 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 = ""; + + /** + * Constructor + */ + public SystemSubMenuManagerForTesting(SystemBaseSubMenuAction parentAction) + { + super(parentAction); + } + /** + * Constructor + */ + public SystemSubMenuManagerForTesting(SystemBaseSubMenuAction parentAction, String text) + { + super(parentAction, text); + System.out.println("SUBMENUMGR CTOR " + text); + } + /** + * Constructor + */ + public SystemSubMenuManagerForTesting(SystemBaseSubMenuAction parentAction, String text, String id) + { + super(parentAction, text, id); + System.out.println("SUBMENUMGR CTOR " + text); + } + /** + * 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); + 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+"'"); + prefix = " "; + super.appendToGroup(groupName, action); + prefix = ""; + } + /** + * 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+"'"); + prefix = " "; + super.appendToGroup(groupName, item); + prefix = ""; + } + /** + * 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 = " "; + 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); + } + else if (item instanceof SystemSubMenuManager) + { + SystemSubMenuManager submenu = (SystemSubMenuManager)item; + System.out.println("INSIDE ADD OF SUBMENUMGR(submenu="+submenu.getLabel()+") FOR THIS MNUMGR: "+label); + } + super.add(item); + prefix = ""; + } + + /** + * 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); + System.out.println(prefix+"...shell = "+shell+", viewer = "+viewer+", selection = "+selection); + String oldPrefix = prefix; + prefix += " "; + 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); + System.out.println(prefix+"...shell = "+shell+", viewer = "+viewer+", selection = "+selection); + 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); + System.out.println("...shell = "+shell+", viewer = "+viewer+", selection = "+selection); + super.cascadeAllInputs(submenu); + } +} \ 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 new file mode 100644 index 00000000000..89ec5bd12ae --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemTablePrintAction.java @@ -0,0 +1,523 @@ +/******************************************************************************** + * 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 java.text.DateFormat; +import java.util.Date; + +import org.eclipse.rse.ui.SystemPropertyResources; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.view.SystemTableView; +import org.eclipse.rse.ui.view.SystemTableViewProvider; +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(" "); + 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(""); + 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, " "); + 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 += "..."; + } + 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 += "..."; + rightOffset = offset; + } + + sbColumnHeader.insert(rightOffset, label); + } + + offset += columnWidth; + sbColumnHeader.insert(offset, " "); + offset++; + } + } + return sbColumnHeader.toString(); + } + + private String getHeaderSeparator() + { + StringBuffer separator = new StringBuffer(""); + if (_hasColumns) + { + for (int i = 0; i < _columnWidths.length; i++) + { + int width = _columnWidths[i]; + for (int t = 0; t < width; t++) + { + separator.append("-"); + } + + separator.append(" "); + } + } + + return separator.toString(); + } + + private String getTableFooter() + { + String footer = " * * * * * E N D O F L I S T I N G * * * * *"; + 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(" "); + } + + return blankLine.toString(); + } + + private String getLine(Object object, int numColumns) + { + StringBuffer line = new StringBuffer(""); + + SystemTableViewProvider lprovider = (SystemTableViewProvider) _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 += "..."; + } + + 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 += "..."; + rightOffset = offset; + } + + line.insert(rightOffset, columnText); + } + + offset += columnWidth; + line.insert(offset, " "); + offset++; + } + } + else + { + String columnText = lprovider.getColumnText(object, 0); + line.append(columnText); + } + + return line.toString(); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemTeamReloadAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemTeamReloadAction.java new file mode 100644 index 00000000000..6d0b30470b3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemTeamReloadAction.java @@ -0,0 +1,76 @@ +/******************************************************************************** + * 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.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.SystemResourceListener; +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.SystemResources; +import org.eclipse.rse.ui.messages.SystemMessageDialog; +import org.eclipse.swt.widgets.Shell; + + +/** + * The action allows users to refresh the entire Remote Systems 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(SystemPlugin.HELPPREFIX+"actn0009"); + } + + /** + * 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 = SystemPlugin.getTheSystemRegistry(); + SystemMessage confirmMsg = SystemPlugin.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/ui/actions/SystemTestFilterStringAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemTestFilterStringAction.java new file mode 100644 index 00000000000..d72f482a348 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemTestFilterStringAction.java @@ -0,0 +1,102 @@ +/******************************************************************************** + * 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.dialogs.Dialog; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.dialogs.SystemTestFilterStringDialog; +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; + protected SystemTestFilterStringDialog dlg; + + + /** + * 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. + *

    + * 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) + { + //if (dlg == null) // I hoped to reduce memory requirements by re-using but doesn't work. Phil + dlg = new SystemTestFilterStringDialog(shell, subsystem, filterString); + //else + //{ + //dlg.reset(subsystem, filterString); + //} + return dlg; + } + + /** + * Required by parent. We just return null. + */ + protected Object getDialogValue(Dialog dlg) + { + return null; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemUpdateConnectionAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemUpdateConnectionAction.java new file mode 100644 index 00000000000..41f61415d4e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemUpdateConnectionAction.java @@ -0,0 +1,75 @@ +/******************************************************************************** + * 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.dialogs.Dialog; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.dialogs.SystemUpdateConnectionDialog; +import org.eclipse.swt.widgets.Shell; + + +/** + * The action that displays the Change Connection dialog + * THIS DIALOG AND ITS ACTION ARE NO LONGER USED. THEY ARE REPLACED WITH A PROPERTIES DIALOG. + */ +public class SystemUpdateConnectionAction extends SystemBaseDialogAction + +{ + + /** + * Constructor for SystemUpdateConnectionAction + */ + public SystemUpdateConnectionAction(Shell parent) + { + super(SystemResources.ACTION_UPDATECONN_LABEL, SystemResources.ACTION_UPDATECONN_TOOLTIP, null, parent); + allowOnMultipleSelection(false); + setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE); + } + + /** + * 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 IHost); + } + + /** + * 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. + *

    + * 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) + { + return new SystemUpdateConnectionDialog(parent); + } + + /** + * Required by parent but we do not use it so return null; + */ + protected Object getDialogValue(Dialog dlg) + { + return null; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemViewExpandToAllAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemViewExpandToAllAction.java new file mode 100644 index 00000000000..12d56f9c718 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemViewExpandToAllAction.java @@ -0,0 +1,52 @@ +/******************************************************************************** + * 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.actions; + +import org.eclipse.rse.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.ui.actions.SystemViewExpandToBaseAction#getFilterString(Object) + */ + protected String getFilterString(Object selectedObject) + { + return null; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemViewExpandToBaseAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemViewExpandToBaseAction.java new file mode 100644 index 00000000000..635156636bb --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemViewExpandToBaseAction.java @@ -0,0 +1,99 @@ +/******************************************************************************** + * 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.resource.ImageDescriptor; +import org.eclipse.rse.ui.view.ISystemTree; +import org.eclipse.rse.ui.view.SystemView; +import org.eclipse.swt.widgets.Shell; + + +//import com.ibm.etools.systems.subsystems.*; + +/** + * 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; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemWorkOfflineAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemWorkOfflineAction.java new file mode 100644 index 00000000000..ad24aae6447 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemWorkOfflineAction.java @@ -0,0 +1,129 @@ +/******************************************************************************** + * 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.viewers.IStructuredSelection; +import org.eclipse.rse.core.ISystemTypes; +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.swt.widgets.Shell; + + +/** + * Action for switching RSE Connections offline + * + * @author yantzi + * @since Artemis 6.0 + */ +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(SystemPlugin.HELPPREFIX+"wofa0000"); + } + + /** + * 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() + { + IHost conn = (IHost)getFirstSelection(); + ISystemRegistry sr = SystemPlugin.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 + ISubSystem[] subsystems = sr.getSubSystems(conn); + if (subsystems != null) + { + boolean cancelled = false; + for (int i = 0; i < subsystems.length && !cancelled; i++) + { + try + { + subsystems[i].disconnect(getShell(), false); + } catch (InterruptedException e) { + // user cancelled disconnect + cancelled = true; + } catch (Exception e) { + SystemBasePlugin.logError("SystemWorkOfflineAction.run", e); + } + } + } + + // check that everything was disconnedted okay and this is not the local connection + if(sr.isAnySubSystemConnected(conn) && !ISystemTypes.SYSTEMTYPE_LOCAL.equals(conn.getSystemType())) + { + // backout changes, likely because user cancelled the disconnect + setChecked(false); + sr.setHostOffline(conn, false); + } + } + } + + + /* (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/ui/actions/SystemWorkWithProfilesAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemWorkWithProfilesAction.java new file mode 100644 index 00000000000..15d6a5580cd --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemWorkWithProfilesAction.java @@ -0,0 +1,56 @@ +/******************************************************************************** + * 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.core.SystemPerspectiveHelpers; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.view.team.SystemTeamViewPart; +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 = SystemPlugin.getTheSystemRegistry(); + setHelp(SystemPlugin.HELPPREFIX+"actnwwpr"); + } + + /** + * 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/ui/actions/TestPopupMenuAction1.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/TestPopupMenuAction1.java new file mode 100644 index 00000000000..bdee9f2fc6b --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/TestPopupMenuAction1.java @@ -0,0 +1,43 @@ +/******************************************************************************** + * 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.actions; +/** + * This is just a test action to ensure the popupMenus extension point works + * for adding popup menu actions to remote objects + */ +public class TestPopupMenuAction1 extends SystemAbstractPopupMenuExtensionAction +{ + + + + /** + * Constructor for TestPopupMenuAction1 + */ + public TestPopupMenuAction1() + { + super(); + } + + /** + * Called when the user selects this action + */ + public void run() + { + printTest(); + } + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..c0e4fbc4675 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/EnvironmentVariablesPromptDialog.java @@ -0,0 +1,248 @@ +/******************************************************************************** + * 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.rse.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.SystemWidgetHelpers; +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.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, systemType, invalidNameChars; + private boolean change; // Is this dialog for add or change + private String[] existingNames; + + /** + * Constructor for EnvironmentVariablesPromptDialog. + * @param shell + * @param title + */ + public EnvironmentVariablesPromptDialog(Shell shell, String title, String 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 + * @param title + * @param inputObject + */ + 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); + nameTextField.setToolTipText(SystemResources.RESID_SUBSYSTEM_ENVVAR_NAME_TOOLTIP); + if (name != null && !name.trim().equals("")) + { + 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); + valueTextField.setToolTipText(SystemResources.RESID_SUBSYSTEM_ENVVAR_VALUE_TOOLTIP); + if (value != null) + { + valueTextField.setText(value); + } + + if (!change) + SystemWidgetHelpers.setCompositeHelp(parent, SystemPlugin.HELPPREFIX + "envv0001"); + else + SystemWidgetHelpers.setCompositeHelp(parent, SystemPlugin.HELPPREFIX + "envv0002"); + + + // Set name and value limits for known system types + if (systemType != null) + { + if (systemType.equals("iSeries")) + { + nameTextField.setTextLimit(128); + valueTextField.setTextLimit(1024); + } + else if (systemType.equals("Windows")) + { + nameTextField.setTextLimit(300); + valueTextField.setTextLimit(1024); + } + else if (systemType.equals("Local")) + { + if (System.getProperty("os.name").toLowerCase().indexOf("win") != -1) + { + 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("")) + { + 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(SystemPlugin.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 = SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_ENVVAR_DUPLICATE); + msg.makeSubstitution(nameStr); + setErrorMessage(msg); + nameTextField.setFocus(); + return false; + } + } + } + } + + name = nameStr; + value = valueTextField.getText(); + return true; + } + else + { + setErrorMessage(SystemPlugin.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("")) + { + 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/ISignonValidator.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISignonValidator.java new file mode 100644 index 00000000000..54c1a915118 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISignonValidator.java @@ -0,0 +1,48 @@ +/******************************************************************************** + * 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.rse.model.SystemSignonInformation; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.swt.widgets.Shell; + + +/** + * Interace for providing a signon validator to the password prompt dialog. + */ +public interface ISignonValidator +{ + + /** + * Used by ISystemPasswordPromptDialog to verify if the password entered by the user + * is correct. + * + * @return null if the password is valid, otherwise a SystemMessage is returned that can + * be displayed to the end user. + */ + public SystemMessage isValid(ISystemPasswordPromptDialog dialog, String userid, String password); + + /** + * Verify if persisted userid and password are still valid + * + * @param Shell, if null the validator will run headless, if not null then the validator + * may use the shell to prompt the user (for example, if the password has expired.) + * + * @return true if signonInfo contains a valid signon, false otherwise. + */ + public boolean isValid(Shell shell, SystemSignonInformation signonInfo); +} \ 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 new file mode 100644 index 00000000000..cdcb64ab730 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemPasswordPromptDialog.java @@ -0,0 +1,100 @@ +/******************************************************************************** + * 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.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. + *

    + * 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(ISignonValidator 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 new file mode 100644 index 00000000000..7c204f143a6 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemPromptDialog.java @@ -0,0 +1,57 @@ +/******************************************************************************** + * 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; + + +/** + * 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(); + + /** + * 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 new file mode 100644 index 00000000000..8a86b0cb2d5 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemTypedObject.java @@ -0,0 +1,42 @@ +/******************************************************************************** + * 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/SystemControlEnableState.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemControlEnableState.java new file mode 100644 index 00000000000..23b35feb392 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemControlEnableState.java @@ -0,0 +1,155 @@ +/******************************************************************************** + * 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.ArrayList; +import java.util.List; + +import org.eclipse.rse.ui.view.SystemPropertySheetForm; +import org.eclipse.rse.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: Control); + * null if none. + */ + private List exceptions = null; + + /** + * List of saved states (element type: ItemState). + */ + 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: Control), or null 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: Control) + * @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(); + } + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemCopyProfileDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemCopyProfileDialog.java new file mode 100644 index 00000000000..1137865983d --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemCopyProfileDialog.java @@ -0,0 +1,280 @@ +/******************************************************************************** + * 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.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +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.rse.ui.view.ISystemPropertyConstants; +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 + implements ISystemMessages, ISystemPropertyConstants +{ + 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 = SystemPlugin.getTheSystemRegistry().getSystemProfileManager().getProfileNameValidator((String)null); + //pack(); + setHelp(SystemPlugin.HELPPREFIX+"drnp0000"); + } + /** + * 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; + } + + + /** + * 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, SystemPlugin.HELPPREFIX+"drnp0002", SystemPlugin.HELPPREFIX+"drnp0000"); + SystemWidgetHelpers.setHelp(newName, SystemPlugin.HELPPREFIX+"drnp0002"); + //SystemWidgetHelpers.setHelp(makeActiveCB, SystemPlugin.HELPPREFIX+"drnp0003", SystemPlugin.HELPPREFIX+"drnp0000"); + SystemWidgetHelpers.setHelp(makeActiveCB, SystemPlugin.HELPPREFIX+"drnp0003"); + + 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 ISystemValidator object. + * If the ISystemValidator 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; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteDialog.java new file mode 100644 index 00000000000..8470d6f54e0 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteDialog.java @@ -0,0 +1,293 @@ +/******************************************************************************** + * 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.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.core.SystemAdapterHelpers; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.SystemWidgetHelpers; +import org.eclipse.rse.ui.messages.ISystemMessageLine; +import org.eclipse.rse.ui.view.ISystemPropertyConstants; +import org.eclipse.rse.ui.view.ISystemViewElementAdapter; +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. + *

    + * This is a re-usable dialog that you can use directly, or via the {@link org.eclipse.rse.ui.actions.SystemCommonDeleteAction} + * action. It asks the user to confirm the deletion of the input selection. + *

    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.ui.actions.SystemCommonDeleteAction + */ +public class SystemDeleteDialog extends SystemPromptDialog + implements ISystemMessages, ISystemPropertyConstants, + 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[] = { + "", + 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(SystemPlugin.HELPPREFIX+"ddlt0000"); + } + + /** + * 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 != null && 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 = (Label)SystemWidgetHelpers.createVerbage(composite, promptLabel, nbrColumns, false, 200); + } + + // WARNING + if (warningMessage != null) + { + // filler line + SystemWidgetHelpers.createLabel(composite, "", nbrColumns); + // 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); + imageLabel.setToolTipText(warningTip); + } + // filler line + SystemWidgetHelpers.createLabel(composite, "", nbrColumns); + } + + // 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 getAdapter(Object o) + { + return SystemAdapterHelpers.getAdapter(o); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteTableProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteTableProvider.java new file mode 100644 index 00000000000..26c7948548c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteTableProvider.java @@ -0,0 +1,173 @@ +/******************************************************************************** + * 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.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 = ""; + 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(org.eclipse.jface.viewers.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/ui/dialogs/SystemDeleteTableRow.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteTableRow.java new file mode 100644 index 00000000000..65a7c7d9905 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteTableRow.java @@ -0,0 +1,202 @@ +/******************************************************************************** + * 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.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.SystemAdapterHelpers; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; +import org.eclipse.rse.ui.view.ISystemViewElementAdapter; +import org.eclipse.rse.ui.view.SystemViewResources; + + +/** + * 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 = getAdapter(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 = getAdapter(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); + SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FOLDER_ID); + else if (element instanceof IFile) + this.imageDescriptor = SystemPlugin.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 getAdapter() + { + 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 getAdapter(Object o) + { + return SystemAdapterHelpers.getAdapter(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/ui/dialogs/SystemFilterTableDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemFilterTableDialog.java new file mode 100644 index 00000000000..dff540ed61f --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemFilterTableDialog.java @@ -0,0 +1,417 @@ +/******************************************************************************** + * 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.dialogs; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.TableLayout; +import org.eclipse.jface.window.Window; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.services.clientserver.StringComparePatternMatcher; +import org.eclipse.rse.ui.SystemPropertyResources; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.SystemWidgetHelpers; +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.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +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; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableItem; +import org.eclipse.swt.widgets.Widget; + + +/** + * @author dmcknigh + */ +public class SystemFilterTableDialog extends SystemPromptDialog implements KeyListener, IDoubleClickListener +{ + class InitialInputRunnable implements Runnable + { + public void run() + { + initInput(); + } + } + + private SystemTableView _viewer; + private Table table; + private List _inputs; + private IAdaptable _currentInput; + private String _lastFilter; + private String _lastType; + + private String[] _viewFilterStrings; + private String[] _typeFilterStrings; + + private ISubSystem _subSystem; + + private Combo _inputText; + private Button _browseButton; + + private Combo _typeCombo; + private Combo _filterCombo; + + private String selected = null; + private boolean _allowInputChange = true; + + + public SystemFilterTableDialog(Shell shell, String title, ISubSystem subSystem, String input, String[] viewFilterStrings, String[] typeFilterStrings, boolean allowInputChange) + { + super(shell, title); + _subSystem = subSystem; + setNeedsProgressMonitor(true); + _inputs = new ArrayList(); + _inputs.add(input); + _viewFilterStrings = viewFilterStrings; + _typeFilterStrings = typeFilterStrings; + _allowInputChange = allowInputChange; + } + + + public SystemFilterTableDialog(Shell shell, String title, ISubSystem subSystem, List inputs, String[] viewFilterStrings, String[] typeFilterStrings, boolean allowInputChange) + { + super(shell, title); + _subSystem = subSystem; + setNeedsProgressMonitor(true); + _inputs = inputs; + + _viewFilterStrings = viewFilterStrings; + _typeFilterStrings = typeFilterStrings; + _allowInputChange = allowInputChange; + } + + + protected ISystemViewElementAdapter getAdatperFor(IAdaptable obj) + { + return (ISystemViewElementAdapter)obj.getAdapter(ISystemViewElementAdapter.class); + } + + /* (non-Javadoc) + * @see org.eclipse.rse.core.ui.dialogs.SystemPromptDialog#createInner(org.eclipse.swt.widgets.Composite) + */ + protected Control createInner(Composite parent) + { + Composite c = new Composite(parent, SWT.NONE); + + GridLayout layout = new GridLayout(); + c.setLayout(layout); + layout.numColumns =1; + GridData gd = new GridData(GridData.FILL_BOTH); + c.setLayoutData(gd); + + Composite inputC = new Composite(c, SWT.NONE); + GridLayout ilayout = new GridLayout(); + inputC.setLayout(ilayout); + + if (_allowInputChange) + { + ilayout.numColumns =4; + } + else + { + ilayout.numColumns = 3; + } + + GridData igd = new GridData(GridData.FILL_BOTH); + inputC.setLayoutData(igd); + + // input + Label objFilterLabel= SystemWidgetHelpers.createLabel(inputC, "Input"); + _inputText = new Combo(inputC, SWT.DROP_DOWN | SWT.READ_ONLY); + _inputText.addListener(SWT.Selection, this); + + + for (int i = 0; i < _inputs.size(); i++) + { + String input = (String)_inputs.get(i); + if (input != null) + { + _inputText.add(input); + } + } + _inputText.select(0); + + if (_allowInputChange) + { + _browseButton = SystemWidgetHelpers.createPushButton(inputC, SystemResources.BUTTON_BROWSE, this); + } + + Composite filterC = new Composite(c, SWT.NONE); + GridLayout flayout = new GridLayout(); + filterC.setLayout(flayout); + flayout.numColumns =4; + + GridData fgd = new GridData(GridData.FILL_BOTH); + filterC.setLayoutData(fgd); + + // type filter strings + Label typeFilterLabel= SystemWidgetHelpers.createLabel(filterC, SystemPropertyResources.RESID_PROPERTY_TYPE_LABEL); + _typeCombo = new Combo(filterC, SWT.DROP_DOWN | SWT.READ_ONLY); + for (int i = 0; i < _typeFilterStrings.length; i++) + { + if (null != _typeFilterStrings[i]) + { + _typeCombo.add(_typeFilterStrings[i]); + } + } + _typeCombo.select(0); + _typeCombo.addKeyListener(this); + _typeCombo.addListener(SWT.Selection, this); + + // view filter strings + Label viewFilterLabel= SystemWidgetHelpers.createLabel(filterC, SystemResources.RESID_FILTERSTRING_STRING_LABEL); + _filterCombo = SystemWidgetHelpers.createCombo(filterC, this); + _filterCombo.setText(_viewFilterStrings[0]); + for (int i = 0; i < _viewFilterStrings.length; i++) + { + if (null != _viewFilterStrings[i]) + { + _filterCombo.add(_viewFilterStrings[i]); + } + } + _filterCombo.addKeyListener(this); + + // table + table = new Table(c, SWT.BORDER); + _viewer = new SystemTableView(table, this); + _viewer.showColumns(false); + _viewer.addDoubleClickListener(this); + + TableLayout tlayout = new TableLayout(); + table.setLayout(tlayout); + table.setHeaderVisible(false); + table.setLinesVisible(false); + + GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); + gridData.heightHint = 200; + gridData.widthHint = 200; + table.setLayoutData(gridData); + + + + + enableOkButton(false); + + return c; + } + + + protected void initInput() + { + if (_currentInput == null) + { + String input = (String)_inputs.get(0); + try + { + _currentInput = (IAdaptable)_subSystem.getObjectWithAbsoluteName(input); + + ISystemViewElementAdapter adapter = getAdatperFor(_currentInput); + if (adapter != null) + { + applyViewFilter(false); + _viewer.setInput(_currentInput); + _viewer.refresh(); + } + } + catch (Exception e) + { + + } + } + } + + protected void applyViewFilter(boolean refresh) + { + String[] vfilters = new String[1]; + + String typeFilter = _typeCombo.getText().toUpperCase(); + + vfilters[0] = _filterCombo.getText().toUpperCase(); + if (!vfilters[0].endsWith("*")) + vfilters[0] += "*"; + + if (_lastFilter != vfilters[0]) + { + StringComparePatternMatcher matcher = new StringComparePatternMatcher(_lastFilter != null ?_lastFilter.toUpperCase() : null); + if (_lastFilter == null || !matcher.stringMatches(vfilters[0])) + { + _lastFilter = vfilters[0]; + _lastType = typeFilter; + if (_currentInput != null) + { + getAdatperFor(_currentInput).setFilterString(_lastFilter); + } + + } + else + { + _lastFilter = vfilters[0]; + _lastType = typeFilter; + } + ((SystemTableViewProvider)_viewer.getContentProvider()).flushCache(); + String[] tfilters = new String[1]; + tfilters[0] = _lastFilter + typeFilter; + _viewer.setViewFilters(tfilters); + } + else if (_lastType != typeFilter) + { + _lastType = typeFilter; + String[] tfilters = new String[1]; + tfilters[0] = _lastFilter + typeFilter; + _viewer.setViewFilters(tfilters); + } + + } + + + + /* (non-Javadoc) + * @see org.eclipse.rse.core.ui.dialogs.SystemPromptDialog#getInitialFocusControl() + */ + protected Control getInitialFocusControl() + { + Display.getCurrent().asyncExec(new InitialInputRunnable()); + //initInput(); + return _filterCombo; + } + + public void handleEvent(Event e) + { + Widget source = e.widget; + + if (source == _typeCombo) + { + applyViewFilter(true); + } + else if (source == _filterCombo) + { + if (_lastFilter == null || !_lastFilter.equals(_filterCombo.getText() + "*")) + { + applyViewFilter(true); + } + } + else if (source == _browseButton) + { + SystemSelectAnythingDialog dlg = new SystemSelectAnythingDialog(getShell(), SystemResources.ACTION_SELECT_INPUT_DLG); + dlg.setInputObject(_currentInput); + if (dlg.open() == Window.OK) + { + _currentInput = (IAdaptable)dlg.getSelectedObject(); + ISystemViewElementAdapter adapter = getAdatperFor(_currentInput); + String objName = adapter.getAbsoluteName(_currentInput); + if (!_inputs.contains(objName)) + { + _inputs.add(0, objName); + } + + _inputText.setText(objName); + applyViewFilter(false); + _viewer.setInput(_currentInput); + _viewer.refresh(); + } + } + else if (source == _inputText) + { + int selected = _inputText.getSelectionIndex(); + String inputStr = (String)_inputs.get(selected); + try + { + IAdaptable input = (IAdaptable)_subSystem.getObjectWithAbsoluteName(inputStr); + if (input != _currentInput) + { + _currentInput = input; + ISystemViewElementAdapter adapter = getAdatperFor(_currentInput); + _inputText.setText(inputStr); + applyViewFilter(false); + _viewer.setInput(_currentInput); + _viewer.refresh(); + } + } + catch (Exception e2) + { + } + } + } + + public void keyPressed(KeyEvent e) + { + } + + public void keyReleased(KeyEvent e) + { + if (e.widget == _filterCombo) + { + String vfilter = _filterCombo.getText(); + if (!vfilter.endsWith("*")) + vfilter += "*"; + if (_lastFilter == null || !_lastFilter.equals(vfilter)) + { + //System.out.println("handling event"); + // System.out.println("\tchar ="+e.character); + applyViewFilter(true); + _filterCombo.clearSelection(); + _filterCombo.setFocus(); + } + } + } + public void doubleClick(DoubleClickEvent event) + { + IStructuredSelection s = (IStructuredSelection) event.getSelection(); + Object element = s.getFirstElement(); + if (element == null) + return; + processOK(); + close(); + } + + + protected boolean processOK() + { + TableItem[] thisRow = table.getSelection(); + if (null != thisRow && thisRow.length == 1) + { + selected = thisRow[0].getText(0); + } + return true; + } + + public String getSelected() + { + return selected; + } + + + + + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPersistancePrompt.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPersistancePrompt.java new file mode 100644 index 00000000000..77703884d92 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPersistancePrompt.java @@ -0,0 +1,338 @@ +/******************************************************************************** + * 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.List; + +import org.eclipse.rse.core.PasswordPersistenceManager; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.model.SystemSignonInformation; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.SystemWidgetHelpers; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + + +/** + * SystemPasswordPersistancePrompt is used with the save password preference page + * to prompt the user to add or change password information. + */ +public final class SystemPasswordPersistancePrompt extends SystemPromptDialog implements ModifyListener +{ + + + + private Text hostname, userid, password, passwordVerify; + private Combo systemType; + private SystemSignonInformation signonInfo; + private boolean change; + private String originalHostname, originalUserid, originalSystemType; + + private List existingEntries; + + /** + * Constructor for SystemPasswordPersistancePrompt. + * @param shell + * @param title + */ + public SystemPasswordPersistancePrompt(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); + + // 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 + SystemWidgetHelpers.createLabel(page, SystemResources.RESID_PREF_SIGNON_SYSTYPE_LABEL, SystemResources.RESID_PREF_SIGNON_SYSTYPE_TOOLTIP); + systemType = SystemWidgetHelpers.createReadonlyCombo(page, null); + systemType.setItems(PasswordPersistenceManager.getInstance().getRegisteredSystemTypes()); + if (originalSystemType != null) + systemType.setText(originalSystemType); + 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_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("")) + { + setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD)); + okButton.setEnabled(false); + hostname.setFocus(); + return false; + } + + String sSystemType = systemType.getText(); + if (sSystemType == null || sSystemType.trim().equals("")) + { + setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD)); + okButton.setEnabled(false); + systemType.setFocus(); + return false; + } + + String sUserID = userid.getText(); + if (sUserID == null || sUserID.trim().equals("")) + { + setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD)); + okButton.setEnabled(false); + userid.setFocus(); + return false; + } + + String sPwd1 = password.getText(); + if (sPwd1 == null || sPwd1.trim().equals("")) + { + setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD)); + okButton.setEnabled(false); + password.setFocus(); + return false; + } + + String sPwd2 = passwordVerify.getText(); + if (sPwd2 == null || sPwd2.trim().equals("")) + { + setErrorMessage(SystemPlugin.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(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_MISMATCH)); + okButton.setEnabled(false); + password.setFocus(); + password.setSelection(0, sPwd1.length()); + return false; + } + + signonInfo = new SystemSignonInformation(hostname.getText(), userid.getText(), password.getText(), systemType.getText()); + + if (change) + { + if (exists(signonInfo.getHostname(), signonInfo.getUserid(), signonInfo.getSystemType())) + { + if (!signonInfo.getSystemType().equals(originalSystemType) || + !signonInfo.getHostname().equalsIgnoreCase(originalHostname) || + //!signonInfo.getHostname().equalsIgnoreCase(SystemPlugin.getQualifiedHostName(originalHostname)) || + !signonInfo.getUserid().equals(originalUserid)) + { + // User changed hostname, systemtype or userid and the change conflicts with an existing entry + SystemMessage msg = SystemPlugin.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 = SystemPlugin.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, String 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, SystemPlugin.HELPPREFIX + "pwdi0002"); + password.setFocus(); + } + else + { + SystemWidgetHelpers.setCompositeHelp(parent, SystemPlugin.HELPPREFIX + "pwdi0001"); + hostname.setFocus(); + } + } + + /** + * Set the input data to prepopulate the change dialog + */ + public void setInputData(String 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("")) + { + setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD)); + hostname.setFocus(); + okButton.setEnabled(false); + } + else if (e.getSource() == userid && userid.getText().trim().equals("")) + { + setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD)); + userid.setFocus(); + okButton.setEnabled(false); + } + else if (e.getSource() == systemType && systemType.getText().trim().equals("")) + { + setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD)); + systemType.setFocus(); + okButton.setEnabled(false); + } + else if (e.getSource() == password && password.getText().trim().equals("")) + { + setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD)); + password.setFocus(); + okButton.setEnabled(false); + } + else if (e.getSource() == passwordVerify && passwordVerify.getText().trim().equals("")) + { + setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD)); + passwordVerify.setFocus(); + okButton.setEnabled(false); + } + else + { + clearErrorMessage(); + + if (hostname.getText().trim().equals("") || + userid.getText().trim().equals("") || + systemType.getText().trim().equals("") || + password.getText().trim().equals("") || + passwordVerify.getText().trim().equals("")) + { + // 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(); + } + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..0c8c0207c88 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPromptDialog.java @@ -0,0 +1,524 @@ +/******************************************************************************** + * 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.rse.core.SystemPlugin; +import org.eclipse.rse.core.SystemPreferencesManager; +import org.eclipse.rse.core.subsystems.IConnectorService; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +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 ISystemMessages, ISystemPasswordPromptDialog +{ + + // lables 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; + + protected Text textPassword; + + // 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 then non-editable entry fields + //protected Text textSystemType, textHostName, textUserId; + protected Text textUserId; + + protected Button userIdPermanentCB, savePasswordCB; + //protected String userId,password; + protected String originalUserId; + protected String userId, password; + protected boolean userIdPermanent = false; + protected boolean savePassword = false; + protected boolean forceToUpperCase; + protected boolean userIdChanged = false; + protected boolean userIdOK = true; + protected boolean passwordOK = false; + protected boolean noValidate = false; + protected ISystemValidator userIdValidator, passwordValidator; + protected ISignonValidator signonValidator; + protected SystemMessage errorMessage = null; + + /** + * Constructor for SystemPasswordPromptDialog + */ + public SystemPasswordPromptDialog(Shell shell) + { + super(shell, SystemResources.RESID_PASSWORD_TITLE); + //pack(); + setHelp(SystemPlugin.HELPPREFIX+"pwdp0000"); + } + /** + * 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. + *

    + * This must be called right after instantiating this dialog. + */ + public void setSystemInput(IConnectorService systemObject) + { + setInputObject(systemObject); + } + /** + * Call this to specify a validator for the userId. It will be called per keystroke. + */ + public void setUserIdValidator(ISystemValidator v) + { + userIdValidator = v; + } + /** + * Call this to specify a validator for the password. It will be called per keystroke. + */ + public void setPasswordValidator(ISystemValidator v) + { + passwordValidator = v; + } + /** + * Call this to specify a validator for the signon. It will be called when the user presses OK. + */ + public void setSignonValidator(ISignonValidator v) + { + signonValidator = v; + } + /** + * Call this to force the userId and password to uppercase + */ + public void setForceToUpperCase(boolean force) + { + this.forceToUpperCase = force; + } + /** + * Call this to query the force-to-uppercase setting + */ + public boolean getForceToUpperCase() + { + return forceToUpperCase; + } + /** + * @see SystemPromptDialog#getInitialFocusControl() + */ + protected Control getInitialFocusControl() + { + okButton.setEnabled(false); + + + if (textUserId.getText().length()==0) + return textUserId; + else + { + if (password != null) + { + validatePasswordInput(); + textPassword.selectAll(); + } + return textPassword; + } + } + + + /** + * @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); + + IConnectorService systemObject = (IConnectorService)getInputObject(); + + // System type + //textSystemType = SystemWidgetHelpers.createLabeledReadonlyTextField( + // composite_prompts,rb,RESID_CONNECTION_SYSTEMTYPE_READONLY_ROOT); + String text = SystemWidgetHelpers.appendColon(SystemResources.RESID_CONNECTION_SYSTEMTYPE_READONLY_LABEL); + Label label = SystemWidgetHelpers.createLabel(composite_prompts, text); + GridData gd = new GridData(); + gd.heightHint = LABEL_HEIGHT; + label.setLayoutData(gd); + + label = SystemWidgetHelpers.createLabel(composite_prompts, systemObject.getHostType()); + gd = new GridData(); + gd.heightHint = LABEL_HEIGHT; + label.setLayoutData(gd); + + // Host name + //textHostName = SystemWidgetHelpers.createLabeledReadonlyTextField( + // composite_prompts, rb, ISystemConstants.RESID_CONNECTION_HOSTNAME_READONLY_ROOT); + text = SystemWidgetHelpers.appendColon(SystemResources.RESID_CONNECTION_HOSTNAME_READONLY_LABEL); + label = SystemWidgetHelpers.createLabel(composite_prompts, text); + gd = new GridData(); + gd.heightHint = LABEL_HEIGHT; + label.setLayoutData(gd); + label = SystemWidgetHelpers.createLabel(composite_prompts, systemObject.getHostName()); + gd = new GridData(); + gd.heightHint = LABEL_HEIGHT; + label.setLayoutData(gd); + + // UserId + textUserId = SystemWidgetHelpers.createLabeledTextField( + composite_prompts,this,SystemResources.RESID_CONNECTION_USERID_LABEL, SystemResources.RESID_CONNECTION_USERID_TIP); + + // Password prompt + textPassword = SystemWidgetHelpers.createLabeledTextField( + composite_prompts,this,SystemResources.RESID_PASSWORD_LABEL, 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 + SystemWidgetHelpers.createLabel(composite_prompts, ""); + 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 + SystemWidgetHelpers.createLabel(composite_prompts, ""); + savePasswordCB = SystemWidgetHelpers.createCheckBox( + composite_prompts, 1, this, SystemResources.RESID_PASSWORD_SAVE_LABEL, SystemResources.RESID_PASSWORD_SAVE_TOOLTIP); + savePasswordCB.setSelection(savePassword); + // disable until the user enters something for consistency with the save user ID checkbox + savePasswordCB.setEnabled(false); + + initializeInput(); + + // add keystroke listeners... + textUserId.addModifyListener( + new ModifyListener() { + public void modifyText(ModifyEvent e) { + validateUserIdInput(); + } + } + ); + textPassword.addModifyListener( + new ModifyListener() { + public void modifyText(ModifyEvent e) { + validatePasswordInput(); + } + } + ); + + + //SystemWidgetHelpers.setHelp(composite, SystemPlugin.HELPPREFIX+"pwdp0000"); + return composite; + } + +// yantzi: artemis 6.0 not required, the Window class handles ESC processing +// /** +// * @see SystemPromptDialog#createContents(Composite) +// */ +// protected Control createContents(Composite parent) +// { +// //System.out.println("INSIDE CREATECONTENTS"); +// Control c = super.createContents(parent); +// // Listen for ESC keypress, simulate the user pressing +// // the cancel button +// +// KeyListener keyListener = new KeyAdapter() { +// public void keyPressed(KeyEvent e) { +// if (e.character == SWT.ESC) { +// buttonPressed(CANCEL_ID); +// } +// } +// }; +// +// textUserId.addKeyListener(keyListener); +// textPassword.addKeyListener(keyListener); +// userIdPermanentCB.addKeyListener(keyListener); +// okButton.addKeyListener(keyListener); +// cancelButton.addKeyListener(keyListener); +// +// return c; +// } + + + /** + * Init values using input data + */ + protected void initializeInput() + { + IConnectorService systemObject = (IConnectorService)getInputObject(); + //textSystemType.setText(systemObject.getSystemType()); + //textHostName.setText(systemObject.getHostName()); + originalUserId = systemObject.getUserId(); + if ((originalUserId != null) && (originalUserId.length()>0)) + { + //textUserId.setEditable(false); + //textUserId.setEnabled(false); + textUserId.setText(originalUserId); + } + else + { + // added by phil: if we don't prompt for userId at new connection time, + // then we should default here to the preferences setting for the user id, + // by SystemType... + String preferencesUserId = SystemPreferencesManager.getPreferencesManager().getDefaultUserId(systemObject.getHostType()); + if (preferencesUserId != null) + textUserId.setText(preferencesUserId); + originalUserId = ""; + } + + if (password != null) + { + textPassword.setText(password); + } + + } + /** + * Return the userId entered by user + */ + private String internalGetUserId() + { + userId = textUserId.getText().trim(); + return userId; + } + + /** + * Return the password entered by user + */ + private String internalGetPassword() + { + password = textPassword.getText().trim(); + return password; + } + /** + * Return true if the user elected to make the changed user Id a permanent change. + */ + private boolean internalGetIsUserIdChangePermanent() + { + userIdPermanent = userIdPermanentCB.getSelection(); + return userIdPermanent; + } + /** + * Return true if the user elected to save the password + */ + private boolean internalGetIsSavePassword() + { + savePassword = savePasswordCB.getSelection(); + return savePassword; + } + + + /** + * This hook method is called whenever the text changes in the user Id input field. + * The default implementation delegates the request to an ISystemValidator object. + * If the ISystemValidator reports an error the error message is displayed + * in the Dialog's message line. + * @see #setUserIdValidator(ISystemValidator) + */ + protected SystemMessage validateUserIdInput() + { + if (noValidate) + return null; + clearErrorMessage(); + errorMessage= null; + String userId = internalGetUserId(); + userIdChanged = !userId.equals(originalUserId); + userIdPermanentCB.setEnabled(userIdChanged); + if (userIdValidator != null) + errorMessage= userIdValidator.validate(userId); + else if (userId.equals("")) + errorMessage = SystemPlugin.getPluginMessage(MSG_VALIDATE_USERID_EMPTY); + userIdOK = (errorMessage == null); + if (!userIdOK) + { + okButton.setEnabled(false); + setErrorMessage(errorMessage); + } + else + okButton.setEnabled(passwordOK); + return errorMessage; + } + + /** + * This hook method is called whenever the text changes in the password input field. + * The default implementation delegates the request to an ISystemValidator object. + * If the ISystemValidator reports an error the error message is displayed + * in the Dialog's message line. + * @see #setPasswordValidator(ISystemValidator) + */ + protected SystemMessage validatePasswordInput() + { + // yantzi: artemis 6.0, disable save checkbox when blank + savePasswordCB.setEnabled(!internalGetPassword().equals("")); + + if (noValidate) + return null; + clearErrorMessage(); + errorMessage= null; + String password = internalGetPassword(); + if (passwordValidator != null) + errorMessage= passwordValidator.validate(password); + else if (password.equals("")) + errorMessage = SystemPlugin.getPluginMessage(MSG_VALIDATE_PASSWORD_EMPTY); + passwordOK = (errorMessage == null); + if (!passwordOK) + { + setErrorMessage(errorMessage); + okButton.setEnabled(false); + } + else + okButton.setEnabled(userIdOK); + return errorMessage; + } + + /** + * Return the userId entered by user + */ + public String getUserId() + { + return userId; + } + + /** + * Return the password entered by user + */ + public String getPassword() + { + return password; + } + + /** + * Sets the password + */ + 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. + */ + public void setSavePassword(boolean save) + { + savePassword = save; + } + /** + * Verifies all input. + * @return true if there are no errors in the user input + */ + protected boolean verify() + { + SystemMessage errMsg = null; + Control controlInError = null; + clearErrorMessage(); + errorMessage = null; + errMsg = validateUserIdInput(); + if (errMsg != null) + controlInError = textUserId; + else + { + errMsg = validatePasswordInput(); + if (errMsg != null) + controlInError = textPassword; + } + if (errMsg != null) + controlInError.setFocus(); // validate methods already displayed error message + return (errMsg == null); + } + + /** + * Called when user presses OK button. + * Return true to close dialog. + * Return false to not close dialog. + */ + protected boolean processOK() + { + //busyCursor = new Cursor(getShell().getDisplay(), SWT.CURSOR_WAIT); + //getShell().setCursor(busyCursor); + setBusyCursor(true); // phil + + password = internalGetPassword(); + userId = internalGetUserId(); + userIdPermanent = internalGetIsUserIdChangePermanent(); + savePassword = internalGetIsSavePassword(); + if (forceToUpperCase) + { + userId = userId.toUpperCase(); + password = password.toUpperCase(); + noValidate = true; + textUserId.setText(userId); + textPassword.setText(password); + noValidate = false; + } + + boolean closeDialog = verify(); + + //getShell().setCursor(null); + //busyCursor.dispose(); + setBusyCursor(false); // phil + + // If all inputs are OK then verify signon + if (closeDialog && (signonValidator != null)) + { + SystemMessage msg = signonValidator.isValid(this, userId, password); + if (msg != null) + { + closeDialog = false; + setErrorMessage(msg); + } + } + + 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 new file mode 100644 index 00000000000..9d59615b30a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPromptDialog.java @@ -0,0 +1,1709 @@ +/******************************************************************************** + * 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.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.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.SystemPlugin; +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.SystemResources; +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). + *

    + * By default we configure the dialog as modal. If you do not want this, + * call setBlockOnOpen(false) after instantiating. + *

    + * This base class offers the following ease-of-use features: + *

      + *
    • automatic support for typical buttons OK, Browse and Cancel. + *
        + *
      • just override the processOk, processBrowse and processCancel methods to process them + *
      • constructor option whether to enable Browse or not + *
      • ability to override default labels for all three. + *
      + *
    • automatic support for a message line + *
        + *
      • can turn it off + *
      • methods for writing messages to the message line + *
      + *
    • override just one method (createInner) to populate the client area + *
    • support for automatically assigning unique mnemonics to all buttons + *
        + *
      • easier to code, easier to translate + *
      • this is always done for you, so do not put your own mnemonics in your button text! + *
      + *
    • support for an input object for change mode vs "new" mode: + *
        + *
      • in change mode, callers pass this in via ctor or setInputObject method + *
      • in your child class, get it via inherited getInputObject and cast to what it is you are expecting + *
      + *
    • support for output object: + *
        + *
      • when ok pressed, built up the output object and then call inherited setOutputObject object method + *
      • dialog callers can then retrieve it via getOuputObject method. + *
      + *
    • support for {@link #wasCancelled()} method so callers can easily determine how user exited the dialog + *
    • special affinity if you use an imbedded WorkWith widget: + *
        + *
      • call WorkWith's setPromptDialog(this) method to tell it the parent dialog is a PromptDialog + *
      • WorkWith widget will use PromptDialog's message line vs its own + *
      • WorkWith widget will know how to reassign mnemonics for its buttons when style is switched. + *
      + *
    • optional support (mri) for additional buttons (which your code handles): + *
        + *
      • Add + *
      • Browse + *
      • Test + *
      • Details>> + *
      + *
    • optional support for a built-in progress monitor just like wizards have. Call {@link #setNeedsProgressMonitor(boolean)} + *
    • a simple {@link #setBusyCursor(boolean)} method to toggle the cursor between busy and normal + *
    + * + *

    To use this class:

    + *
      + *
    1. Subclass it, specifying the dialog title in the constructor. Optionally, also call {@link #setHelp(String)} to set the dialog's help in the constructor. + *
    2. Override {@link #createInner(Composite)} to populate the contents + *
    3. Override {@link #processOK()} to process the pressing of the OK button + *
    + *

    For error checking, add modify listeners to entry fields and if needed selection listeners to buttons, then in your event handler

    + *
      + *
    1. Call {@link #setErrorMessage(SystemMessage)} to display an error if detected. Pass null to clear previous error. + *
    2. Call {@link #setPageComplete(boolean)} with true if there are no errors and all required data is supplied. This enables/disables OK. + *
    3. The same two error-reporting strategies described in {@link org.eclipse.rse.ui.wizards.AbstractSystemWizardPage} apply here. + *
    + */ +public abstract class SystemPromptDialog + extends org.eclipse.jface.dialogs.Dialog + implements Listener, IDialogConstants, ISystemPromptDialog, + ISystemMessageLine, org.eclipse.jface.dialogs.IDialogPage, IRunnableContext, Runnable +{ + + protected boolean okPressed = 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 Shell overallShell = null; + protected Composite parentComposite, dialogAreaComposite; + protected Composite buttonsComposite; + protected Button okButton, cancelButton, testButton, browseButton, addButton, detailsButton; + protected String title, labelOk, labelBrowse, labelTest, labelCancel, labelAdd, labelDetailsShow, labelDetailsHide; + protected String tipOk, tipBrowse, tipTest, tipCancel, tipAdd, tipDetailsShow, tipDetailsHide; + 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; + + 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 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()}. + *

    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. + *

    + * 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); + } + + /** + * For explicitly setting input object. Called by SystemDialogAction + */ + public void setInputObject(Object inputObject) + { + this.inputObject = inputObject; + } + /** + * For explicitly getting input object + */ + public Object getInputObject() + { + return inputObject; + } + + /** + * For explicitly getting output object after dialog is dismissed. Set by the + * dialog's processOK method. + */ + public Object getOutputObject() + { + return outputObject; + } + + /** + * Allow caller to determine if window was cancelled or not. + */ + public boolean wasCancelled() + { + return !okPressed; + } + + /** + * 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; + } + + /** + * For explicitly setting output object. Call this in your processOK method. + * If an output object validator has been set via setOutputObjectValidator, then + * this will call its isValid method on the outputObject and will return the error + * message if any that it issues. A return of null always means no errors and + * hence it is ok to dismiss the dialog. + */ + protected SystemMessage setOutputObject(Object outputObject) + { + this.outputObject = outputObject; + if ((outputObjectValidator != null) && (outputObject instanceof String)) + return outputObjectValidator.validate((String)outputObject); + else + return null; + } + + /** + * 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 not 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; + } + + // ------------------------------ + // 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 true if the Details button is to be shown + * @param true 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. + *

    + * 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, true)); + 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) + { + //Widget source = e.widget; + } + + /** + * Swing-like method to auto-set the size of this dialog by + * looking at the preferred sizes of all constituents. + * @deprecated + */ + protected void pack() + { + // pack = true; // defer until controls are all created. + } + + /** + * 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 == 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); + } + } + + } + + /** + * 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); + + buttonsComposite = parent; + if (helpId != null) + SystemWidgetHelpers.setHelp(buttonsComposite, helpId); + //SystemWidgetHelpers.setCompositeHelp(buttonsComposite, helpId); + } + + private void doCancel() + { + super.buttonPressed(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 (SystemPlugin.isTheSystemRegistryActive()) + { + SystemPlugin.getTheSystemRegistry().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"); + SystemPlugin.getTheSystemRegistry().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. + + /* + * 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; + } + + /** + * 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 null 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 null 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 null 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 = SystemPlugin.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 null 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 true if the Cancel button should + * be enabled, and false 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); + + // 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 true if it is alright to close this dialog, and + * false 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 true if the window is (or was already) closed, + * and false 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: String, element type: + * Boolean) + * @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 + * saveUIState + * @see #saveUIState + */ + protected void restoreUIState(Map state) + { + //protected Button okButton, cancelButton, testButton, browseButton, addButton, detailsButton; + restoreEnableState(okButton, state, "ok"); + restoreEnableState(testButton, state, "test"); + restoreEnableState(browseButton, state, "browse"); + restoreEnableState(cancelButton, state, "cancel"); + restoreEnableState(addButton, state, "add"); + restoreEnableState(detailsButton,state, "details"); + 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 true if the Cancel button should + * remain enabled, and false if it should be disabled + * @return a map containing the saved state suitable for restoring later + * with restoreUIState + * @see #restoreUIState + */ + protected Map saveUIState(boolean keepCancelEnabled) + { + Map savedState= new HashMap(10); + saveEnableStateAndSet(okButton, savedState, "ok", false); + saveEnableStateAndSet(testButton, savedState, "test", false); + saveEnableStateAndSet(browseButton, savedState, "browse", false); + saveEnableStateAndSet(cancelButton, savedState, "cancel", keepCancelEnabled); + saveEnableStateAndSet(addButton, savedState, "add", false); + saveEnableStateAndSet(detailsButton,savedState, "details",false); + //savedState.put("page", ControlEnableState.disable(getControl())); + savedState.put("page", SystemControlEnableState.disable(dialogAreaComposite)); + return savedState; + } + + /** + * Saves the enabled/disabled state of the given control in the + * given map, which must be modifiable. + * + * @param w the control, or null if none + * @param h the map (key type: String, element type: + * Boolean) + * @param key the key + * @param enabled true to enable the control, + * and false 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 canceled 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 aboutToStart + * @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 new file mode 100644 index 00000000000..8cee80b90c2 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRemoteResourceDialog.java @@ -0,0 +1,256 @@ +/******************************************************************************** + * 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.dialogs; + +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.ui.messages.ISystemMessageLine; +import org.eclipse.rse.ui.validators.IValidatorRemoteSelection; +import org.eclipse.rse.ui.view.SystemActionViewerFilter; +import org.eclipse.rse.ui.view.SystemResourceSelectionForm; +import org.eclipse.rse.ui.view.SystemResourceSelectionInputProvider; +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 SystemResourceSelectionInputProvider _inputProvider; + private Object _preSelection; + private IValidatorRemoteSelection _selectionValidator; + private boolean _multipleSelectionMode; + private boolean _showPropertySheet = false; + private IHost _outputConnection; + private SystemActionViewerFilter _customViewerFilter; + + + public SystemRemoteResourceDialog(Shell shell, String title, SystemResourceSelectionInputProvider inputProvider) + { + super(shell, title); + _inputProvider = inputProvider; + } + + protected Control createInner(Composite parent) + { + _form = new SystemResourceSelectionForm(getShell(), parent, this, _inputProvider, getVerbage(), _multipleSelectionMode, getMessageLine()); + initForm(); + 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() + { + _form.setPreSelection(_preSelection); + if (_customViewerFilter != null) + { + _form.applyViewerFilter(_customViewerFilter); + } + else + { + _form.applyViewerFilter(getViewerFilter()); + } + _form.setSelectionValidator(_selectionValidator); + _form.setShowPropertySheet(_showPropertySheet); + _form.setSelectionTreeToolTipText(getTreeTip()); + } + + public void setDefaultSystemConnection(IHost connection, boolean onlyConnection) + { + _inputProvider.setSystemConnection(connection, onlyConnection); + } + + public void setSystemTypes(String[] 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 + *

    + * If you turn on multiple selection mode, you must use the getSelectedObjects() + * method to retrieve the list of selected objects. + *

    + * 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) + { + _form.setMessage(message); + } + /** + * Set the tooltip text for the remote systems tree from which an item is selected. + */ + public void setSelectionTreeToolTipText(String tip) + { + _form.setSelectionTreeToolTipText(tip); + } + + /** + * Show the property sheet on the right hand side, to show the properties of the + * selected object. + *

    + * This overload always shows the property sheet + *

    + * 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. + *

    + * This overload shows a Details>>> button so the user can decide if they want to see the + * property sheet. + *

    + * @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() instanceof Object) + return new Object[] {getOutputObject()}; + else + return null; + } + + public IHost getSelectedConnection() + { + return _form.getSelectedConnection(); + } + + /** + * Private method. + *

    + * 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; + } + /** + * Private method. + *

    + * Called when user presses DETAILS button. + *

    + * 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; + } + + public abstract SystemActionViewerFilter getViewerFilter(); + public abstract String getVerbage(); + public abstract String getTreeTip(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRenameDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRenameDialog.java new file mode 100644 index 00000000000..fa97e9d849c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRenameDialog.java @@ -0,0 +1,688 @@ +/******************************************************************************** + * 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.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.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +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.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. + *

    + * This is a re-usable dialog that you can use directly, or via the {@link org.eclipse.rse.ui.actions.SystemCommonRenameAction} + * action. + *

    + * 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. + *

    + * 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}. + *

    + * 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.ui.actions.SystemCommonRenameAction + */ +public class SystemRenameDialog extends SystemPromptDialog + implements ISystemMessages, ISystemPropertyConstants, + 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 verbage; + + 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, + 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 = ""; + if (property.equals(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(P_NEWNAME); + 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(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(SystemPlugin.HELPPREFIX+"drnm0000"); + } + /** + * Set the verbage to show above the table. The default is "Enter new name for each resource" + */ + public void setVerbage(String verbage) + { + this.verbage = verbage; + } + /** + * 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) + { + ISystemMessageLine msgLine = super.createMessageLine(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 (verbage != null) + SystemWidgetHelpers.createVerbage(composite, verbage, nbrColumns, false, 200); + else + SystemWidgetHelpers.createVerbage(composite, SystemResources.RESID_RENAME_VERBAGE, 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; (idxISystemValidator object. + * If the ISystemValidator 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; + + Control focusControl = Display.getCurrent().getFocusControl(); + + //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 + 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; idx0)) + { + uniqueNameValidator = new ValidatorUniqueString(names,caseSensitive); + uniqueNameValidator.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_NAME_EMPTY), + SystemPlugin.getPluginMessage(MSG_VALIDATE_NAME_NOTUNIQUE)); + uniqueNameValidatorPerParent.put(parentName, uniqueNameValidator); + if (debug) + { + System.out.println("Name validator set. Names = "); + for (int idx=0; idx + * This is a re-usable dialog that you can use directly, or via the {@link org.eclipse.rse.ui.actions.SystemCommonRenameAction} + * action. + *

    + * 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. + *

    + * 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}. + *

    + * 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.ui.actions.SystemCommonRenameAction + */ +public class SystemRenameSingleDialog extends SystemPromptDialog + implements ISystemMessages, ISystemPropertyConstants, + Runnable +{ + + public static final boolean COLLISION_MODE = true; + + private Button overwriteRadio, renameRadio; + private boolean overwriteMode = true; + + private Composite renameGroup; + + private Text newName; + private String promptLabel, promptTip; + private String newNameString; + private String inputName = ""; + private Label resourceTypePrompt, resourceTypeValue, verbageLabel, 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; + + /** + * 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 + setTitle(singleTitle); + } + /** + * Constructor with a title + */ + public SystemRenameSingleDialog(Shell shell, String title) + { + super(shell, title); + + //pack(); + setBlockOnOpen(true); + setHelp(SystemPlugin.HELPPREFIX+"drns0000"); + } + + /** + * 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); + + } + + /** + * 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, verbage 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(SystemPlugin.HELPPREFIX+"dccc0000"); + } + else + { + setHelp(SystemPlugin.HELPPREFIX+"drns0001"); + } + setTitle(SystemResources.RESID_COLLISION_RENAME_TITLE); + } + else if (this.copyCollisionMode) // from true to false + { + setHelp(SystemPlugin.HELPPREFIX+"drns0000"); + String singleTitle = SystemResources.RESID_RENAME_SINGLE_TITLE; + if (!singleTitle.startsWith("Missing")) // TODO: remove test after next mri rev + 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, verbage 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) + { + // VERBAGE + verbageLabel = SystemWidgetHelpers.createLabel(composite, " ", nbrColumns); + Label filler = SystemWidgetHelpers.createLabel(composite, " ", nbrColumns); + } + else if (description != null) + { + // VERBAGE + verbageLabel = SystemWidgetHelpers.createLabel(composite, description, nbrColumns); + Label filler = SystemWidgetHelpers.createLabel(composite, " ", nbrColumns); + } + + 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, ""); + 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); + newName = SystemWidgetHelpers.createTextField(renameGroup, null); + } + else + { + renameLabel = SystemWidgetHelpers.createLabel(renameGroup, promptLabel); + newName = SystemWidgetHelpers.createTextField(renameGroup, null); + 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 = getAdapter(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); + newName.selectAll(); + if (copyCollisionMode) + { + verbageLabel.setText(SystemMessage.sub(SystemResources.RESID_COLLISION_RENAME_VERBAGE, "&1", inputName)); + } + + + + if ((nameValidator == null) && (adapter != null)) + nameValidator = adapter.getNameValidator(inputElement); + if ((nameValidator != null) && (nameValidator instanceof ISystemValidator)) + { + int maxLen = ((ISystemValidator)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 = getAdapter(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 = SystemPlugin.getTheSystemRegistry().getRunnableContext(); + SystemPlugin.getTheSystemRegistry().clearRunnableContext(); + names = ra.getRemoteParentNamesInUse(shell, inputElement); + SystemPlugin.getTheSystemRegistry().setRunnableContext(shell, irc); + } catch (Exception exc) {SystemBasePlugin.logError("Exception getting parent's child names in rename dialog",exc);} + if ((names != null) && (names.length>0)) + { + uniqueNameValidator = new ValidatorUniqueString(names,caseSensitive); + uniqueNameValidator.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_NAME_EMPTY), + SystemPlugin.getPluginMessage(MSG_VALIDATE_NAME_NOTUNIQUE)); + if (debug) + { + System.out.println("Name validator set. Names = "); + for (int idx=0; idx 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/SystemRenameTableProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRenameTableProvider.java new file mode 100644 index 00000000000..af6d09312d9 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRenameTableProvider.java @@ -0,0 +1,216 @@ +/******************************************************************************** + * 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.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.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.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); + //SystemPlugin.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 = ""; + 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 IBaseLabelProvider#addListener(org.eclipse.jface.viewers.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 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 + * This method returns a name that can be used for uniqueness checking because it is qualified + * sufficiently to make it unique. + *

    + * Defers to the object's adapter + */ + public String getCanonicalNewName() + { + // this is all for defect 42145 + Object element = super.getElement(); + ISystemViewElementAdapter adapter = super.getAdapter(); + 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.getAdapter(); + 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. + *

    + * 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(); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemResolveFilterStringDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemResolveFilterStringDialog.java new file mode 100644 index 00000000000..299d9d411e4 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemResolveFilterStringDialog.java @@ -0,0 +1,111 @@ +/******************************************************************************** + * 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.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.SystemWidgetHelpers; +import org.eclipse.rse.ui.view.SystemResolveFilterStringAPIProviderImpl; +import org.eclipse.rse.ui.view.SystemViewForm; +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. + *

    + * Caller must supply the subsystem which owns this existing or potential filter string. + *

    + * 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 + 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 \ 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 new file mode 100644 index 00000000000..06807be2c8c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectAnythingDialog.java @@ -0,0 +1,91 @@ +/******************************************************************************** + * 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.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.ui.view.ISystemPropertyConstants; +import org.eclipse.rse.ui.view.ISystemViewInputProvider; +import org.eclipse.rse.ui.view.SystemViewForm; +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 ISystemPropertyConstants, ISelectionChangedListener +{ + private SystemViewForm _view = null; + private Object _selected = 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.getSystemView().addSelectionChangedListener(this); + //_view.getSystemView().ref + + 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 = SystemPlugin.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(); + + + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectConnectionDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectConnectionDialog.java new file mode 100644 index 00000000000..ab9dce9e0cd --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectConnectionDialog.java @@ -0,0 +1,365 @@ +/******************************************************************************** + * 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.rse.model.IHost; +import org.eclipse.rse.ui.ISystemPageCompleteListener; +import org.eclipse.rse.ui.SystemBaseForm; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.messages.ISystemMessageLine; +import org.eclipse.rse.ui.validators.IValidatorRemoteSelection; +import org.eclipse.rse.ui.widgets.SystemSelectConnectionForm; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; + + +/** + * Dialog for allowing users to select an existing connection, or optionally create a new one. + * There are a number of methods to configure the dialog so only connections of a particular system type, + * or containing subsystems from a particular subsystem factory or class of subsystem factories, are shown. + *

    + * Call these methods to configure the functionality of the dialog + *

      + *
    • {@link #setHost(IHost) or #setDefaultConnection(SystemConnection)} + *
    • {@link #setShowNewConnectionPrompt(boolean)} + *
    • {@link #setSystemTypes(String[])} + *
    • {@link #setAutoExpandDepth(int)} + *
    • {@link #setRootFolder(IHost, String)} or {@link #setRootFolder(IRemoteFile)} or {@link #setPreSelection(IRemoteFile)} + *
    • {@link #setFileTypes(String[])} or {@link #setFileTypes(String)} + *
    • {@link #setShowPropertySheet(boolean)} + *
    • {@link #enableAddMode(ISystemAddFileListener)} + *
    • {@link #setMultipleSelectionMode(boolean)} + *
    • {@link #setSelectionValidator(IValidatorRemoteSelection)} + *
    + *

    + * Call these methods to configure the text on the dialog + *

      + *
    • {@link #setMessage(String)} + *
    • {@link #setSelectionTreeToolTipText(String)} + *
    + *

    + * After running, call these methods to get the output: + *

      + *
    • {@link #getSelectedObject()} or {@link #getSelectedObjects()} + *
    • {@link #getSelectedConnection()} + *
    + * + * @see com.ibm.etools.systems.files.ui.actions.SystemSelectRemoteFileAction + * @see com.ibm.etools.systems.files.ui.actions.SystemSelectRemoteFolderAction + */ +public class SystemSelectConnectionDialog + extends SystemPromptDialog implements ISystemPageCompleteListener +{ + public static final boolean FILE_MODE = true; + public static final boolean FOLDER_MODE = false; + private SystemSelectConnectionForm form; + + + /** + * Constructor + * + * @param shell The shell to hang the dialog off of + * + */ + public SystemSelectConnectionDialog(Shell shell) + { + this(shell, SystemResources.RESID_SELECTCONNECTION_TITLE); + } + /** + * Constructor when you want to supply your own title. + * + * @param shell The shell to hang the dialog off of + * @param title The title to give the dialog + */ + public SystemSelectConnectionDialog(Shell shell, String title) + { + super(shell, title); + super.setBlockOnOpen(true); // always modal + form = getForm(shell); + setShowPropertySheet(true, false); // default + } + + // ------------------ + // PUBLIC METHODS... + // ------------------ + /** + * Set the connection to default the selection to + */ + public void setDefaultConnection(IHost conn) + { + form.setDefaultConnection(conn); + } + /** + * Restrict to certain system types + * @param systemTypes the system types to restrict what connections are shown and what types of connections + * the user can create + * @see org.eclipse.rse.core.ISystemTypes + */ + public void setSystemTypes(String[] systemTypes) + { + form.setSystemTypes(systemTypes); + } + /** + * Restrict to a certain system type + * @param systemType the system type to restrict what connections are shown and what types of connections + * the user can create + * @see org.eclipse.rse.core.ISystemTypes + */ + public void setSystemType(String systemType) + { + form.setSystemType(systemType); + } + /** + * Set to true if a "New Connection..." special connection is to be shown for creating new connections + */ + public void setShowNewConnectionPrompt(boolean show) + { + form.setShowNewConnectionPrompt(show); + } + /** + * Set the instruction label shown at the top of the dialog + */ + public void setInstructionLabel(String message) + { + form.setMessage(message); + } + + /** + * Show the property sheet on the right hand side, to show the properties of the + * selected object. + *

    + * This overload always shows the property sheet + *

    + * Default is false + */ + public void setShowPropertySheet(boolean show) + { + form.setShowPropertySheet(show); + } + /** + * Show the property sheet on the right hand side, to show the properties of the + * selected object. + *

    + * This overload shows a Details>>> button so the user can decide if they want to see the + * property sheet. + *

    + * Default is true, false + *

    + * @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) + { + form.setShowPropertySheet(initialState); + setShowDetailsButton(true, !initialState); + } + } + + /** + * Set multiple selection mode. Default is single selection mode + *

    + * If you turn on multiple selection mode, you must use the getSelectedObjects() + * method to retrieve the list of selected objects. + *

    + * 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) + { + form.setMultipleSelectionMode(multiple); + } + + // ------------------ + // OUTPUT METHODS... + // ------------------ + + /** + * 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() instanceof Object) + return new Object[] {getOutputObject()}; + else + return null; + } + + /** + * Return selected connection + */ + public IHost getSelectedConnection() + { + return form.getSelectedConnection(); + } + /** + * Return selected connections in multiple selection mode + */ + public IHost[] getSelectedConnections() + { + return form.getSelectedConnections(); + } + + /** + * Return the multiple selection mode as set by setMultipleSelectionMode(boolean) + */ + public boolean getMultipleSelectionMode() + { + return form.getMultipleSelectionMode(); + } + + // ------------------ + // PRIVATE METHODS... + // ------------------ + /** + * Private method. + * @see SystemPromptDialog#getInitialFocusControl() + */ + protected Control getInitialFocusControl() + { + return form.getInitialFocusControl(); + } + + /** + * Private method. + * @see SystemPromptDialog#createInner(Composite) + */ + protected Control createInner(Composite parent) + { + return form.createContents(parent); + } + + /** + * Private method. + * Get the contents. + */ + protected SystemSelectConnectionForm getForm(Shell shell) + { + //System.out.println("INSIDE GETFORM"); + //if (form == null) + //{ + form = new SystemSelectConnectionForm(shell,getMessageLine()); + form.addPageCompleteListener(this); + // reset output variables just to be safe + setOutputObject(null); + //} + return form; + } + + /** + * Create message line. Intercept so we can set msg line of form. + */ + protected ISystemMessageLine createMessageLine(Composite c) + { + ISystemMessageLine msgLine = super.createMessageLine(c); + if (form != null) + form.setMessageLine(msgLine); + return msgLine; + } + + + /** + * Private method. + *

    + * 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) + { + if (getMultipleSelectionMode()) + setOutputObject(form.getSelectedConnections()); + else + setOutputObject(form.getSelectedConnection()); + } + else + setOutputObject(null); + return closeDialog; + } + + /** + * Private method. + *

    + * Called when user presses DETAILS button. + *

    + * 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; + } + + + /** + * We have to override close to ensure that we reset the form to null + */ + public boolean close() + { + if (super.close()) + { + if (form != null) + { + form.dispose(); + } + form = null; + return true; + } + return false; + } + + /** + * The callback method. + * This is called whenever setPageComplete is called by the form code. + * @see {@link SystemBaseForm#addPageCompleteListener(ISystemPageCompleteListener)} + */ + public void setPageComplete(boolean complete) + { + super.setPageComplete(complete); + } +} \ 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 new file mode 100644 index 00000000000..ef49ae04099 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectFileTypesDialog.java @@ -0,0 +1,468 @@ +/******************************************************************************** + * 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.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.ui.GenericMessages; +import org.eclipse.rse.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. + *

    + * File types are extension names without the dot. + * For example "java" and "class". + *

    + * 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 canceled + 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"; + 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. + *

    + * This method is provided to allow subclasses to decide where the message + * will appear on the screen. + *

    + * + * @param parent 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("")) + { + 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 null if + * the selection was canceled. + * + * @param the list of selected elements, or null 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("*.")) + 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 null if + * the selection was canceled. + * + * @return the array of selected elements, or null if Cancel was + * pressed + */ + public Object[] getResult() + { + return result; + } +} \ No newline at end of file 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 new file mode 100644 index 00000000000..7ae1b409a81 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleContentElement.java @@ -0,0 +1,331 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemIconConstants; + +/** + * When we populate a TreeViewer in a dialog, we need a simple + * representation of the objects to populate the tree. + *

    + * 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; idx0)) + { + for (int idx=0; (match==null)&&(idx0)) + { + for (int idx=0; (match==null)&&(idx 0; + } + + /** + * @see IStructuredContentProvider#getElements(Object) + */ + public Object[] getElements(Object element) + { + return getChildren(element); + } + + /** + * @see IContentProvider#dispose() + */ + public void dispose() + { + + } + + /** + * @see 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 new file mode 100644 index 00000000000..df0faf1b9fc --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleCopyDialog.java @@ -0,0 +1,277 @@ +/******************************************************************************** + * 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.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.ui.ISystemMessages; +import org.eclipse.rse.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.Label; +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 ISystemMessages, //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(SystemPlugin.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); + + //SystemPlugin.getDefault().getSystemRegistry().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() + { + //SystemPlugin.getDefault().getSystemRegistry().removeSystemResourceChangeListener(this); + return super.close(); + } + /** + * Verifies all input. + * @return true if there are no errors in the user input + */ + public boolean verify() + { + String errMsg = null; + Control controlInError = null; + clearErrorMessage(); + + if (errMsg != null) + controlInError.setFocus(); + return (errMsg == null); + } + + /** + * 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 new file mode 100644 index 00000000000..23529bfa066 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleSelectDialog.java @@ -0,0 +1,490 @@ +/******************************************************************************** + * 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.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.rse.ui.view.ISystemPropertyConstants; +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.Label; +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}. + *

    + * The {@link #setInputObject} method is used to populate the selection tree: + *

      + *
    • The passed object must be of type SystemSimpleContentElement + *
    • The method getChildren will be called on that object to get initial visible elements + *
    • As user expands each item, getChildren() is progressively called + *
    • The initial selection state of each item is determined by calling isSelected on that item + *
    + *

    + * 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. + *

    + * 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 ISystemPropertyConstants, + 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; idx0)) + { + for (int idx=0; idx0)) + { + currState = children[0].isSelected(); + for (int idx = 0; idx + * Caller must supply the subsystem which owns this existing or potential filter string. + *

    + * 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 subsystemFactoryId = 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.subsystemFactoryId = subsystem.getSubSystemConfiguration().getId(); + sr = SystemPlugin.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 + 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.subsystemFactoryId = subsystem.getParentSubSystemFactory().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) + { + Object src = event.getSource(); + //if (src == connectionCombo.getCombo()) + { + //System.out.println("connection changed"); + IHost newConnection = connectionCombo.getHost(); + ISubSystem[] newSubSystems = sr.getSubSystems(subsystemFactoryId, newConnection); + ISubSystem newSubSystem = null; + if ((newSubSystems != null) && (newSubSystems.length>0)) + { + newSubSystem = newSubSystems[0]; + subsystemFactoryId = 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/ui/dialogs/SystemUpdateConnectionDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemUpdateConnectionDialog.java new file mode 100644 index 00000000000..a34891a4d0a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemUpdateConnectionDialog.java @@ -0,0 +1,141 @@ +/******************************************************************************** + * 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.rse.core.SystemPlugin; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.ui.ISystemConnectionFormCaller; +import org.eclipse.rse.ui.SystemConnectionForm; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.messages.ISystemMessageLine; +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; + + + +/** + * Dialog for updating a connection. + * THIS DIALOG AND ITS ACTION ARE NO LONGER USED. THEY ARE REPLACED WITH A PROPERTIES DIALOG. + */ +public class SystemUpdateConnectionDialog extends SystemPromptDialog implements ISystemConnectionFormCaller +{ + protected SystemConnectionForm form; + protected String parentHelpId; + + /** + * Constructor for SystemUpdateConnectionDialog + */ + public SystemUpdateConnectionDialog(Shell shell) + { + super(shell, SystemResources.RESID_CHGCONN_TITLE); + parentHelpId = SystemPlugin.HELPPREFIX + "dcon0000"; + getForm(); + //pack(); + } + + /** + * Overrride this if you want to supply your own form. This may be called + * multiple times so please only instantatiate if the form instance variable + * is null, and then return the form instance variable. + * @see org.eclipse.rse.ui.SystemConnectionForm + */ + public SystemConnectionForm getForm() + { + //System.out.println("INSIDE GETFORM"); + if (form == null) + { + form = new SystemConnectionForm(getMessageLine(),this); + } + return form; + } + + /** + * 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() + { + Control control = form.getInitialFocusControl(); + return control; + } + + /** + * @see SystemPromptDialog#createInner(Composite) + */ + protected Control createInner(Composite parent) + { + Control c = form.createContents(parent, SystemConnectionForm.UPDATE_MODE, parentHelpId); + return c; + } + + /** + * 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); + form.initializeInputFields((IHost)inputObject); + + IHost conn = (IHost)inputObject; + ISystemValidator connectionNameValidators[] = new ISystemValidator[1]; + connectionNameValidators[0] = SystemConnectionForm.getConnectionNameValidator(conn); + form.setConnectionNameValidators(connectionNameValidators); + } + + /** + * Called when user presses OK button. + * Return true to close dialog. + * Return false to not close dialog. + */ + protected boolean processOK() + { + boolean closeDialog = form.verify(true); + if (closeDialog) + { + IHost conn = (IHost)getInputObject(); + ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry(); + sr.updateHost( getShell(),conn,conn.getSystemType(),form.getConnectionName(), + form.getHostName(), form.getConnectionDescription(), + form.getDefaultUserId(), form.getUserIdLocation() ); + } + return closeDialog; + } + + // ---------------------------------------- + // CALLBACKS FROM SYSTEM CONNECTION FORM... + // ---------------------------------------- + /** + * Event: the user has selected a system type. + */ + public void systemTypeSelected(String systemType, boolean duringInitialization) + { + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemUserIdPerSystemTypeDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemUserIdPerSystemTypeDialog.java new file mode 100644 index 00000000000..c03522b788d --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemUserIdPerSystemTypeDialog.java @@ -0,0 +1,243 @@ +/******************************************************************************** + * 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.rse.core.SystemPlugin; +import org.eclipse.rse.core.SystemPreferencesManager; +import org.eclipse.rse.core.SystemType; +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.SystemResources; +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.ValidatorUserId; +import org.eclipse.rse.ui.view.ISystemPropertyConstants; +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.swt.widgets.Text; + +/** + * Dialog for renaming a system profile. + */ +public class SystemUserIdPerSystemTypeDialog extends SystemPromptDialog + implements ISystemMessages, ISystemPropertyConstants, + ISystemIconConstants +{ + private Text userId; + private Label systemTypePromptLabel, systemTypeLabel; + private String userIdString, inputUserId; + private SystemMessage errorMessage; + private ISystemValidator userIdValidator; + private boolean initialized = false; + private SystemType systemType; + + /** + * Constructor + */ + public SystemUserIdPerSystemTypeDialog(Shell shell, SystemType systemType) + { + super(shell, SystemResources.RESID_USERID_PER_SYSTEMTYPE_TITLE); + this.systemType = systemType; + if (systemType != null) + { + setInputObject(systemType); + } + userIdValidator = new ValidatorUserId(false); // false => allow empty? No. + //pack(); + setHelp(SystemPlugin.HELPPREFIX + "ddid0000"); + } + /** + * 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() + { + return userId; + } + + /** + * Set the UserId validator. + * By default, we use ValidatorUserId + */ + public void setUserIdValidator(ISystemValidator uiv) + { + userIdValidator = uiv; + } + + /** + * @see SystemPromptDialog#createInner(Composite) + */ + protected Control createInner(Composite parent) + { + // Inner composite + Composite composite_prompts = SystemWidgetHelpers.createComposite( + parent, 2); + + // SYSTEM TYPE + systemTypePromptLabel = SystemWidgetHelpers.createLabel(composite_prompts,SystemResources.RESID_USERID_PER_SYSTEMTYPE_SYSTEMTYPE_LABEL); + //systemTypePromptLabel.setToolTipText(SystemPlugin.getString(RESID_USERID_PER_SYSTEMTYPE_SYSTEMTYPE_ROOT+"tooltip")); + + systemTypeLabel = SystemWidgetHelpers.createLabel(composite_prompts,""); + systemTypeLabel.setToolTipText(SystemResources.RESID_USERID_PER_SYSTEMTYPE_TOOLTIP); + systemTypeLabel.setText(systemType.getName()); + + + // ENTRY FIELD + userId = SystemWidgetHelpers.createLabeledTextField(composite_prompts,null, + SystemResources.RESID_USERID_PER_SYSTEMTYPE_LABEL, + SystemResources.RESID_USERID_PER_SYSTEMTYPE_TOOLTIP); + initialize(); + + // add keystroke listeners... + userId.addModifyListener( + new ModifyListener() { + public void modifyText(ModifyEvent e) { + validateUserIdInput(); + } + } + ); + + 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. + * INPUT OBJECT MUST BE OF TYPE SYSTEMTYPE. + */ + public void setInputObject(Object inputObject) + { + //System.out.println("INSIDE SETINPUTOBJECT: " + inputObject + ", "+inputObject.getClass().getName()); + super.setInputObject(inputObject); + if (inputObject instanceof SystemType) + { + SystemType type = (SystemType)inputObject; + inputUserId = SystemPreferencesManager.getPreferencesManager().getDefaultUserId(type.getName()); + } + initialize(); + } + + /** + * Initialize input fields from input + */ + protected void initialize() + { + if (!initialized && (userId!=null) && (inputUserId!=null)) + { + initialized = true; + userId.setText(inputUserId); + userId.selectAll(); + } + setPageComplete(false); // well, should empty be valid! + } + /** + * Called when user presses OK button. + * Return true to close dialog. + * Return false to not close dialog. + */ + protected boolean processOK() + { + userIdString = userId.getText().trim(); + boolean closeDialog = verify(); + if (closeDialog) + { + setOutputObject(userIdString); + } + return closeDialog; + } + /** + * Verifies all input. + * @return true if there are no errors in the user input + */ + public boolean verify() + { + //clearErrorMessage(); + SystemMessage errMsg = validateUserIdInput(); + if (errMsg != null) + { + userId.setFocus(); + } + return (errMsg == null); + } + + /** + * Validate the userId as the user types it. + * @see #setUserIdValidator(ISystemValidator) + */ + protected SystemMessage validateUserIdInput() + { + errorMessage = userIdValidator.validate(userId.getText().trim()); + 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 theNewUserId = userId.getText().trim(); + pageComplete = (theNewUserId.length() > 0); + //pageComplete = (theNewUserId.length() > 0) && !(theNewUserId.equalsIgnoreCase(inputUserId)); + //pageComplete = true; // should empty be valid? + } + return pageComplete; + } + + /** + * Inform caller of page-complete status of this form + */ + public void setPageComplete() + { + setPageComplete(isPageComplete()); + } + + /** + * Returns the user-entered new user Id + */ + public String getUserId() + { + return userIdString; + } + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..1cfee6d301a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemWizardDialog.java @@ -0,0 +1,192 @@ +/******************************************************************************** + * 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.core.runtime.IProgressMonitor; +import org.eclipse.jface.wizard.IWizardPage; +import org.eclipse.jface.wizard.ProgressMonitorPart; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.rse.core.SystemPlugin; +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. + *

    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. + *

    + *

    The advantages to using this class versus the base JFace WizardDialog class is: + *

    + *
      + *
    • Supports settings of an input object, which is propogated to the wizard and its pages. + *
    • Supports querying of an output object, as set by the wizard. + *
    • Supports a {@link #wasCancelled()} method for callers to know if the wizard was dismissed or cancelled by the user. + *
    • Supports setting of the overall contextual help, which is propogated to each page. + *
    • Supports an {@link #updateSize(IWizardPage)} method that can be called by a page when it dynamically grows the page size. + *
    • When a progress monitor is not required, the real estate for the monitor is reclaimed, reducing the size of the wizard + *
    • Whan a progress monitor is required, registers this with the RSE system registry, so it is using for long-running remote communications requests. + *
    + * + *

    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 ISystemWizard wizard; + protected String helpId; + + /** + * Constructor + */ + public SystemWizardDialog(Shell shell, ISystemWizard wizard) + { + super(shell, wizard); + this.wizard = wizard; + wizard.setSystemWizardDialog(this); + } + /** + * Constructor two. Use when you have an input object at instantiation time. + */ + public SystemWizardDialog(Shell shell, ISystemWizard wizard, Object inputObject) + { + super(shell,wizard); + this.wizard = wizard; + setInputObject(inputObject); + wizard.setSystemWizardDialog(this); + } + + /** + * For explicitly setting input object. Called by SystemDialogAction + */ + public void setInputObject(Object inputObject) + { + wizard.setInputObject(inputObject); + } + /** + * For explicitly getting input object. + */ + public Object getInputObject() + { + return wizard.getInputObject(); + } + + /** + * For explicitly getting output object after wizard is dismissed. Set by the + * dialog's processOK method. + */ + public Object getOutputObject() + { + + return wizard.getOutputObject(); + } + + /** + * Allow caller to determine if wizard was cancelled or not. + */ + public boolean wasCancelled() + { + //System.out.println("Inside wasCancelled of SystemWizardDialog: " + wizard.wasCancelled()); + return wizard.wasCancelled(); + } + + /** + * Set the help context id for this wizard dialog + */ + public void setHelp(String id) + { + helpId = id; + if (wizard instanceof ISystemWizard) + ((ISystemWizard)wizard).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 = wizard.needsProgressMonitor(); + Control ctrl = super.createDialogArea(parent); + if (!needsMonitor) + { + IProgressMonitor pm = getProgressMonitor(); + ((ProgressMonitorPart)pm).dispose(); + } + if (needsMonitor && SystemPlugin.isTheSystemRegistryActive()) + { + SystemPlugin.getTheSystemRegistry().setRunnableContext(getShell(), this); + // add a dispose listener + getShell().addDisposeListener(new DisposeListener() + { + public void widgetDisposed(DisposeEvent e) + { + SystemPlugin.getTheSystemRegistry().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/dialogs/SystemWorkWithHistoryDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemWorkWithHistoryDialog.java new file mode 100644 index 00000000000..52673949c01 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemWorkWithHistoryDialog.java @@ -0,0 +1,346 @@ +/******************************************************************************** + * 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.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.SystemWidgetHelpers; +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.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.Shell; +import org.eclipse.swt.widgets.Widget; + + + +/** + * A dialog that allows the user to manipulate the history associated with + * a widget. + *

    + * 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 ISystemIconConstants, Listener, ArmListener +{ + private String[] historyInput; + private String[] historyOutput; + private String[] defaultHistory; + private Label verbage; + 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(SystemPlugin.HELPPREFIX+"dwwh0000"); + 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 && (idx0)); + 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; + } +} \ 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 new file mode 100644 index 00000000000..fe964afdd9c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/ISystemChangeFilterPaneEditPaneSupplier.java @@ -0,0 +1,33 @@ +/******************************************************************************** + * 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.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. + */ +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 new file mode 100644 index 00000000000..d00af222529 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/ISystemFilterStringEditPaneListener.java @@ -0,0 +1,44 @@ +/******************************************************************************** + * 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 new file mode 100644 index 00000000000..7da228b3e2a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemChangeFilterPane.java @@ -0,0 +1,1437 @@ +/******************************************************************************** + * 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.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.SystemPlugin; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider; +import org.eclipse.rse.filters.ISystemFilterReference; +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.SystemBaseForm; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.SystemWidgetHelpers; +import org.eclipse.rse.ui.actions.ISystemAction; +import org.eclipse.rse.ui.filters.actions.SystemChangeFilterActionCopyString; +import org.eclipse.rse.ui.filters.actions.SystemChangeFilterActionDeleteString; +import org.eclipse.rse.ui.filters.actions.SystemChangeFilterActionMoveStringDown; +import org.eclipse.rse.ui.filters.actions.SystemChangeFilterActionMoveStringUp; +import org.eclipse.rse.ui.filters.actions.SystemChangeFilterActionPasteString; +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.view.SystemViewMenuListener; +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. + */ +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 + /** + * Configuration method
    + * 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. + *

    + * 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; + } + /** + * Configuration method
    + * 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. + *

    + * 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; + } + + /** + * Configuration method
    + * 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; + } + + /** + * Configuration method
    + * 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; + } + + /** + * Configuration method
    + * 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; + } + + /** + * Configuration method
    + * Call this to specify a validator for the filter string. It will be called per keystroke. + * A default validator is supplied otherwise: ValidatorFilterString. + *

    + * Your validator should extend ValidatorFilterString to inherited the uniqueness error checking. + *

    + * 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; + } + /** + * Configuration method
    + * 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; + } + /** + * Configuration method
    + * 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.
    + * 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, SystemPlugin.HELPPREFIX+"dufr0000"); + + 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, ""); + filterNameLabel.setToolTipText(namePromptTip); + filterNameLabel.setText(inputFilter.getName()); + // filter pool + SystemWidgetHelpers.createLabel(topComposite, poolPromptLabel); + filterPoolNameLabel = SystemWidgetHelpers.createLabel(topComposite, ""); + filterPoolNameLabel.setToolTipText(namePromptTip); + 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 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 = SystemPlugin.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= 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 = SystemPlugin.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); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterDialogInputs.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterDialogInputs.java new file mode 100644 index 00000000000..00671d49685 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterDialogInputs.java @@ -0,0 +1,31 @@ +/******************************************************************************** + * 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; +/** + * 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; +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterDialogInterface.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterDialogInterface.java new file mode 100644 index 00000000000..8e10490df47 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterDialogInterface.java @@ -0,0 +1,35 @@ +/******************************************************************************** + * 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.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(); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterDialogOutputs.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterDialogOutputs.java new file mode 100644 index 00000000000..df16f464a0a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterDialogOutputs.java @@ -0,0 +1,33 @@ +/******************************************************************************** + * 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.core.ui.actions.*; +import org.eclipse.rse.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; +} \ No newline at end of file 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 new file mode 100644 index 00000000000..66a142bad9f --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterPoolDialogInputs.java @@ -0,0 +1,44 @@ +/******************************************************************************** + * 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.core.*; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; +import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement; + + + +/** + * A class capturing the attributes commonly needed by dialogs that + * work with filter pools. + */ +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; +} \ No newline at end of file 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 new file mode 100644 index 00000000000..bbc737908a4 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterPoolDialogInterface.java @@ -0,0 +1,40 @@ +/******************************************************************************** + * 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.ui.filters.actions.SystemFilterAbstractFilterPoolAction; + + +/** + * Common interface for dialogs or wizards that work with filter pools. + */ +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); +} \ No newline at end of file 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 new file mode 100644 index 00000000000..94ad7a346c2 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterPoolDialogOutputs.java @@ -0,0 +1,36 @@ +/******************************************************************************** + * 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.core.*; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement; + + + +/** + * A class capturing the attributes commonly returned by dialogs that + * work with filter pools. + */ +public class SystemFilterPoolDialogOutputs +{ + + + public String filterPoolName; + public String filterPoolManagerName; + public SystemSimpleContentElement filterPoolTreeRoot; + public ISystemFilterPool newPool; +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterPoolManagerUIProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterPoolManagerUIProvider.java new file mode 100644 index 00000000000..935c451cd11 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterPoolManagerUIProvider.java @@ -0,0 +1,26 @@ +/******************************************************************************** + * 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.filters.ISystemFilterPoolManager; +import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement; + +public interface SystemFilterPoolManagerUIProvider +{ + public ISystemFilterPoolManager[] getFilterPoolManagers(); + public SystemSimpleContentElement getTreeModel(); + public SystemSimpleContentElement getTreeModelPreSelection(SystemSimpleContentElement root); +} \ No newline at end of file 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 new file mode 100644 index 00000000000..8fbf4a538b1 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterStringEditPane.java @@ -0,0 +1,704 @@ +/******************************************************************************** + * 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 java.util.Vector; + +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +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: + *

      + *
    • The first page of the New Filter wizard + *
    • The only page of the New Filter String wizard + *
    • The right side of the Change Filter dialog, when "new" or an existing filter string is selected + *
    + * So what is the "contract" the edit pane has to fulfill? + *
      + *
    • 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". + *
    • give as output a new or updated String + *
    • allow interested parties to know when the contents have been changed, as they change, + * and whether there are errors in those changes + *
    + * Contractually, here are the methods called by the main page of the new filter wizard: + *
      + *
    • addChangeListener ... no need to ever override + *
    • setSystemFilterPoolReferenceManagerProvider ... no need to ever override + *
    • setType ... no need to ever override + *
    • setFilterStringValidator ... no need to ever override + *
    • isComplete ... no need to ever override + *
    • createContents ... you will typically override + *
    • verify ... you will typically override + *
    • getInitialFocusControl ... you will typically override + *
    • getFilterString ... you will typically override + *
    • areFieldsComplete ... you will typically override + *
    + */ +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... + // ------------------------------ + + /** + * Helper method. Do not override.
    + * Return the shell given us in the ctor + */ + protected Shell getShell() + { + return shell; + } + /** + * Helper method. Do not override.
    + * Return the input filter string as given us in setFilterString + */ + protected String getInputFilterString() + { + return inputFilterString; + } + + /** + * Helper method. Do not override.
    + * 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. Do not override.
    + * 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. Do not override.
    + * 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... + // ------------------------------ + /** + * Configuration method, called from Change Filter dialog and New Filter wizard. Do not override.
    + * 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); + } + + /** + * Configuration method, called from Change Filter dialog and New Filter wizard. Do not override.
    + * Set the input filter string only without any initialzing. + */ + public void setInputFilterString(String filterString) + { + this.inputFilterString = filterString; + } + + + /** + * Lifecyle method. Call, but do not override.
    + * 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; + } + + /** + * Configuration method, called from Change Filter dialog and New Filter wizard. Do not override.
    + * Identify a listener interested in any changes made to the filter string, + * as they happen + */ + public void addChangeListener(ISystemFilterStringEditPaneListener l) + { + listeners.add(l); + } + /** + * Configuration method, called from Change Filter dialog and New Filter wizard. Do not override.
    + * Remove a listener interested in any changes made to the filter string, + * as they happen + */ + public void removeChangeListener(ISystemFilterStringEditPaneListener l) + { + listeners.remove(l); + } + /** + * Configuration method, called from Change Filter dialog and New Filter wizard. Do not override.
    + * 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. + *

    + * Will be non-null if the current selection is a reference to a + * filter pool or filter, or a reference manager provider. + *

    + * This is not used by default but made available for subclasses. + * @see #setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider) + */ + public void setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider provider) + { + this.refProvider = provider; + } + /** + * Configuration method, called from Change Filter dialog and New Filter wizard. Do not override.
    + * 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. + *

    + * 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. + *

    + * This is not used by default but made available for subclasses. + * @see #setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider) + */ + public void setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider provider) + { + this.provider = provider; + } + + /** + * Getter method, for the use of subclasses. Do not override.
    + * 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. + *

    + * This is not used by default but made available for subclasses. + */ + public ISystemFilterPoolReferenceManagerProvider getSystemFilterPoolReferenceManagerProvider() + { + return refProvider; + } + /** + * Getter method, for the use of subclasses. Do not override.
    + * Return the contextual system filter pool manager provider (ie subsystemFactory) that + * this was launched from. Will be null if not launched from a subsystem factory, or + * a filter pool or filter (or reference). + *

    + * This is not used by default but made available for subclasses. + */ + public ISystemFilterPoolManagerProvider getSystemFilterPoolManagerProvider() + { + return provider; + } + + /** + * Helper method you do not need to ever override.
    + * 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. + *

    + * This simply sets the type 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; + } + + /** + * Configuration method, called from Change Filter dialog. Do not override.
    + * 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; + } + /** + * Configuration method, called from Change Filter dialog and New Filter wizard. Do not override.
    + * 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; + } + /** + * Overridable method, if subclass supports a Test button.
    + * 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!"); + } + + /* + * Set if the edit pane is not to be editable + * + public void setEditable(boolean editable) + { + this.editable = editable; + }*/ + /* + * Return whether the edit pane is editable, as set by {@link #setEditable(boolean)} + * + public boolean getEditable() + { + return editable; + }*/ + + // ------------------------------ + // DATA EXTRACTION METHODS + // ------------------------------ + + /** + * Overridable getter method.
    + * Get the filter string in its current form. + * This should be overridden if createContents is overridden. + *

    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; + } + /** + * Getter method. Do not override.
    + * Get the selection index of the filter string we are currently editing. + * Used in Change Filter dialog. + */ + public int getCurrentSelectionIndex() + { + return currentSelectionIndex; + } + + /** + * Overridable getter method.
    + * 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; + } + + /** + * Overridable configuration method, called from Change Filter dialog and New Filter wizard.
    + * YOU MUST TEST IF THE GIVEN LABEL IS NULL!
    + * 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. + *

    + * 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. + *

    + * 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... + // ------------------------------ + + /** + * Overridable lifecycle method.
    + * 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(); + } + } + ); + return composite_prompts; + } + /** + * Overridable lifecycle method.
    + * 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; + } + + /** + * Overridable lifecycle method.
    + * 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); + } + /** + * Overridable lifecycle method.
    + * 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(""); + } + } + /** + * Lifecycle method. Do not override.
    + * Instead, override {@link #areFieldsComplete()}. + *

    + * 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; + } + /** + * Overridable lifecycle method.
    + * Must be overridden if createContents is overridden. + *

    + * 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); + } + + /** + * Lifecycle method. Do not override.
    + * Are errors pending? Used in Change Filter dialog to prevent changing the filter string selection + */ + public boolean areErrorsPending() + { // d45795 + return (errorMessage != null); + } + /** + * Lifecycle method. Do not override.
    + * Clear any errors pending. Called when Reset is pressed. + */ + public void clearErrorsPending() + { + errorMessage = null; + } + + // ------------------------------ + // PRIVATE METHODS + // ------------------------------ + /** + * Private method. Do not call or override.
    + * 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. + *

    + * 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. + *

    + * 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; idxPrivate method. Do not call or override.
    + * 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; idxOverridable lifecycle method.
    + * 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 = SystemPlugin.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... + // --------------------------------- + + /** + * Overridable lifecycle method.
    + * Does complete verification of input fields. If this + * method returns null, there are no errors and the dialog or wizard can close. + *

    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... + // ------------------ + + /** + * Overridable lifecycle method.
    + * User has selected something + */ + public void widgetSelected(SelectionEvent event) + { + } + /** + * Overridable lifecycle method.
    + * 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 false, + * 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 true + * @return true to query user to save pending changes, false 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 new file mode 100644 index 00000000000..901a8e23af9 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterUIHelpers.java @@ -0,0 +1,170 @@ +/******************************************************************************** + * 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 java.util.Vector; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement; + + +/** + * + */ +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)&&(idx0)) + { + for (int idx=0; (match==null)&&(idx + //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())); + } + +} \ 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 new file mode 100644 index 00000000000..b91a306daa8 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/ISystemNewFilterActionConfigurator.java @@ -0,0 +1,40 @@ +/******************************************************************************** + * 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. + *

    + * 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 new file mode 100644 index 00000000000..b9a7184e1a0 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterAction.java @@ -0,0 +1,252 @@ +/******************************************************************************** + * 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.filters.actions; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +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, + SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_CHANGEFILTER_ID)); + } + + public SystemChangeFilterAction(Shell parent, String label, String tooltip) + { + this(parent, label, tooltip, SystemPlugin.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(SystemPlugin.HELPPREFIX+"acfr0000"); + } + + + /** + * Set the help context Id (infoPop) for this action. This must be fully qualified by + * plugin ID. + *

    + * 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 (Dialog)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. + *

    + * 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; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionCopyString.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionCopyString.java new file mode 100644 index 00000000000..c4f73ff45ea --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionCopyString.java @@ -0,0 +1,68 @@ +/******************************************************************************** + * 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.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.SystemResources; +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(SystemPlugin.HELPPREFIX+"dufr2000"); + } + + /** + * 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(); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionDeleteString.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionDeleteString.java new file mode 100644 index 00000000000..0a54ccea851 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionDeleteString.java @@ -0,0 +1,69 @@ +/******************************************************************************** + * 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.filters.actions; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.SystemResources; +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(SystemPlugin.HELPPREFIX+"dufr1000"); + } + + /** + * 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(); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionMoveStringDown.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionMoveStringDown.java new file mode 100644 index 00000000000..b6d49889fac --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionMoveStringDown.java @@ -0,0 +1,68 @@ +/******************************************************************************** + * 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.filters.actions; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +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, + SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MOVEDOWN_ID), + null); + allowOnMultipleSelection(false); + this.parentDialog = parentDialog; + setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORDER); + setHelp(SystemPlugin.HELPPREFIX+"dufr5000"); + } + + /** + * 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(); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionMoveStringUp.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionMoveStringUp.java new file mode 100644 index 00000000000..7d45be5d20d --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionMoveStringUp.java @@ -0,0 +1,68 @@ +/******************************************************************************** + * 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.filters.actions; + + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +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, + SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MOVEUP_ID), + null); + allowOnMultipleSelection(false); + this.parentDialog = parentDialog; + setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORDER); + setHelp(SystemPlugin.HELPPREFIX+"dufr4000"); + } + + /** + * 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(); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionPasteString.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionPasteString.java new file mode 100644 index 00000000000..c2e554afc5b --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionPasteString.java @@ -0,0 +1,67 @@ +/******************************************************************************** + * 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.filters.actions; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.SystemResources; +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(SystemPlugin.HELPPREFIX+"dufr3000"); + } + + /** + * 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(); + } +} \ No newline at end of file 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 new file mode 100644 index 00000000000..c6fe913740a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterAction.java @@ -0,0 +1,232 @@ +/******************************************************************************** + * 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.jface.dialogs.Dialog; +import org.eclipse.rse.ui.actions.SystemBaseDialogAction; +import org.eclipse.rse.ui.filters.SystemFilterDialogInputs; +import org.eclipse.rse.ui.filters.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. + *

    + * 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. + *

    + * 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(); + *

    + * 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. + *

    + * Only called if user pressed OK on dialog. + *

    + * @param dlgValue The output of getDialogValue(). + */ + public abstract void doOKprocessing(Object dlgValue); + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..6d2aef0ae33 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterPoolAction.java @@ -0,0 +1,495 @@ +/******************************************************************************** + * 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.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.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.filters.ISystemFilterString; +import org.eclipse.rse.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. + *

    + * 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. + *

    + * By default, tries the following in this order: + *

      + *
    1. calls getFilterPoolManagerProvider if setFilterPoolManagerProvider was called + *
    2. uses what was given in setFilterPoolManagers + *
    3. uses what was given in setFilterPoolReferenceManager, calling its getSystemFilterPoolManagers + *
    4. checks if the current selection is a filterPoolReferenceManager, and if so uses the managers it references from. + *
    + */ + public ISystemFilterPoolManager[] getFilterPoolManagers() + { + ISystemFilterPoolManager[] mgrs = null; + ISystemFilterPoolManagerProvider provider = getFilterPoolManagerProvider(); + if (mgrs == null) + 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 + * 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. + *

    + * 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 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. + *

    + * 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 + */ + 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(); + *

    + * 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. + *

    + * Only called if user pressed OK on dialog. + *

    + * @param dlgValue The output of getDialogValue(). + */ + public abstract void doOKprocessing(Object dlgValue); + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..8c25200ed58 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterPoolWizardAction.java @@ -0,0 +1,87 @@ +/******************************************************************************** + * 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.jface.dialogs.Dialog; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface; +import org.eclipse.rse.ui.filters.dialogs.SystemFilterPoolWizardDialog; +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. + */ + public abstract SystemFilterPoolWizardInterface getFilterPoolWizard(); + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..7a6909fd32a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterWizardAction.java @@ -0,0 +1,85 @@ +/******************************************************************************** + * 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.jface.dialogs.Dialog; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.filters.SystemFilterDialogInterface; +import org.eclipse.rse.ui.filters.dialogs.ISystemFilterWizard; +import org.eclipse.rse.ui.filters.dialogs.SystemFilterWizardDialog; +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(); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCascadingNewFilterPoolReferenceAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCascadingNewFilterPoolReferenceAction.java new file mode 100644 index 00000000000..d6a6fc5bd19 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCascadingNewFilterPoolReferenceAction.java @@ -0,0 +1,135 @@ +/******************************************************************************** + * 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.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.actions.SystemBaseAction; +import org.eclipse.rse.ui.actions.SystemBaseSubMenuAction; +import org.eclipse.rse.ui.view.SystemViewMenuListener; +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, + SystemPlugin.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. + *

    + * 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)); + 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". + * 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. + *

    + * 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)); + 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 + * 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... + *

    + * @see SystemBaseAction#updateSelection(IStructuredSelection) + */ + public boolean updateSelection(IStructuredSelection selection) + { + boolean enable = true; + /* */ + Iterator e= ((IStructuredSelection) 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(IProgressMonitor, Object, Object, String) + */ + protected boolean doCopy(IProgressMonitor monitor, Object targetContainer, Object oldObject, String newName) + 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 SystemPlugin.getPluginMessage(MSG_COPYFILTERS_PROGRESS); + } + /** + * @see SystemBaseCopyAction#getCopyingMessage(String) + */ + protected SystemMessage getCopyingMessage(String oldName) + { + return SystemPlugin.getPluginMessage(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 + * 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... + *

    + * @see SystemBaseAction#updateSelection(IStructuredSelection) + */ + public boolean updateSelection(IStructuredSelection selection) + { + boolean enable = true; + /* */ + Iterator e= ((IStructuredSelection) selection).iterator(); + while (enable && e.hasNext()) + { + Object selectedObject = e.next(); + if (selectedObject instanceof SystemSimpleContentElement) + selectedObject = ((SystemSimpleContentElement)selectedObject).getData(); + if (!(selectedObject instanceof ISystemFilterPool) && + !(selectedObject instanceof ISystemFilterPoolReference)) + enable = false; + // disable if this is a connection-unique filter pool + else if (selectedObject instanceof ISystemFilterPool) + enable = ((ISystemFilterPool)selectedObject).getOwningParentName() == null; + // disable if this is a connection-unique filter pool + else if (selectedObject instanceof ISystemFilterPoolReference) + enable = ((ISystemFilterPoolReference)selectedObject).getReferencedFilterPool().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(IProgressMonitor, Object, Object, String) + */ + protected boolean doCopy(IProgressMonitor monitor, Object targetContainer, Object oldObject, String newName) + 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 SystemPlugin.getPluginMessage(MSG_COPYFILTERPOOLS_PROGRESS); + } + /** + * @see SystemBaseCopyAction#getCopyingMessage(String) + */ + protected SystemMessage getCopyingMessage(String oldName) + { + return SystemPlugin.getPluginMessage(MSG_COPYFILTERPOOL_PROGRESS).makeSubstitution(oldName); + } + /** + * Return complete message + */ + public SystemMessage getCompletionMessage(Object targetContainer, String[] oldNames, String[] newNames) + { + return SystemPlugin.getPluginMessage(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 + * 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... + *

    + * @see SystemBaseAction#updateSelection(IStructuredSelection) + */ + public boolean updateSelection(IStructuredSelection selection) + { + boolean enable = true; + /* */ + Iterator e= ((IStructuredSelection) 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. + *

    + * 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. + *

    + * If you decide to override this, it is your responsibility to issue the error + * message to the user and return false here. + *

    + * @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 = SystemPlugin.getPluginMessage(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(IProgressMonitor, Object, Object, String) + */ + protected boolean doCopy(IProgressMonitor monitor, Object targetContainer, Object oldObject, String newName) + 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 SystemPlugin.getPluginMessage(MSG_COPYFILTERSTRINGS_PROGRESS); + } + /** + * @see SystemBaseCopyAction#getCopyingMessage( String) + */ + protected SystemMessage getCopyingMessage(String oldName) + { + return SystemPlugin.getPluginMessage(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 + * 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= ((IStructuredSelection) 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) + { + } + } + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveDownFilterPoolReferenceAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveDownFilterPoolReferenceAction.java new file mode 100644 index 00000000000..c596e26d092 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveDownFilterPoolReferenceAction.java @@ -0,0 +1,141 @@ +/******************************************************************************** + * 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 java.util.Iterator; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.SystemSortableSelection; +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, + SystemPlugin.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. + *

    + * 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= ((IStructuredSelection) 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((ISystemFilterPoolReference)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); + } + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveFilterAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveFilterAction.java new file mode 100644 index 00000000000..08b6dcc6444 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveFilterAction.java @@ -0,0 +1,372 @@ +/******************************************************************************** + * 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 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.SystemPlugin; +import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +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.swt.widgets.Shell; + + +/** + * Copy a filter action. + */ +public class SystemFilterMoveFilterAction extends SystemBaseCopyAction + implements ISystemMessages +{ + 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); + 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. + *

    + * 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... + *

    + * @see SystemBaseAction#updateSelection(IStructuredSelection) + */ + public boolean updateSelection(IStructuredSelection selection) + { + boolean enable = true; + /* */ + Iterator e= ((IStructuredSelection) 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(IProgressMonitor, Object, Object, String) + */ + protected boolean doCopy(IProgressMonitor monitor, Object targetContainer, Object oldObject, String newName) + 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 SystemPlugin.getPluginMessage(MSG_MOVEFILTERS_PROGRESS); + } + /** + * @see SystemBaseCopyAction#getCopyingMessage( String) + */ + protected SystemMessage getCopyingMessage(String oldName) + { + return SystemPlugin.getPluginMessage(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 + * 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... + *

    + * We intercept to ensure only filterpools from the same filterpool manager are selected. + *

    + * @see SystemBaseAction#updateSelection(IStructuredSelection) + */ + public boolean updateSelection(IStructuredSelection selection) + { + boolean enable = true; + /* */ + Iterator e= ((IStructuredSelection) selection).iterator(); + ISystemFilterPoolManager prevMgr = null; + ISystemFilterPoolManager currMgr = null; + ISystemFilterPool pool; + while (enable && e.hasNext()) + { + Object selectedObject = e.next(); + if (selectedObject instanceof SystemSimpleContentElement) + selectedObject = ((SystemSimpleContentElement)selectedObject).getData(); + if (!(selectedObject instanceof ISystemFilterPool) && + !(selectedObject instanceof ISystemFilterPoolReference)) + enable = false; + // disable if this is a connection-unique filter pool + else if (selectedObject instanceof ISystemFilterPool) + enable = ((ISystemFilterPool)selectedObject).getOwningParentName() == null; + // disable if this is a connection-unique filter pool + else if (selectedObject instanceof ISystemFilterPoolReference) + enable = ((ISystemFilterPoolReference)selectedObject).getReferencedFilterPool().getOwningParentName() == null; + + if (enable) + { + if (selectedObject instanceof ISystemFilterPool) + pool = (ISystemFilterPool)selectedObject; + else + pool = ((ISystemFilterPoolReference)selectedObject).getReferencedFilterPool(); + currMgr = pool.getSystemFilterPoolManager(); + if (prevMgr == null) + prevMgr = currMgr; + else + enable = (prevMgr == currMgr); + if (enable) + prevMgr = currMgr; + } + } + /* */ + 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(IProgressMonitor, Object, Object, String) + */ + protected boolean doCopy(IProgressMonitor monitor, Object targetContainer, Object oldObject, String newName) + 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 SystemPlugin.getPluginMessage(MSG_MOVEFILTERPOOLS_PROGRESS); + } + /** + * @see SystemBaseCopyAction#getCopyingMessage( String) + */ + protected SystemMessage getCopyingMessage(String oldName) + { + return SystemPlugin.getPluginMessage(MSG_MOVEFILTERPOOL_PROGRESS).makeSubstitution(oldName); + } + /** + * Return complete message + */ + public SystemMessage getCompletionMessage(Object targetContainer, String[] oldNames, String[] newNames) + { + return SystemPlugin.getPluginMessage(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 + * 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... + *

    + * @see SystemBaseAction#updateSelection(IStructuredSelection) + */ + public boolean updateSelection(IStructuredSelection selection) + { + boolean enable = true; + /* */ + Iterator e= ((IStructuredSelection) 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. + *

    + * 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. + *

    + * If you decide to override this, it is your responsibility to issue the error + * message to the user and return false here. + *

    + * @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 = SystemPlugin.getPluginMessage(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(IProgressMonitor, Object, Object, String) + */ + protected boolean doCopy(IProgressMonitor monitor, Object targetContainer, Object oldObject, String newName) + 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 SystemPlugin.getPluginMessage(MSG_MOVEFILTERSTRINGS_PROGRESS); + } + /** + * @see SystemBaseCopyAction#getCopyingMessage( String) + */ + protected SystemMessage getCopyingMessage(String oldName) + { + return SystemPlugin.getPluginMessage(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 + * 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= ((IStructuredSelection) 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); + ISystemFilterPoolManager fpMgr = filter.getSystemFilterPoolManager(); + 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) + { + } + } + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveUpFilterPoolReferenceAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveUpFilterPoolReferenceAction.java new file mode 100644 index 00000000000..e00d89ee30d --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveUpFilterPoolReferenceAction.java @@ -0,0 +1,141 @@ +/******************************************************************************** + * 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 java.util.Iterator; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.SystemSortableSelection; +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, + SystemPlugin.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. + *

    + * 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= ((IStructuredSelection) 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((ISystemFilterPoolReference)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); + } + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterNewFilterPoolAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterNewFilterPoolAction.java new file mode 100644 index 00000000000..c15acb6b15f --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterNewFilterPoolAction.java @@ -0,0 +1,174 @@ +/******************************************************************************** + * 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.jface.dialogs.Dialog; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +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.dialogs.SystemFilterNewFilterPoolWizard; +import org.eclipse.rse.ui.filters.dialogs.SystemFilterPoolWizardDialog; +import org.eclipse.rse.ui.filters.dialogs.SystemFilterPoolWizardInterface; +import org.eclipse.rse.ui.filters.dialogs.SystemFilterWorkWithFilterPoolsDialog; +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, + SystemPlugin.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(); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterPoolReferenceSelectAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterPoolReferenceSelectAction.java new file mode 100644 index 00000000000..00b1a287064 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterPoolReferenceSelectAction.java @@ -0,0 +1,85 @@ +/******************************************************************************** + * 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.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; +import org.eclipse.rse.ui.ISystemIconConstants; +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(), SystemPlugin.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. + *

    + * 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); + } + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterRemoveFilterPoolReferenceAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterRemoveFilterPoolReferenceAction.java new file mode 100644 index 00000000000..fa132e15cf9 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterRemoveFilterPoolReferenceAction.java @@ -0,0 +1,94 @@ +/******************************************************************************** + * 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 java.util.Iterator; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +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, + SystemPlugin.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. + *

    + * 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(); + ISystemFilterPoolReference poolReferences[] = new ISystemFilterPoolReference[selections.size()]; + 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 + } + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterSelectFilterPoolsAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterSelectFilterPoolsAction.java new file mode 100644 index 00000000000..fc96b6413e2 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterSelectFilterPoolsAction.java @@ -0,0 +1,268 @@ +/******************************************************************************** + * 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 java.util.Vector; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +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.swt.widgets.Shell; + + +/** + * The action that displays the Select Filter Pools dialog, and which returns + * an array of selected filter pools. + *

    + * 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. + *

    + * Uses getName() on manager for display name of root nodes. + *

    + * 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. + * + *

    + * You call the setFilterPoolManagers method to set the array of filter pool managers + * this dialog allows the user to select from. + *

    + * If you also call the optional method setFilterPoolReferenceManager, you need not + * subclass this action. It will handle everything for you!! + *

      Preselects the filter pools currently referenced by one or more reference objects + * in the filter pool reference manager. + *
    • What OK is pressed, removes the previous references from the reference manager, + * and adds references for the pools selected by the user. + *
    + * + * 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, + SystemPlugin.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(SystemPlugin.HELPPREFIX + "actn0043"); + setDialogHelp(SystemPlugin.HELPPREFIX + "dsfp0000"); + } + /** + * 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(SystemPlugin.HELPPREFIX + "actn0043"); + setDialogHelp(SystemPlugin.HELPPREFIX + "dsfp0000"); + } + + + /** + * 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(SystemPlugin.HELPPREFIX + "actn0043"); + setDialogHelp(SystemPlugin.HELPPREFIX + "dsfp0000"); + } + + + /** + * 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. + *

    + * Assumes setFilterPoolManagers has been called. + *

    + * 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. + *

    + * 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 + * 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 + * By default, if the current selected object implements SystemFilterPoolReferenceManagerProvider, + * then this will call setFilterPoolReferences on that selected object. + *

    + * @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); + } + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterWorkWithFilterPoolsAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterWorkWithFilterPoolsAction.java new file mode 100644 index 00000000000..b01b699d5c4 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterWorkWithFilterPoolsAction.java @@ -0,0 +1,199 @@ +/******************************************************************************** + * 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.jface.dialogs.Dialog; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement; +import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface; +import org.eclipse.rse.ui.filters.SystemFilterPoolManagerUIProvider; +import org.eclipse.rse.ui.filters.SystemFilterUIHelpers; +import org.eclipse.rse.ui.filters.dialogs.SystemFilterWorkWithFilterPoolsDialog; +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, + SystemPlugin.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(SystemPlugin.HELPPREFIX + "actn0044"); + setDialogHelp(SystemPlugin.HELPPREFIX + "dwfp0000"); + } + /** + * 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, + SystemPlugin.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(SystemPlugin.HELPPREFIX + "actn0044"); + setDialogHelp(SystemPlugin.HELPPREFIX + "dwfp0000"); + } + /** + * 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(SystemPlugin.HELPPREFIX + "actn0044"); + setDialogHelp(SystemPlugin.HELPPREFIX + "dwfp0000"); + } + + + /** + * 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) + { + ISystemFilterPoolReferenceManagerProvider sprmp = getReferenceManagerProviderSelection(); + SystemSimpleContentElement initialElementSelection = null; + if (sprmp != null) + { + ISystemFilterPoolManager initialSelection = sprmp.getSystemFilterPoolReferenceManager().getDefaultSystemFilterPoolManager(); + if (initialSelection != null) + { + initialElementSelection = SystemFilterUIHelpers.getDataElement(input, initialSelection); + //if (initialElementSelection != null) + //dialog.setRootToPreselect(initialElementSelection); + } + } + 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) + { + + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterWorkWithFilterPoolsRefreshAllAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterWorkWithFilterPoolsRefreshAllAction.java new file mode 100644 index 00000000000..e82b008a02f --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterWorkWithFilterPoolsRefreshAllAction.java @@ -0,0 +1,82 @@ +/******************************************************************************** + * 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 com.ibm.etools.systems.model.*; +//import com.ibm.etools.systems.model.impl.*; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.actions.SystemBaseAction; +import org.eclipse.swt.widgets.Shell; + + +/** + * The action allows users to refresh the entire Remote Systems 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, + SystemPlugin.getDefault().getImageDescriptorFromIDE(ISystemIconConstants.ICON_IDE_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. + *

    + * 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(); + } +} \ No newline at end of file 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 new file mode 100644 index 00000000000..697017fda8a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemNewFilterAction.java @@ -0,0 +1,492 @@ +/******************************************************************************** + * 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 java.util.Vector; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterContainer; +import org.eclipse.rse.filters.ISystemFilterContainerReference; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider; +import org.eclipse.rse.filters.ISystemFilterPoolSelectionValidator; +import org.eclipse.rse.filters.ISystemFilterPoolWrapperInformation; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +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. + *

    + * 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 verbage = 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_NEWFILE_TOOLTIP, + SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWFILTER_ID), false); + } + + // ------------------------ + // CONFIGURATION METHODS... + // ------------------------ + + /** + * Configuration method. Do not override.
    + * 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; + } + /** + * Configuration method. Do not override.
    + * Set the help context Id (infoPop) for this action. This must be fully qualified by + * plugin ID. + *

    + * 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); + } + /** + * Configuration method. Do not override.
    + * 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; + } + /** + * Configuration method. Do not override.
    + * 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; + } + /** + * Configuration method. Do not override.
    + * This is an alternative to {@link #setAllowFilterPoolSelection(ISystemFilterPool[])} + *

    + * 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. + *

    + * 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 verbage 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; + } + + /** + * Configuration method. Do not override.
    + * 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. + *

    This will also result in a call to setType(String) on the filter string edit pane, which + * sets the type instance variable in case your edit pane subclass needs to know. + */ + public void setType(String type) + { + this.type = type; + } + /** + * Getter method. Do not override.
    + * Get the type of filter as set by {@link #setType(String)} + */ + public String getType() + { + return type; + } + /** + * Configuration method. Do not override.
    + * 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; + } + /** + * Configuration method. Do not override.
    + * Call this if you want the new filter to have some default filter strings. + */ + public void setDefaultFilterStrings(String[] defaultFilterStrings) + { + this.defaultFilterStrings = defaultFilterStrings; + } + /** + * Configuration method. Do not override.
    + * 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. + *

    + * 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. + *

    + * For convenience, when this is called, setShowInfoPage(false) is called for you + */ + public void setShowNamePrompt(boolean show) + { + showNamePrompt = show; + } + /** + * Configuration method. Do not override.
    + * Call in order to not show the final info-only page of the wizard. Default is true. + * @see #setVerbage(String) + */ + public void setShowInfoPage(boolean show) + { + showInfoPage = show; + } + /** + * Configuration method. Do not override.
    + * Set the verbage 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 setVerbage(String verbage) + { + this.verbage = verbage; + } + /** + * Configuration method. Do not override.
    + * Set the description to display on the first page of the wizard + */ + public void setPage1Description(String description) + { + this.page1Description = description; + } + /** + * Configuration method. Do not override.
    + * Set if we are creating a filter for use in the RSE or not. This affects the + * tips and help. + *

    + * 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; + } + /** + * Configuration method. Do not override.
    + * 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; + } + + /** + * Configuration method. Do not override.
    + * Specify an edit pane that prompts the user for the contents of a filter string. + */ + public void setFilterStringEditPane(SystemFilterStringEditPane editPane) + { + this.editPane = editPane; + } + + /** + * Configuration method. Do not override.
    + * Specify the help to show for the name page (page 2) + */ + public void setNamePageHelp(String helpId) + { + this.namePageHelp = helpId; + } + + // ---------------------- + // OVERRIDABLE METHODS... + // ---------------------- + /** + * Overridable configuration method.
    + * Overridable extension. For those cases when you don't want to create your + * own wizard subclass, but prefer to simply configure the default wizard. + *

    + * 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. + *

    By default, this does nothing. + */ + protected void configureNewFilterWizard(SystemNewFilterWizard wizard) + { + } + + /** + * Overridable configuration method.
    + * Configure the new filter created by the wizard. This is only called after + * successful completion of the wizard + *

    By default, this does nothing. + */ + protected void configureNewFilter(ISystemFilter newFilter) + { + } + + // -------------------- + // LIFECYCLE METHODS... + // -------------------- + + /** + * Lifecyle method. Do not override. Instead override {@link #createNewFilterWizard(ISystemFilterPool)}.
    + * The default processing for the run method calls createDialog, which + * in turn calls this method to return an instance of our wizard.
    + * Our default implementation is to call createNewFilterWizard. + *

    + * 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 (verbage != null) + wizard.setVerbage(verbage); + if (page1Description != null) + wizard.setPage1Description(page1Description); + if (filterPoolSelectionValidator != null) + wizard.setFilterPoolSelectionValidator(filterPoolSelectionValidator); + if (editPane != null) + wizard.setFilterStringEditPane(editPane); + ISystemFilterPoolReferenceManagerProvider provider = getSystemFilterPoolReferenceManagerProvider(); + //SystemPlugin.logDebugMessage(this.getClass().getName(),"Inside createWizard. null? " + (provider==null)); + wizard.setSystemFilterPoolReferenceManagerProvider(provider); + configureNewFilterWizard(wizard); + return wizard; + } + + /** + * Overridable lifecyle method.
    + * Create and return the actual wizard. + * By default this returns an instance of {@link org.eclipse.rse.filters.ui.wizards.SystemNewFilterWizard}. + *

    + * You can avoid creating your own wizard subclass by instead overriding + * {@link #configureNewFilterWizard(SystemNewFilterWizard)} + */ + protected SystemNewFilterWizard createNewFilterWizard(ISystemFilterPool parentPool) + { + return new SystemNewFilterWizard(parentPool); + } + /** + * Lifecyle method. Do not override. Instead override {@link #configureNewFilter(ISystemFilter)}.
    + * 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); + } + + /** + * Lifecyle method. No need to override.
    + * 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... + // ----------------- + + /** + * Output method. Do not override.
    + * 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; + } + + /** + * Output method. Do not override.
    + * 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(). + *

    + * 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; + } + + /** + * Output method. Do not override.
    + * 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. + *

    + * 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; idxOutput method. Do not override.
    + * Shortcut to getFilterStrings()[0]. + */ + public String getFilterString() + { + String[] strings = getFilterStrings(); + if ((strings!=null) && (strings.length>0)) + return strings[0]; + else + return null; + } +} \ No newline at end of file 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 new file mode 100644 index 00000000000..16cfab45ade --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/ISystemFilterWizard.java @@ -0,0 +1,26 @@ +/******************************************************************************** + * 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.filters.SystemFilterDialogInterface; +import org.eclipse.rse.ui.wizards.ISystemWizard; + + +public interface ISystemFilterWizard + extends ISystemWizard, SystemFilterDialogInterface +{ +} \ No newline at end of file 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 new file mode 100644 index 00000000000..5b7ff29e868 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/ISystemNewFilterWizardConfigurator.java @@ -0,0 +1,121 @@ +/******************************************************************************** + * 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; + +/** + * 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. + *

    + * 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 verbage for the name prompt on page 2 + */ + public String getPage2NameVerbage(); + /** + * Return the verbage for the pool prompt on page 3 + */ + public String getPage2PoolVerbage(); + /** + * Return the verbage tooltip for the name prompt on page 2 + */ + public String getPage2PoolVerbageTip(); + /** + * 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(); + + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..edad4280b59 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemChangeFilterDialog.java @@ -0,0 +1,365 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemPageCompleteListener; +import org.eclipse.rse.ui.SystemResources; +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.
    + * 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(SystemPlugin.HELPPREFIX+"dufr0000"); + } + + // INPUT/CONFIGURATION + /** + * Configuration method
    + * Specify an edit pane that prompts the user for the contents of a filter string. + */ + public void setFilterStringEditPane(SystemFilterStringEditPane editPane) + { + this.editPane = editPane; + } + /** + * Configuration method
    + * 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. + *

    + * 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); + } + /** + * Configuration method
    + * 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. + *

    + * 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); + } + + /** + * Configuration method
    + * 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(); + } + + /** + * Configuration method
    + * 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(); + } + + /** + * Configuration method
    + * 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(); + } + + /** + * Configuration method
    + * Call this to specify a validator for the filter string. It will be called per keystroke. + * A default validator is supplied otherwise: ValidatorFilterString. + *

    + * Your validator should extend ValidatorFilterString to inherited the uniqueness error checking. + *

    + * 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(); + } + /** + * Configuration method
    + * 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(); + } + + /** + * Configuration method
    + * 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.
    + * 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 null if there is no parent shell + */ + public Shell getParentShell() + { + return super.getParentShell(); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterNewFilterPoolWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterNewFilterPoolWizard.java new file mode 100644 index 00000000000..8bf37f441a7 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterNewFilterPoolWizard.java @@ -0,0 +1,197 @@ +/******************************************************************************** + * 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.filters.dialogs; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +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.SystemResources; +import org.eclipse.rse.ui.filters.SystemFilterPoolDialogOutputs; +import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction; +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, + SystemPlugin.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()); + } + } + + + /** + * 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)&&(idxISystemValidator
    object. + * If the ISystemValidator 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; + if (iiv instanceof ISystemValidator) + limit = ((ISystemValidator)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; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterNewFilterPoolWizardMainPageInterface.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterNewFilterPoolWizardMainPageInterface.java new file mode 100644 index 00000000000..e7e3f092414 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterNewFilterPoolWizardMainPageInterface.java @@ -0,0 +1,71 @@ +/******************************************************************************** + * 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.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(); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterPoolWizardDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterPoolWizardDialog.java new file mode 100644 index 00000000000..78dc6791a3f --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterPoolWizardDialog.java @@ -0,0 +1,83 @@ +/******************************************************************************** + * 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.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.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); + } + + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..155cd6a453b --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterPoolWizardInterface.java @@ -0,0 +1,27 @@ +/******************************************************************************** + * 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.filters.SystemFilterPoolDialogInterface; +import org.eclipse.rse.ui.wizards.ISystemWizard; + +/** + * An interface for filter pool wizards to implement + */ +public interface SystemFilterPoolWizardInterface + extends ISystemWizard, SystemFilterPoolDialogInterface +{ +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterWizardDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterWizardDialog.java new file mode 100644 index 00000000000..69f4db33897 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterWizardDialog.java @@ -0,0 +1,75 @@ +/******************************************************************************** + * 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.dialogs.SystemWizardDialog; +import org.eclipse.rse.ui.filters.SystemFilterDialogInterface; +import org.eclipse.rse.ui.filters.SystemFilterDialogOutputs; +import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterAction; +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); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterWorkWithFilterPoolsDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterWorkWithFilterPoolsDialog.java new file mode 100644 index 00000000000..2e4758b4b76 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterWorkWithFilterPoolsDialog.java @@ -0,0 +1,657 @@ +/******************************************************************************** + * 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.core.runtime.IProgressMonitor; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.ToolBarManager; +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.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; +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.SystemResources; +import org.eclipse.rse.ui.SystemWidgetHelpers; +import org.eclipse.rse.ui.actions.ISystemAction; +import org.eclipse.rse.ui.actions.SystemCommonDeleteAction; +import org.eclipse.rse.ui.actions.SystemCommonRenameAction; +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.SystemFilterPoolManagerUIProvider; +import org.eclipse.rse.ui.filters.SystemFilterUIHelpers; +import org.eclipse.rse.ui.filters.SystemFilterWorkWithFilterPoolsTreeViewer; +import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction; +import org.eclipse.rse.ui.filters.actions.SystemFilterCopyFilterPoolAction; +import org.eclipse.rse.ui.filters.actions.SystemFilterMoveFilterPoolAction; +import org.eclipse.rse.ui.filters.actions.SystemFilterNewFilterPoolAction; +import org.eclipse.rse.ui.filters.actions.SystemFilterWorkWithFilterPoolsRefreshAllAction; +import org.eclipse.rse.ui.messages.ISystemMessageLine; +import org.eclipse.rse.ui.messages.SystemMessageDialog; +import org.eclipse.rse.ui.validators.ValidatorFilterPoolName; +import org.eclipse.rse.ui.view.ISystemPropertyConstants; +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.Label; +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 ISystemMessages, ISystemPropertyConstants, + ISelectionChangedListener, + ISystemDeleteTarget, ISystemRenameTarget, + SystemFilterPoolDialogInterface + //,ISystemResourceChangeListener +{ + + 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 SystemSimpleDeleteAction 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 SystemCommonDeleteAction(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 + * Some guiding design rules for this wizard: + *

      + *
    • 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. + *
    • 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. + *
    + *

    + * While this class can be subclassed, you should find all attributes can be + * configured via setters. + */ +public class SystemNewFilterWizard + extends AbstractSystemWizard +{ + protected SystemNewFilterWizardMainPage mainPage; + protected SystemNewFilterWizardNamePage namePage; + protected SystemNewFilterWizardInfoPage infoPage; + protected ISystemFilterContainer filterContainer; + protected ISystemFilterPool parentPool; + protected ISystemFilterPool[] poolsToSelectFrom; + protected String type; + protected String[] defaultFilterStrings; + //protected String verbage; + //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(), + SystemPlugin.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[])} + *

    + * 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. + *

    + * 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 verbage 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. + *

    + * 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. + *

    + * 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. + *

    + * 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. + *

    + * Will be non-null if the current selection is a reference to a filter pool or filter, + * or a reference manager provider. + *

    + * 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; + //SystemPlugin.logDebugMessage(this.getClass().getName(),"Inside setSystemFilterPoolReferenceManagerProvider. null? " + (provider==null)); + } + /** + * Set the verbage 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 setVerbage(String verbage) + { + if (configurator instanceof SystemNewFilterWizardConfigurator) + ((SystemNewFilterWizardConfigurator)configurator).setPage3Tip1(verbage); + } + /** + * 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". + *

    + * 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. + *

    + * 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; + } + /** + * Extendable point for child classes. You don't need to override typically though. + *

    + * 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 + */ + protected SystemNewFilterWizardNamePage createNamePage() + { + namePage = new SystemNewFilterWizardNamePage(this, parentPool, configurator); + return namePage; + } + /** + * Extendable point for child classes. You don't need to override typically though. + *

    + * 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((WizardPage)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 + * 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() + { + //System.out.println("inside performFinish(): mainPage.performFinish() = " + mainPage.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(); + 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(); + + String type = mainPage.getType(); // query just in case it is changable by user + try + { + newFilter = createNewFilter(getShell(), filterParent, filterName, filterStrings, type); + if (newFilter == null) + return false; + // Because we allow new users to select a profile to create their filter in, from + // which we choose the profile's default filter pool, it is possible the user + // will choose a filter pool 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 the subsystem New Filter action, versus from a filter pool say. + if ((provider != null) && (filterParent instanceof ISystemFilterPool)) + { + ISystemFilterPool parentPool = (ISystemFilterPool)filterParent; + if (provider.getSystemFilterPoolReferenceManager().getReferenceToSystemFilterPool(parentPool) == null) + { + provider.getSystemFilterPoolReferenceManager().addReferenceToSystemFilterPool(parentPool); + } + } + + /* Hmm, after much thought I have decided to leave this up to the + * caller. They can do this themselves by overriding createNewFilter in + * their own wizard. + if (!showFilterStrings && (newFilter!=null)) + { + newFilter.setNonChangable(true); + newFilter.setStringsNonChangable(true); + } + */ + } catch (Exception exc) + { + SystemMessage msg = SystemPlugin.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. + */ + public ISystemFilter createNewFilter(Shell shell, ISystemFilterContainer filterParent, String aliasName, Vector filterStrings, String type) + throws Exception + { + ISystemFilter newFilter = null; + ISystemFilterPoolManager fpMgr = filterParent.getSystemFilterPoolManager(); + //try { + // create filter + if (type == null) + newFilter = fpMgr.createSystemFilter(filterParent,aliasName,filterStrings); + else + newFilter = fpMgr.createSystemFilter(filterParent,aliasName,filterStrings,type); + //} catch (Exception exc) + //{ + //SystemPlugin.logError("Exception in createNewFilter in SystemFilterAbstractNewFilterWizard. ",); + //System.out.println("Exception in createNewFilter in SystemFilterAbstractNewFilterWizard: "+exc.getMessage()); + //exc.printStackTrace(); + //} + 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. + * + * 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 \ No newline at end of file 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 new file mode 100644 index 00000000000..07499e52d28 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardConfigurator.java @@ -0,0 +1,240 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; + +/** + * 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. + *

    + * Your best option is to subclass this and override just those things you want to change. + */ +public class SystemNewFilterWizardConfigurator + implements ISystemNewFilterWizardConfigurator, ISystemIconConstants +{ + // 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_VERBAGE; + this.page3Tip2 = SystemResources.RESID_NEWFILTER_PAGE3_POOLS_VERBAGE; + this.page2Help = SystemPlugin.HELPPREFIX + "nfp20000"; + } + + /** + * 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 SystemPlugin.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 verbage for the name prompt on page 2 + */ + public String getPage2NameVerbage() + { + return SystemResources.RESID_NEWFILTER_PAGE2_NAME_VERBAGE; + } + /** + * Return the verbage for the name prompt on page 2 + */ + public String getPage2PoolVerbage() + { + return SystemResources.RESID_NEWFILTER_PAGE2_POOL_VERBAGE; + } + /** + * Return the verbage tooltip for the name prompt on page 2 + */ + public String getPage2PoolVerbageTip() + { + return SystemResources.RESID_NEWFILTER_PAGE2_POOL_VERBAGE_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; + } + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..ebc61c21eca --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardInfoPage.java @@ -0,0 +1,116 @@ +/******************************************************************************** + * 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.ISystemMessages; +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 + implements ISystemMessages +{ + private ISystemNewFilterWizardConfigurator configurator; + + /** + * Constructor. + */ + public SystemNewFilterWizardInfoPage(SystemNewFilterWizard wizard, boolean filterPoolsShowing, ISystemNewFilterWizardConfigurator data) + { + super(wizard, "NewFilterPage3", data.getPage3Title(), data.getPage3Description()); + 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.createVerbage(composite_prompts, configurator.getPage3Tip1(), nbrColumns, false, 200); + addSeparatorLine(composite_prompts, nbrColumns); + addFillerLine(composite_prompts, nbrColumns); + } + + if (((SystemNewFilterWizard)getWizard()).isFromRSE()) + { + if (configurator.getPage3Tip2() != null) + SystemWidgetHelpers.createVerbage(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 new file mode 100644 index 00000000000..22cf3c76e63 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardMainPage.java @@ -0,0 +1,259 @@ +/******************************************************************************** + * 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.filters.ISystemFilterPoolReferenceManagerProvider; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +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. + *

    + * 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 ISystemMessages, 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()); + 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()); + 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. + *

    + * Will be non-null if the current selection is a reference to a filter pool or filter, + * or a reference manager provider. + *

    + * 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; idx0)) + { + if (parentPool == null) + parentPool = poolsToSelectFrom[0]; + } + } + /** + * This is an alternative to {@link #setAllowFilterPoolSelection(ISystemFilterPool[], ISystemValidator[])} + *

    + * 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. + *

    + * 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 verbage 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.createVerbage(composite_prompts, configurator.getPage2NameVerbage(), 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); + } + + addFillerLine(composite_prompts, nbrColumns); + + if (poolsToSelectFrom != null) + { + poolVerbage = (Label)SystemWidgetHelpers.createVerbage(composite_prompts, configurator.getPage2PoolVerbage(), nbrColumns, false, 200); + poolVerbage.setToolTipText(configurator.getPage2PoolVerbageTip()); + 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= 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]; + } + else if (src == poolWrapperCombo) + { + int selection = poolWrapperCombo.getSelectionIndex(); + if ((selection >= 0) && (nameValidators!=null)) + nameValidator = nameValidators[selection]; + } + else if (src == uniqueCB) + { + boolean selected = uniqueCB.getSelection(); + if (poolVerbage != null) + poolVerbage.setEnabled(!selected); + if (poolCombo != null) + poolCombo.setEnabled(!selected); + 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. + // -------------------------------------------------------------- + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemUnNamedFilterDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemUnNamedFilterDialog.java new file mode 100644 index 00000000000..59b254d9e02 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemUnNamedFilterDialog.java @@ -0,0 +1,215 @@ +/******************************************************************************** + * 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.filters.ISystemFilterPoolReferenceManagerProvider; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +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 ISystemMessages, + 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. + *

    + * Will be non-null if the current selection is a reference to a filter pool or filter, + * or a reference manager provider. + *

    + * 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; + //SystemPlugin.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() + { + } +} \ No newline at end of file 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 new file mode 100644 index 00000000000..42d84997616 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/ISystemMessageLine.java @@ -0,0 +1,90 @@ +/******************************************************************************** + * 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. + *

    + * 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. + *

    + * Setting an error message hides a currently displayed message until + * clearErrorMessage is called. + */ +public interface ISystemMessageLine +{ + + /** + * Clears the currently displayed error message and redisplayes + * the message which was active before the error message was set. + */ + 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 null is returned. + */ + public String getErrorMessage(); + + /** + * Get the currently displayed error text. + * @return The error message. If no error message is displayed null is returned. + */ + public SystemMessage getSystemErrorMessage(); + /** + * Get the currently displayed message. + * @return The message. If no message is displayed null is returned. + */ + public String getMessage(); + + /** + * 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); + + /** + * 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); + /** + * 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 new file mode 100644 index 00000000000..5dfa239664d --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/ISystemMessageLineTarget.java @@ -0,0 +1,33 @@ +/******************************************************************************** + * 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 new file mode 100644 index 00000000000..4fadeb73bc7 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/StatusLineManagerAdapter.java @@ -0,0 +1,123 @@ +/******************************************************************************** + * 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/SystemDialogPageMessageLine.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemDialogPageMessageLine.java new file mode 100644 index 00000000000..d862bcaa516 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemDialogPageMessageLine.java @@ -0,0 +1,391 @@ +/******************************************************************************** + * 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.dialogs.DialogPage; +import org.eclipse.jface.dialogs.IMessageProvider; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.swt.custom.CLabel; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseListener; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.ui.dialogs.PropertyPage; + + +/** + * @deprecated + *

    DO NOT USE THIS CLASS! + *

    This class attempts to wrap the message constructs of eclipse provided property + * and wizard pages with an ISystemMessageLine interface. + * It fails to do this properly and is extremely fragile since it depends on knowledge + * of the internal structure of eclipse provided windows. + *

    Use SystemMessageLine instead. + * @link org.eclipse.rse.core.ui.messages.SystemMessageLine + * + */ +public class SystemDialogPageMessageLine implements ISystemMessageLine, MouseListener { + // cached inputs + private Label msgTextLabel; + private Label msgIconLabel; + private CLabel msgIconCLabel; + private DialogPage dlgPage; + // state + private SystemMessage sysErrorMessage; + private SystemMessage sysMessage; + private boolean stringErrorMessageShowing = false; + + /** + * Factory method for wizard pages. + * We only need to configure a single message line for all pages in a given wizard, + * so this method looks after ensuring there is only one such message line created. + * @param wizardPage - the wizard page we are configuring + */ + public static SystemDialogPageMessageLine createWizardMsgLine(WizardPage wizardPage) { + SystemDialogPageMessageLine msgLine = null; + Composite pageContainer = wizardPage.getControl().getParent(); + Object pageContainerData = null; + //Object pageContainerData = pageContainer.getData(); + //System.out.println("pageContainerData = " + pageContainerData); + if (pageContainerData == null) { + // wizardPage.getControl() => returns the composite we created in createControl + // .getParent() => returns the page container composite created in createPageContainer in WizardDialog, that holds all pages + // .getParent() => returns the composite created in createDialogArea in TitleAreaDialog. The "dialog area" of the dialog below the top stuff, and above the button bar. + // .getParent() => returns the workarea composite created in createContents in TitleAreaDialog + // .getParent() => returns the parent composite passed to createContents in TitleAreaDialog + // .getChildren() => returns the children of this composite, which includes the stuff at the top, which is placed + // there by createTitleArea() in TitleAreaDialog, the parent of WizardDialog + // [0]=> dialog image Label + // [1]=> title Label + // [2]=> message image Label + // [3]=> message Label + // [4]=> filler Label + Composite dialogAreaComposite = pageContainer.getParent(); // see createDialogArea in WizardDialog + Composite workAreaComposite = dialogAreaComposite.getParent(); // see createContents in TitleAreaDialog + Composite mainComposite = workAreaComposite.getParent(); // whatever is passed into createContents in TitleAreaDialog + Control[] list = mainComposite.getChildren(); + Label msgImageLabel = null; + Label msgLabel = null; + if (list[2] instanceof Label) { + msgImageLabel = (Label) list[2]; + } + if (list[3] instanceof Label) { + msgLabel = (Label) list[3]; + } else if (list[4] instanceof Label) { + msgLabel = (Label) list[4]; + } + msgLine = new SystemDialogPageMessageLine(wizardPage, msgImageLabel, msgLabel); + pageContainer.setData(msgLine); + } else + msgLine = (SystemDialogPageMessageLine) pageContainerData; + return msgLine; + } + + /** + * Factory method for property pages. + * We only need to configure a single message line for all pages in a properties dialog, + * so this method looks after ensuring there is only one such message line created. + * @param propertyPage - the property page we are configuring + */ + public static SystemDialogPageMessageLine createPropertyPageMsgLine(PropertyPage propertyPage) { + SystemDialogPageMessageLine msgLine = null; + Composite pageContainer = propertyPage.getControl().getParent(); + // propertyPage.getControl() => returns the composite we created in createControl + // .getParent() => returns the page container composite created in createPageContainer in PreferencesDialog, that holds all pages + // .getParent() => returns the composite created in createDialogArea in PreferencesDialog. This holds the tree, title area composite, page container composite and separator + // .getChildren()[1] => returns the title area parent composite, created in createDialogArea in PreferencesDialog + // .getChildren()[0] => returns the title area composite, created in createTitleArea in PreferencesDialog + // .getChildren() => returns the children of the title area composite + // [0]=> message CLabel + // [1]=> title image + Composite dialogAreaComposite = pageContainer.getParent(); // see createDialogArea in PreferencesDialog + Composite titleAreaParentComposite = (Composite) dialogAreaComposite.getChildren()[1]; + Composite titleAreaComposite = (Composite) titleAreaParentComposite.getChildren()[0]; + //Control[] list=titleAreaComposite.getChildren(); + // DKM - trying to figure out this mess for 3.0 + Composite listContainer = (Composite) titleAreaComposite.getChildren()[0]; + Control[] list = listContainer.getChildren(); + Label label1 = null; + Label label2 = null; + if (list.length > 0) { + label1 = (Label) list[0]; + label2 = (Label) list[1]; + } + msgLine = new SystemDialogPageMessageLine(propertyPage, /*(CLabel)list[0]*/label1, label2); + pageContainer.setData(msgLine); + return msgLine; + } + + /** + * Private constructor. + */ + private SystemDialogPageMessageLine(DialogPage dialogPage, Label msgIconLabel, Label msgTextLabel) { + this.msgIconLabel = msgIconLabel; + this.msgTextLabel = msgTextLabel; + this.dlgPage = dialogPage; + msgIconLabel.addMouseListener(this); + msgTextLabel.addMouseListener(this); + } + + protected SystemMessage getSysErrorMessage() { + return sysErrorMessage; + } + + protected SystemMessage getSysMessage() { + return sysMessage; + } + + /** + * Get the currently displayed error text. + * @return The error message. If no error message is displayed null is returned. + */ + public SystemMessage getSystemErrorMessage() { + return sysErrorMessage; + } + + /** + * Clears the currently displayed error message and redisplayes + * the message which was active before the error message was set. + */ + public void clearErrorMessage() { + sysErrorMessage = null; + stringErrorMessageShowing = false; + dlgPage.setErrorMessage(null); + setIconToolTipText(); + } + + /** + * Clears the currently displayed non-error message. + */ + public void clearMessage() { + dlgPage.setMessage(null); + sysMessage = null; + setIconToolTipText(); + } + + /** + * Get the currently displayed error text. + * @return The error message. If no error message is displayed null is returned. + */ + public String getErrorMessage() { + return dlgPage.getErrorMessage(); + } + + /** + * Get the currently displayed message. + * @return The message. If no message is displayed null is returned. + */ + public String getMessage() { + return dlgPage.getMessage(); + } + + /** + * DO NOT CALL THIS METHOD! IT IS ONLY HERE BECAUSE THE INTERFACE NEEDS IT. + * RATHER, CALL THE SAME MSG THAT DIALOGPAGE NOW SUPPORTS, AND THEN CALL + * setInternalErrorMessage HERE. WE HAVE TO AVOID INFINITE LOOPS. + */ + public void setErrorMessage(String emessage) { + internalSetErrorMessage(emessage); + //dlgPage.setErrorMessage(emessage); + } + + /** + * 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 emessage) { + // I removed @deprecated... I think it was a mistake! What would be the replacement? Phil + if (emessage == null) + clearErrorMessage(); + else { + dlgPage.setErrorMessage(getMessageText(emessage)); + stringErrorMessageShowing = false; + sysErrorMessage = emessage; + logMessage(emessage); + } + setIconToolTipText(); + } + + /** + * Convenience method to set an error message from an exception + */ + public void setErrorMessage(Throwable exc) { + SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_UNEXPECTED); + msg.makeSubstitution(exc); + setErrorMessage(msg); + } + + /** + * DO NOT CALL THIS METHOD! IT IS ONLY HERE BECAUSE THE INTERFACE NEEDS IT. + * RATHER, CALL THE SAME MSG THAT DIALOGPAGE NOW SUPPORTS, AND THEN CALL + * setInternalMessage HERE. WE HAVE TO AVOID INFINITE LOOPS. + */ + public void setMessage(String msg) { + internalSetMessage(msg); + dlgPage.setMessage(msg); + } + + /** + * Set a non-error message to display. + * 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 smessage) { + if (smessage == null) { + clearMessage(); // phil + return; + } + sysMessage = smessage; + int msgType = IMessageProvider.NONE; + if ((smessage.getIndicator() == SystemMessage.ERROR) || (smessage.getIndicator() == SystemMessage.UNEXPECTED)) + msgType = IMessageProvider.ERROR; + else if (smessage.getIndicator() == SystemMessage.WARNING) + msgType = IMessageProvider.WARNING; + else if (smessage.getIndicator() == SystemMessage.INFORMATION || (smessage.getIndicator() == SystemMessage.COMPLETION)) msgType = IMessageProvider.INFORMATION; + dlgPage.setMessage(getMessageText(smessage), msgType); + logMessage(smessage); + setIconToolTipText(); + } + + /** + * logs the message in the appropriate log + */ + private void logMessage(SystemMessage message) { + 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]); + if (message.getIndicator() == SystemMessage.INFORMATION || message.getIndicator() == SystemMessage.INQUIRY || message.getIndicator() == SystemMessage.COMPLETION) + 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) { + if (i == subList.length - 1) + SystemBasePlugin.logError(msg, new Exception()); + else + SystemBasePlugin.logError(msg, null); + } + } + if (subList == null) { + String msg = message.getFullMessageID(); + if (message.getIndicator() == SystemMessage.INFORMATION || message.getIndicator() == SystemMessage.INQUIRY || message.getIndicator() == SystemMessage.COMPLETION) + 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, new Exception()); + } + } + + // METHODS THAT NEED TO BE CALLED BY DIALOGPAGE IN THEIR OVERRIDE OF SETMESSAGE OR SETERRORMESSAGE + /** + * Someone has called setMessage(String) on the dialog page. It needs to then call this method + * after calling super.setMessage(String) so we can keep track of what is happening. + */ + public void internalSetMessage(String msg) { + sysMessage = null; // overrides it if it was set + setIconToolTipText(); + } + + /** + * Someone has called setErrorMessage(String) on the dialog page. It needs to then call this method + * after calling super.setErrorMessage(String) so we can keep track of what is happening. + */ + public void internalSetErrorMessage(String msg) { + sysErrorMessage = null; // overrides if it was set + stringErrorMessageShowing = (msg != null); + setIconToolTipText(); + } + + // MOUSeListener INTERFACE METHODS... + /** + * User double clicked with the mouse + */ + public void mouseDoubleClick(MouseEvent event) { + } + + /** + * User pressed the mouse button + */ + public void mouseDown(MouseEvent event) { + } + + /** + * User released the mouse button after pressing it + */ + public void mouseUp(MouseEvent event) { + displayMessageDialog(); + } + + /** + * Method to return the current system message to display. If error message is set, return it, + * else return message. + */ + public SystemMessage getCurrentMessage() { + if (sysErrorMessage != null) + return sysErrorMessage; + else if (!stringErrorMessageShowing) + return sysMessage; + else + return null; + } + + /** + * Method to display an error message when the msg button is clicked + */ + private void displayMessageDialog() { + SystemMessage currentMessage = getCurrentMessage(); + if (currentMessage != null) { + SystemMessageDialog msgDlg = new SystemMessageDialog(dlgPage.getShell(), currentMessage); + msgDlg.openWithDetails(); + } + } + + /** + * Method to set the tooltip text on the msg icon to tell the user they can press it for more details + */ + private void setIconToolTipText() { + SystemMessage msg = getCurrentMessage(); + String tip = ""; + if (msg != null) { + //String levelTwo = msg.getLevelTwoText(); + //if ((levelTwo!=null) && (levelTwo.length()>0)) + tip = msg.getFullMessageID() + " " + SystemResources.RESID_MSGLINE_TIP; + } + if (msgIconLabel != null) msgIconLabel.setToolTipText(tip); + if (msgTextLabel != null) + msgTextLabel.setToolTipText(tip); + else + msgIconCLabel.setToolTipText(tip); + } + + /** + * Return the message text to display in the title area, given a system message + */ + private String getMessageText(SystemMessage msg) { + //return msg.getFullMessageID()+" " + msg.getLevelOneText(); + return msg.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 new file mode 100644 index 00000000000..780fa2be892 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageDialog.java @@ -0,0 +1,727 @@ +/******************************************************************************** + * 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 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.resource.JFaceResources; +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.IndicatorException; +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.swt.SWT; +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.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + + + +/** + */ +public class SystemMessageDialog extends ErrorDialog { + + /** + * Reserve room for this many list items. + */ + private static final int LIST_ITEM_COUNT = 5; + + /** + * The Details button. + */ + private Button detailsButton=null; + /** + * The title of the dialog. + */ + private String title; + + /** + * 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: IStatus). + */ + 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.

    + * 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; + + /** + * 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(), + (IStatus)(new MultiStatus(SystemBasePlugin.getBaseDefault().getSymbolicName(), IStatus.OK, "", new Exception(""))), + 0xFFFFF); + ((MultiStatus)this.status).add(new Status(IStatus.INFO, SystemBasePlugin.getBaseDefault().getSymbolicName(), IStatus.OK, message.getLevelTwoText(), new Exception(""))); + 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.title = (dialogTitle == null) ? JFaceResources.getString("Problem_Occurred"): //$NON-NLS-1$ + dialogTitle; + this.status = status; + statusList = Arrays.asList(status.getChildren()); + this.displayMask = displayMask; + setShellStyle(SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL); + } + + 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 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); + } + +// 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); + + 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 + * Also logs the first level text plus exception. + */ + public int openWithDetails(Exception exc) + { + showDetails=true; + SystemBasePlugin.logError(message.getLevelOneText(), exc); + return open(); + } + + /** + * opens the dialog with Yes, No, Details button for an Inquiry/Question message + * Throws an IndicatorException if the message is not an Inquiry message + * returns true if Yes was pressed, False if No was pressed. + */ + public boolean openQuestion() throws IndicatorException + { + if (message.getIndicator()!=SystemMessage.INQUIRY) + throw new IndicatorException("Message "+message.getFullMessageID()+" is not an inquiry message."); + yesNoButtons=true; + open(); + return (buttonIdPressed==IDialogConstants.YES_ID); + } + /** + * opens the dialog with Yes, No, Details button for an Inquiry/Question message. + * Eats up the IndicatorException, so only call this when you know what you are doing! + */ + public boolean openQuestionNoException() + { + yesNoButtons=true; + open(); + return (buttonIdPressed==IDialogConstants.YES_ID); + } + + /** + * opens the dialog with Yes, No, Cancel Details for an Inquiry/Question message + * throws an IndicatorException if the indicator is not Inquiry + * @returns 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(" "); + } + sb.append(status.getMessage()); + list.append(sb.toString()); + IStatus[] children = status.getChildren(); + for (int i = 0; i < children.length; i++) + { + list.append("\n"); + 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(); + Point oldSize = 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); + Point oldSize = 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); + Point buttonSize=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 Display.getCurrent().getActiveShell(); + } + + /** + * 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); + msgDlg.open(); + } + + /** + * For ease of use for simple messages which are the result of an exception + */ + public static void displayErrorMessage(Shell shell, SystemMessage msg, Exception exc) + { + SystemMessageDialog msgDlg = new SystemMessageDialog(shell, msg); + msgDlg.setException(exc); + msgDlg.open(); + } + + /** + * For ease of use for simple error message text with no response from user. + */ + public static void displayErrorMessage(Shell shell, String msgText) + { + SystemMessage msg = SystemPlugin.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 = SystemPlugin.getPluginMessage(ISystemMessages.MSG_GENERIC_I); + msg.makeSubstitution(msgText); + displayErrorMessage(shell,msg); + } + + + + /** + * Display this wrapped system message to the user + */ + public static void displayMessage(org.eclipse.swt.widgets.Shell shell, SystemMessageException msgEx) + { + if (msgEx != null) + SystemMessageDialog.displayErrorMessage(shell, 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 = SystemPlugin.getPluginMessage(ISystemMessages.MSG_GENERIC_E); + msg.makeSubstitution(hostMsg); + SystemMessageDialog msgDlg = new SystemMessageDialog(shell, msg); + msgDlg.open(); + } + + /** + * 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 = SystemPlugin.getPluginMessage(ISystemMessages.MSG_GENERIC_E_HELP); + msg.makeSubstitution(hostMsg,levelTwo); + SystemMessageDialog msgDlg = new SystemMessageDialog(shell, msg); + msgDlg.open(); + } + + /** + * For ease of use for simple host warning messages that are xlated already. + */ + public static void displayHostWarningMessage(Shell shell, String hostMsg) + { + SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_GENERIC_W); + msg.makeSubstitution(hostMsg); + SystemMessageDialog msgDlg = new SystemMessageDialog(shell, msg); + msgDlg.open(); + } + + /** + * 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 = SystemPlugin.getPluginMessage(ISystemMessages.MSG_GENERIC_W_HELP); + msg.makeSubstitution(hostMsg,levelTwo); + SystemMessageDialog msgDlg = new SystemMessageDialog(shell, msg); + msgDlg.open(); + } + + /** + * For displaying a generic error message when an unexpected exception happens. + */ + public static void displayExceptionMessage(Shell shell, Exception 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); + msgDlg.open(); + } + + + /** + * When an exception occurs and you want to turn it into a SystemMessage, + * call this... + */ + public static SystemMessage getExceptionMessage(Shell shell, Exception exc) + { + SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_EXCEPTION_OCCURRED); + msg.makeSubstitution(exc); + return msg; + } + + /** + * Put up an error message when the error msg framework itself doesn't work. + */ + public static void showExceptionMessage(Shell shell, String msg, Exception exc) + { + org.eclipse.swt.widgets.MessageBox mb = new org.eclipse.swt.widgets.MessageBox(null); + //mb.setTitle("Remote Systems Programming Error"); + mb.setMessage(msg); + 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; + SystemMessageDialog msgDlg = new SystemMessageDialog(shell, msg); + + if (msg.getIndicator() != SystemMessage.INQUIRY) + msgDlg.open(); + else + yes = msgDlg.openQuestionNoException(); + return yes; + } + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..e4e3eb861b2 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageLine.java @@ -0,0 +1,657 @@ +/******************************************************************************** + * 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 java.util.Stack; +import org.eclipse.jface.resource.ColorRegistry; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +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.SystemResources; +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 + * clearErrorMessage is called. + */ +public class SystemMessageLine + extends Composite + implements ISystemMessageLine +{ + + private Button moreButton; + private Label image; + private Text widget; + private Stack messageStack = new Stack(); + 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-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 = ""; + 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 = SystemPlugin.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. + */ + 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(SystemPlugin.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 = getTopMessage(); + 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(); + } + }); + + showTopMessage(); + + } + + /* (non-Javadoc) + * @see org.eclipse.rse.ui.messages.ISystemMessageLine#clearErrorMessage() + */ + public void clearErrorMessage() { + MyMessage message = getTopMessage(); + if (message != null && message.isError()) { + popMessage(); + } + } + + /* (non-Javadoc) + * @see org.eclipse.rse.ui.messages.ISystemMessageLine#clearMessage() + */ + public void clearMessage() { + MyMessage message = getTopMessage(); + if (message != null && !message.isError()) { + popMessage(); + } + } + + /* (non-Javadoc) + * @see org.eclipse.rse.ui.messages.ISystemMessageLine#getErrorMessage() + */ + public String getErrorMessage() { + MyMessage message = getTopMessage(); + if (message != null && message.isError()) return message.getText(); + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.rse.ui.messages.ISystemMessageLine#getMessage() + */ + public String getMessage() { + MyMessage message = getTopMessage(); + if (message != null && !message.isError()) return message.getText(); + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.rse.ui.messages.ISystemMessageLine#getSystemErrorMessage() + */ + public SystemMessage getSystemErrorMessage() { + MyMessage message = getTopMessage(); + if (message != null && message.isError()) return message.toSystemMessage(); + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(java.lang.String) + */ + public void setErrorMessage(String message) { + MyMessage temp = new MyImpromptuMessage(ERROR, message); + pushMessage(temp); + } + + /* (non-Javadoc) + * @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(org.eclipse.rse.services.clientserver.messages.SystemMessage) + */ + public void setErrorMessage(SystemMessage message) { + MyMessage temp = new MySystemMessage(message); + pushMessage(temp); + logMessage(message); + } + + /* (non-Javadoc) + * @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(java.lang.Throwable) + */ + public void setErrorMessage(Throwable throwable) + { + SystemMessage message = SystemPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_UNEXPECTED); + message.makeSubstitution(throwable); + setErrorMessage(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) { + MyMessage temp = new MyImpromptuMessage(INFO, message); + pushMessage(temp); + } + + /** + * Set the non-error message text, using a SystemMessage object. + * If the message line currently displays an error, + * the message is stored and will be shown after a call to clearMessage. + * The SystemMessage text is always shown as a "non-error". + */ + public void setMessage(SystemMessage message) { + MyMessage temp = new MySystemMessage(message); + if (temp.isError()) { + temp = new MyImpromptuMessage(NONE, message.getLevelOneText(), message.getLevelTwoText()); + } + pushMessage(temp); + } + + /** + * Pushes a new message onto the stack and shows it. + * @param message The MyMessage to push on the stack. + */ + private void pushMessage(MyMessage message) { + messageStack.push(message); + showTopMessage(); + } + + /** + * Pops a message off the message stack and shows the new top message. + */ + private void popMessage() { + if (!messageStack.isEmpty()) messageStack.pop(); + showTopMessage(); + } + + /** + * Retrieves the top MyMessage from the stack + * @return A MyMessage or null if the stack is empty. + */ + private MyMessage getTopMessage() { + if (messageStack.isEmpty()) return null; + return (MyMessage) messageStack.peek(); + } + + /** + * Shows the top message on the stack. If the stack is empty it will "show" nothing. + */ + private void showTopMessage() { + MyMessage message = getTopMessage(); + 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 = ""; + String toolTip = null; + Color color = null; + if (message != null) { + text = message.getText(); + toolTip = message.getTooltip(); + color = message.getColor(); + } + widget.setToolTipText(toolTip); + widget.setForeground(color); + widget.setText(text); + widget.setData(text); + 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("..."); + while (n > 0) { + text = head.toString(); + if (gc.stringExtent(text).x <= maxWidth) break; + head.deleteCharAt(--n); + } + if (n == 0) text = ""; + } + 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#"); + buffer.append(Integer.toString(i)); + buffer.append(":"); + buffer.append(object.toString()); + logMessage(m.getType(), buffer.toString(), false); + } + logMessage(m.getType(), m.getID(), m.isStrange()); + } + + /** + * Sends a text message to the log. + * @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) { + switch (type) { + case ERROR: + Exception e = stackTrace ? new Exception("Stack Trace") : null; + SystemBasePlugin.logError(text, e); + break; + case WARNING: + SystemBasePlugin.logWarning(text); + break; + case INFO: + case NONE: + 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 new file mode 100644 index 00000000000..c8d176eb931 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageStatus.java @@ -0,0 +1,153 @@ +/******************************************************************************** + * 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.messages; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.services.clientserver.messages.SystemMessageException; + + +/** + * 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 new file mode 100644 index 00000000000..ccfabb6a5a8 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemUIMessage.java @@ -0,0 +1,93 @@ +/******************************************************************************** + * 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.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 ""; + + if (sub instanceof IStatus) + { + return populateList("", (IStatus)sub); + } + 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"; + 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 new file mode 100644 index 00000000000..46c3fb20bc8 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemUIMessageFile.java @@ -0,0 +1,52 @@ +/******************************************************************************** + * 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.messages; +import org.eclipse.rse.services.clientserver.messages.IndicatorException; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.services.clientserver.messages.SystemMessageFile; + +/** + * @author dmcknigh + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class SystemUIMessageFile extends SystemMessageFile +{ + public SystemUIMessageFile(String messageFileName, + String defaultMessageFileLocation) + { + super(messageFileName, defaultMessageFileLocation); + } + + /** + * 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 new file mode 100644 index 00000000000..5071debd1ac --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/ISystemQuickOpenPage.java @@ -0,0 +1,50 @@ +/******************************************************************************** + * 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 DialogPage. + *

    + * The quick open dialog calls the performAction method when the Ok + * button is pressed. + *

    + * + * @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 true 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 new file mode 100644 index 00000000000..fb0fb2d1d7f --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/ISystemQuickOpenPageContainer.java @@ -0,0 +1,46 @@ +/******************************************************************************** + * 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 IRunnableContext for the search operation + */ + public IRunnableContext getRunnableContext(); + + /** + * Sets the enable state of the perform action button + * of this container. + * + * @param state true 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 new file mode 100644 index 00000000000..0d49a592ac3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemOpenQuickOpenDialogAction.java @@ -0,0 +1,126 @@ +/******************************************************************************** + * 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.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.rse.core.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 null, 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 null. + */ + 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 new file mode 100644 index 00000000000..e704923d0c3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenDialog.java @@ -0,0 +1,802 @@ +/******************************************************************************** + * 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.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"); + // 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 true if current size is smaller than new size, false 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. + * @return + */ + 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 performAction. If the result of calling this method is true + * @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 true if the dialog can be closed, false 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 canceled 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, null 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 true if cancel button should be enabled, false 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); + } + + // 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 aboutToStart. + * @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")); + + 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"); + restoreEnableState(openButton, state, "open"); + ControlEnableState pageState = (ControlEnableState)state.get("tabForm"); + 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 true if cancel button is enabled, false otherwise. + * @return the saved state. + */ + private HashMap saveUIState(boolean keepCancelEnabled) { + HashMap savedState = new HashMap(); + + saveEnableStateAndSet(cancelButton, savedState, "cancel", keepCancelEnabled); + saveEnableStateAndSet(openButton, savedState, "open", false); + savedState.put("tabForm", ControlEnableState.disable(contents)); + + 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 true if control is to be enabled, false 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 false + * indicating the dialog should not be closed. + * @param true if it is ok to close the dialog, false 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"), + null, JFaceResources.getString("WizardClosingDialog.message"), + 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 new file mode 100644 index 00000000000..dad35d6d9e1 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenPageDescriptor.java @@ -0,0 +1,186 @@ +/******************************************************************************** + * 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.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.core.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"; + private final static String ID_ATTRIBUTE = "id"; + private final static String ICON_ATTRIBUTE = "icon"; + private final static String CLASS_ATTRIBUTE = "class"; + private final static String LABEL_ATTRIBUTE = "label"; + private final static String SIZE_ATTRIBUTE = "sizeHint"; + private final static String TAB_POSITION_ATTRIBUTE = "tabPosition"; + // 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); + return null; + } + catch (ClassCastException e) { + SystemBasePlugin.logError("Error trying to create a quick open page from configuration element", e); + 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().getNamespace(); + Bundle bundle = Platform.getBundle(nameSpace); + url = new URL(bundle.getEntry("/"), imageName); + } + catch (java.net.MalformedURLException e) { + SystemBasePlugin.logError("Error trying to get image", e); + 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 Integer.MAX_VALUE 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); + } + } + + return position; + } + + /** + * Returns whether the page is enabled. + * @return true if the page is enabled, false 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 new file mode 100644 index 00000000000..aa225a649e9 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenUI.java @@ -0,0 +1,50 @@ +/******************************************************************************** + * 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.rse.core.SystemBasePlugin; +import org.eclipse.ui.IWorkbenchWindow; + + +public class SystemQuickOpenUI { + + /** + * Constructor. + */ + public SystemQuickOpenUI() { + super(); + } + + /** + * Opens the quick open dialog in the active workbench window. + * If pageId is specified and a corresponding page is found then it is brought to top. + * @param pageId the page to select or null if the best fitting page should be selected. + */ + public static void openSearchDialog(String pageId) { + openSearchDialog(SystemBasePlugin.getActiveWorkbenchWindow(), pageId); + } + + /** + * Opens the quick open dialog. + * If pageId 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 null 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 new file mode 100644 index 00000000000..86f7cca955e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenUtil.java @@ -0,0 +1,120 @@ +/******************************************************************************** + * 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.core.SystemPlugin; + + +/** + * A utility class for quick open. It is a singleton. + */ +public class SystemQuickOpenUtil { + + public static final String QUICK_OPEN_PAGE_EXTENSION_POINT= "quickOpenPages"; + + // 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(SystemPlugin.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 new file mode 100644 index 00000000000..f363cf59520 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/ISystemRunnableContext.java @@ -0,0 +1,41 @@ +/******************************************************************************** + * 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 new file mode 100644 index 00000000000..56c53b718b1 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/Policy.java @@ -0,0 +1,121 @@ +/******************************************************************************** + * 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.text.MessageFormat; +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.team.internal.core.InfiniteSubProgressMonitor; + +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 MessageFormat.format(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/SystemFetchOperation.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemFetchOperation.java new file mode 100644 index 00000000000..77aaff938a6 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemFetchOperation.java @@ -0,0 +1,270 @@ +/******************************************************************************** + * 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.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.jobs.ISchedulingRule; +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.SystemBasePlugin; +import org.eclipse.rse.ui.view.ISystemViewElementAdapter; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchSite; +import org.eclipse.ui.progress.IElementCollector; + + +/** + * @author dmcknigh + */ +public class SystemFetchOperation extends JobChangeAdapter implements IRunnableWithProgress +{ + protected IWorkbenchPart _part; + protected IAdaptable _remoteObject; + protected IElementCollector _collector; + private IRunnableContext context; + protected ISystemViewElementAdapter _adapter; + protected boolean _canRunAsJob; + + public SystemFetchOperation(IWorkbenchPart part, IAdaptable remoteObject, ISystemViewElementAdapter adapter, IElementCollector collector) + { + _part = part; + _remoteObject = remoteObject; + _collector = collector; + _adapter = adapter; + _canRunAsJob = false; + } + + public SystemFetchOperation(IWorkbenchPart part, IAdaptable remoteObject, ISystemViewElementAdapter adapter, IElementCollector collector, boolean canRunAsJob) + { + _part = part; + _remoteObject = remoteObject; + _collector = collector; + _adapter = adapter; + _canRunAsJob = canRunAsJob; + } + + /** + * Return the part that is associated with this operation. + * + * @return Returns the part or null + */ + 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 (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()])); + } + + /** + * 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 + { + Object[] children = _adapter.getChildren(monitor, _remoteObject); + _collector.add(children, monitor); + monitor.done(); + } + + protected String getTaskName() + { + return "RSE test 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 run() 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 null 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. + *

    + * 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 null. + */ + 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 true. This will make their + * action run in a {@link org.eclipse.core.runtime.Job}. + * Subsclass that override this method should + * also override the getJobName() method. + * + * @return true if this action can be run in the background and + * false otherwise. + */ + protected boolean canRunAsJob() { + return _canRunAsJob; + } + + /** + * Return the job name to be used if the action can run as a job. (i.e. + * if canRunAsJob() returns true). + * + * @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 true to keep the operation and false 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; + } +} \ No newline at end of file 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 new file mode 100644 index 00000000000..39a92ab40a5 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemJobRunnableContext.java @@ -0,0 +1,283 @@ +/******************************************************************************** + * 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 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.core.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +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 true if auto-builds will be postponed while this + * context is executing a runnable, false otherwise. + */ + public boolean isPostponeBuild() { + return postponeBuild; + } + + /** + * Sets whether auto-builds will be postponed while this + * context is executing a runnable. + * @param postponeBuild true to postpone auto-builds, false otherwise. + */ + public void setPostponeBuild(boolean postponeBuild) { + this.postponeBuild = postponeBuild; + } + + /** + * Returns the scheduling rule that will be obtained before the context + * executes a runnable, or null if no scheduling rule is to be obtained. + * @return the schedulingRule to be used or null. + */ + public ISchedulingRule getSchedulingRule() { + return schedulingRule; + } + + /** + * Returns whether the job created by this runnable context is user initiated. + * @return true if the job is a result of user initiated actions, false 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 true if the job is a result of user initiated actions, false otherwise. + */ + public void setUser(boolean isUser) { + this.isUser = isUser; + } + + /** + * Sets the scheduling rule that will be obtained before the context + * executes a runnable, or null if no scheduling rule is to be obtained. + * @param schedulingRule the scheduling rule to be used or null. + */ + 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 = ""; + + if (target != null) { + msg = target.getMessage(); + } + + // return an error status + return new Status(IStatus.ERROR, SystemPlugin.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 new file mode 100644 index 00000000000..02c827f98f8 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemProgressDialogRunnableContext.java @@ -0,0 +1,200 @@ +/******************************************************************************** + * 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 true if the auto-build will be postponed while this + * context is executing a runnable, false otherwise. + */ + public boolean isPostponeBuild() { + return postponeBuild; + } + + /** + * Sets whether the auto-build will be postponed while this + * context is executing a runnable. + * @param postponeBuild true to postpone the auto-build, falsenull if no scheduling rule is to be obtained. + * @return the scheduling rule to be obtained or null. + */ + public ISchedulingRule getSchedulingRule() { + return schedulingRule; + } + + /** + * Sets the scheduling rule that will be obtained before the context + * executes a runnable or null if no scheduling rule is to be obtained. + * @param schedulingRule the scheduling rule to be obtained or null. + */ + 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 new file mode 100644 index 00000000000..6b2bbb675bf --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemSchedulingRule.java @@ -0,0 +1,46 @@ +/******************************************************************************** + * 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 new file mode 100644 index 00000000000..badc89e9ba7 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/AbstractSystemSubSystemPropertyPageCoreForm.java @@ -0,0 +1,221 @@ +/******************************************************************************** + * 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.wizard.WizardPage; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +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 ISystemMessages, 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); + SystemPlugin sp = SystemPlugin.getDefault(); + } + /** + * 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, " "); + + // Name display + labelText = SystemWidgetHelpers.appendColon(SystemResources.RESID_SUBSYSTEM_NAME_LABEL); + labelNamePrompt = SystemWidgetHelpers.createLabel(composite_prompts, labelText); + labelName = SystemWidgetHelpers.createLabel(composite_prompts, " "); + + // Connection display + labelText = SystemWidgetHelpers.appendColon(SystemResources.RESID_SUBSYSTEM_CONNECTION_LABEL); + labelConnectionPrompt = SystemWidgetHelpers.createLabel(composite_prompts, labelText); + labelConnection = SystemWidgetHelpers.createLabel(composite_prompts, " "); + + // Profile display + labelText = SystemWidgetHelpers.appendColon(SystemResources.RESID_SUBSYSTEM_PROFILE_LABEL); + labelProfilePrompt = SystemWidgetHelpers.createLabel(composite_prompts, labelText); + labelProfile = SystemWidgetHelpers.createLabel(composite_prompts, " "); + + 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(); + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..9391d4d6111 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemConnectionWizardErrorUpdater.java @@ -0,0 +1,28 @@ +/******************************************************************************** + * 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/ISystemConnectionWizardPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemConnectionWizardPropertyPage.java new file mode 100644 index 00000000000..09c86635a80 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemConnectionWizardPropertyPage.java @@ -0,0 +1,32 @@ +/******************************************************************************** + * 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.rse.core.subsystems.IConnectorService; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; + +/** + * interface for a property page that can be shown in the new connection wizard + */ +public interface ISystemConnectionWizardPropertyPage +{ + public boolean applyValues(IConnectorService subsystem); + public void setSubSystemFactory(ISubSystemConfiguration factory); + public void setHostname(String hostname); + public void setSystemType(String systemType); +} \ 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 new file mode 100644 index 00000000000..d72999205b3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemSubSystemPropertyPageCoreForm.java @@ -0,0 +1,48 @@ +/******************************************************************************** + * 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 + *

    + * 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/RemoteSystemsPreferencePage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/RemoteSystemsPreferencePage.java new file mode 100644 index 00000000000..5b5ac719b17 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/RemoteSystemsPreferencePage.java @@ -0,0 +1,681 @@ +/******************************************************************************** + * 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.propertypages; + +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.StringTokenizer; + +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.SystemType; +import org.eclipse.rse.internal.model.SystemPreferenceChangeEvent; +import org.eclipse.rse.model.ISystemPreferenceChangeEvents; +import org.eclipse.rse.ui.ISystemPreferencesConstants; +import org.eclipse.rse.ui.Mnemonics; +import org.eclipse.rse.ui.SystemConnectionForm; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.SystemWidgetHelpers; +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; + + +/** + * Root preference page for Remote Systems Plugin + */ +public class RemoteSystemsPreferencePage + extends FieldEditorPreferencePage implements IWorkbenchPreferencePage, + ISystemPreferencesConstants +{ + private SystemBooleanFieldEditor showFilterPoolsEditor; + private SystemBooleanFieldEditor qualifyConnectionNamesEditor; + private SystemBooleanFieldEditor rememberStateEditor; + private SystemBooleanFieldEditor useDeferredQueryEditor; + + // 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(SystemPlugin.getDefault().getPreferenceStore()); + setDescription(SystemResources.RESID_PREF_ROOT_TITLE); + } + /** + * We intercept to set the help + */ + public void createControl(Composite parent) + { + super.createControl(parent); + } + + /** + * GUI widgets for preferences page + */ + protected void createFieldEditors() + { + // DEFAULT SYSTEM TYPE + SystemComboBoxFieldEditor systemTypeEditor = new SystemComboBoxFieldEditor( + ISystemPreferencesConstants.SYSTEMTYPE, + SystemResources.RESID_PREF_SYSTEMTYPE_PREFIX_LABEL, + SystemPlugin.getDefault().getSystemTypeNames(), + true, // readonly + getFieldEditorParent() + ); + systemTypeEditor.setToolTipText(SystemResources.RESID_PREF_SYSTEMTYPE_PREFIX_TOOLTIP); + addField(systemTypeEditor); + + // 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); + + // USE DEFERRED QUERY + useDeferredQueryEditor = new SystemBooleanFieldEditor( + ISystemPreferencesConstants.USE_DEFERRED_QUERIES, + SystemResources.RESID_PREF_USEDEFERREDQUERIES_PREFIX_LABEL, + getFieldEditorParent()) + ; + addField(useDeferredQueryEditor); + useDeferredQueryEditor.setToolTipText(SystemResources.RESID_PREF_USEDEFERREDQUERIES_PREFIX_TOOLTIP); + lastUseDeferredQueryValue = getPreferenceStore().getBoolean(useDeferredQueryEditor.getPreferenceName()); + + /** FIXME - UDA should not be so coupled to core + * might need a new preference page for this + // CASCADE USER-DEFINED ACTIONS BY PROFILE + SystemBooleanFieldEditor cascadeUDAsEditor = new SystemBooleanFieldEditor( + ISystemPreferencesConstants.CASCADE_UDAS_BYPROFILE, + SystemUDAResources.RESID_PREF_UDAS_CASCADEBYPROFILE_LABEL, + getFieldEditorParent() + ); + addField(cascadeUDAsEditor); + cascadeUDAsEditor.setToolTipText(SystemUDAResources.RESID_PREF_UDAS_CASCADEBYPROFILE_TOOLTIP); + lastCascadeUDAsValue = getPreferenceStore().getBoolean(cascadeUDAsEditor.getPreferenceName()); + **/ + // set mnemonics + (new Mnemonics()).setOnPreferencePage(true).setMnemonics(getFieldEditorParent()); + + // set help + SystemWidgetHelpers.setCompositeHelp(getFieldEditorParent(), SystemPlugin.HELPPREFIX+"rsep0000"); + } + + // --------------------------------------------------------- + // GETTERS/SETTERS FOR EACH OF THE USER PREFERENCE VALUES... + // --------------------------------------------------------- + /** + * Return the names of the profiles the user has elected to make "active". + */ + public static String[] getActiveProfiles() + { + IPreferenceStore store = SystemPlugin.getDefault().getPreferenceStore(); + return parseStrings(store.getString(ISystemPreferencesConstants.ACTIVEUSERPROFILES)); + } + + /** + * Set the names of the profiles the user has elected to make "active". + */ + public static void setActiveProfiles(String[] newProfileNames) + { + IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore(); + store.setValue(ISystemPreferencesConstants.ACTIVEUSERPROFILES, makeString(newProfileNames)); + savePreferenceStore(); + } + + /** + * Return the ordered list of connection names. This is how user arranged his connections in the system view. + */ + public static String[] getConnectionNamesOrder() + { + IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore(); + return parseStrings(store.getString(ISystemPreferencesConstants.ORDER_CONNECTIONS)); + } + /** + * Set the ordered list of connection names. This is how user arranged his connections in the system view. + */ + public static void setConnectionNamesOrder(String[] newConnectionNamesOrder) + { + IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore(); + store.setValue(ISystemPreferencesConstants.ORDER_CONNECTIONS, makeString(newConnectionNamesOrder)); + savePreferenceStore(); + } + /** + * Return true if the user has elected to show filter pools in the remote systems explorer view + */ + public static boolean getShowFilterPoolsPreference() + { + IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore(); + return store.getBoolean(ISystemPreferencesConstants.SHOWFILTERPOOLS); + } + /** + * Toggle whether to show filter pools in the remote systems explorer view + */ + public static void setShowFilterPoolsPreference(boolean show) + { + IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore(); + store.setValue(ISystemPreferencesConstants.SHOWFILTERPOOLS,show); + savePreferenceStore(); + } + + /** + * Return true if the user has elected to show the "New Connection..." prompt in the Remote Systems view + */ + public static boolean getShowNewConnectionPromptPreference() + { + IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore(); + boolean value = store.getBoolean(ISystemPreferencesConstants.SHOWNEWCONNECTIONPROMPT); + return value; + } + /** + * Toggle whether to show filter pools in the remote systems explorer view + */ + public static void setShowNewConnectionPromptPreference(boolean show) + { + IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore(); + store.setValue(ISystemPreferencesConstants.SHOWNEWCONNECTIONPROMPT,show); + savePreferenceStore(); + } + + /** + * Return true if the user has elected to show connection names qualified by profile + */ + public static boolean getQualifyConnectionNamesPreference() + { + IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore(); + return store.getBoolean(ISystemPreferencesConstants.QUALIFY_CONNECTION_NAMES); + } + /** + * Set if the user has elected to show connection names qualified by profile + */ + public static void setQualifyConnectionNamesPreference(boolean set) + { + IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore(); + store.setValue(ISystemPreferencesConstants.QUALIFY_CONNECTION_NAMES,set); + savePreferenceStore(); + } + + /** + * Return true if the user has elected to remember the state of the Remote Systems view + */ + public static boolean getRememberStatePreference() + { + IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore(); + return store.getBoolean(ISystemPreferencesConstants.REMEMBER_STATE); + } + /** + * Set if the user has elected to show connection names qualified by profile + */ + public static void setRememberStatePreference(boolean set) + { + IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore(); + store.setValue(ISystemPreferencesConstants.REMEMBER_STATE,set); + savePreferenceStore(); + } + + /** + * Return true if the user has elected to restore the state of the Remote Systems view from cached information + */ + public static boolean getRestoreStateFromCachePreference() + { + IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore(); + 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 + */ + public static void setRestoreStateFromCachePreference(boolean set) + { + IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore(); + store.setValue(ISystemPreferencesConstants.RESTORE_STATE_FROM_CACHE, set); + savePreferenceStore(); + } + + /** + * Return true if the user has elected to show user defined actions cascaded by profile + */ + public static boolean getCascadeUserActionsPreference() + { + IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore(); + return store.getBoolean(ISystemPreferencesConstants.CASCADE_UDAS_BYPROFILE); + } + /** + * Set if the user has elected to show user defined actions cascaded by profile + */ + public static void setCascadeUserActionsPreference(boolean set) + { + IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore(); + store.setValue(ISystemPreferencesConstants.CASCADE_UDAS_BYPROFILE,set); + savePreferenceStore(); + } + /** + * Return the userId to default to on the Create Connection wizard, per the given system type. + * + * @see SystemConnectionForm + */ + public static String getUserIdPreference(String systemType) + { + if (systemType == null) + return null; + SystemType[] systemTypes = SystemPlugin.getDefault().getAllSystemTypes(false); + SystemType type = SystemType.getSystemType(systemTypes, systemType); + if (type != null) + return type.getDefaultUserID(); + else + return null; + } + + /** + * Set the default userId per the given system type. + */ + public static void setUserIdPreference(String systemType, String userId) + { + SystemType[] systemTypes = SystemPlugin.getDefault().getAllSystemTypes(false); + SystemType type = SystemType.getSystemType(systemTypes, systemType); + if (type != null) + type.setDefaultUserID(userId); + else + return; + // following needs to stay in synch with modify() method in SystemTypeFieldEditor... + String value = SystemPlugin.getDefault().getPreferenceStore().getString(ISystemPreferencesConstants.SYSTEMTYPE_VALUES); + Hashtable keyValues = null; + if ((value == null) || (value.length()==0)) // not initialized yet? + { + keyValues = new Hashtable(); + // nothing to do, as we have read from systemtype extension points already + } + else + { + keyValues = parseString(value); + } + keyValues.put(type.getName(),SystemType.getPreferenceStoreString(type)); + String s = SystemTypeFieldEditor.createString(keyValues); + + if (s != null) + SystemPlugin.getDefault().getPreferenceStore().setValue(ISystemPreferencesConstants.SYSTEMTYPE_VALUES, s); + + savePreferenceStore(); + } + + + /** + * Return the hashtable where the key is a string identifying a particular object, and + * the value is the user Id for that object. + */ + public static Hashtable getUserIdsPerKey() + { + IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore(); + Hashtable keyValues = null; + String value = store.getString(ISystemPreferencesConstants.USERIDPERKEY); + if (value != null) + keyValues = parseString(value); + else + { + keyValues = new Hashtable(); + } + return keyValues; + } + /** + * Set/store the user ids that are saved keyed by some key. + */ + public static void setUserIdsPerKey(Hashtable uidsPerKey) + { + IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore(); + store.setValue(ISystemPreferencesConstants.USERIDPERKEY, makeString(uidsPerKey)); + savePreferenceStore(); + } + + /** + * Return the System type to default to on the Create Connection wizard. + * + * @see SystemConnectionForm + */ + public static String getSystemTypePreference() + { + IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore(); + return store.getString(ISystemPreferencesConstants.SYSTEMTYPE); + } + + /** + * Return the history for the folder combo box widget + */ + public static String[] getFolderHistory() + { + return getWidgetHistory(ISystemPreferencesConstants.HISTORY_FOLDER); + } + /** + * Set the history for the folder combo box widget. + */ + public static void setFolderHistory(String[] newHistory) + { + setWidgetHistory(ISystemPreferencesConstants.HISTORY_FOLDER, newHistory); + } + /** + * Return the history for a widget given an arbitrary key uniquely identifying it + */ + public static String[] getWidgetHistory(String key) + { + IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore(); + return parseStrings(store.getString(key)); + } + /** + * Set the history for a widget given an arbitrary key uniquely identifying it. + */ + public static void setWidgetHistory(String key, String[] newHistory) + { + IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore(); + store.setValue(key, makeString(newHistory)); + savePreferenceStore(); + } + + + // ------------------------------------------------- + // MISCELLANEOUS METHODS... + // ------------------------------------------------- + + /** + * Parse out list of key-value pairs into a hashtable + */ + protected static Hashtable parseString(String allvalues) + { + StringTokenizer tokens = new StringTokenizer(allvalues, "=;"); + 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 static String makeString(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('='); + sb.append(value); + sb.append(';'); + } + } + return sb.toString(); + } + + /** + * Parse out list of multiple values into a string array per value + */ + protected static String[] parseStrings(String allvalues) + { + if (allvalues == null) + return new String[0]; + //StringTokenizer tokens = new StringTokenizer(allvalues, ";"); + String[] tokens = allvalues.split(";"); + return tokens; + /* + Vector v = new Vector(); + int idx=0; + while (tokens.hasMoreTokens()) + v.addElement(tokens.nextToken()); + String keyValues[] = new String[v.size()]; + for (idx=0;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 = SystemPlugin.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.clearPasswordCache(); + } + } + } + } + } + } + } + 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/SystemAbstractPropertyPageExtensionAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemAbstractPropertyPageExtensionAction.java new file mode 100644 index 00000000000..a30a1f46950 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemAbstractPropertyPageExtensionAction.java @@ -0,0 +1,250 @@ +/******************************************************************************** + * 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.propertypages; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.SystemWidgetHelpers; +import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.ui.IWorkbenchPropertyPage; + + + +/** + * This is a base class to simplify the creation of remote object property pages supplied via the + * org.eclipse.rse.core.propertyPages extension point. + *

    + * This class extends {@link SystemBasePropertyPage} and so inherits the benefits of that class.
    + * To get these benefits though, you must override {@link #createContentArea(Composite)} versus the + * usual createContents(Composite) method.. + *

    + * The benefits of this class are:

    + *
      + *
    • From {@link SystemBasePropertyPage}: Adds a message line and {@link org.eclipse.rse.ui.messages.ISystemMessageLine} message methods. + *
    • From {@link SystemBasePropertyPage}: Automatically assigns mnemonics to controls on this page, simplifying this common task. See {#wantMnemonics()}. + *
    • From {@link SystemBasePropertyPage}: For pages with input controls, simplifies the page validation burden: only one method need be overridden: {@link #verifyPageContents()} + *
    • From {@link SystemBasePropertyPage}: If no Default and Apply buttons wanted, the area reserved for this is removed, removing extra white space. + *
    • Supplies helper method {@link #getRemoteObject()} for querying the selected remote object. + *
    • Supplies helper methods getRemoteObjectXXX() for querying the attributes of the selected remote object. + *
    • Supplies helper methods to query the {@link #getSubSystem() subsystem} and {@link #getSystemConnection() connection} containing the selected remote object. + *
    + * If your property page is for a file-system file or folder, use {@link SystemAbstractRemoteFilePropertyPageExtensionAction}. + */ +public abstract class SystemAbstractPropertyPageExtensionAction + //extends PropertyPage implements IWorkbenchPropertyPage + extends SystemBasePropertyPage implements IWorkbenchPropertyPage +{ + protected static final Object[] EMPTY_ARRAY = new Object[0]; + + /** + * Constructor + */ + public SystemAbstractPropertyPageExtensionAction() + { + super(); + // ensure the page has no special buttons + noDefaultAndApplyButton(); + } + + // ------------------------ + // OVERRIDABLE METHODS... + // ------------------------ + /** + * Abstract. You must override.
    + * 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); + + /** + * You may override if your page has input fields. By default returns true.
    + * 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. + *

    + * Subclasses should override to do full error checking on all the widgets on the page. Recommendation:
    + *

      + *
    • If an error is detected, issue a {@link org.eclipse.rse.ui.messages.SystemMessage} via {@link #setErrorMessage(SystemMessage)} or text message via {@link #setErrorMessage(String)}. + *
    • If no errors detected, clear the message line via {@link #clearErrorMessage()} + *
    + * + * @return true if there are no errors, false if any errors were found. + */ + protected boolean verifyPageContents() + { + return true; + } + + // --------------------------------------------- + // CONVENIENCE METHODS FOR SUBCLASSES TO USE... + // --------------------------------------------- + /** + * Retrieve the input remote object + * @see #getRemoteAdapter(Object) + */ + public Object getRemoteObject() + { + return getElement(); + } + /** + * Retrieve the adapter of the input remote object as an ISystemRemoteElementAdapter object, for convenience. + * Will be null if there is nothing selected + */ + public ISystemRemoteElementAdapter getRemoteAdapter() + { + return getRemoteAdapter(getElement()); + } + /** + * Returns the implementation of ISystemRemoteElementAdapter 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); + } + + /** + * Returns the name of the input remote object + */ + public String getRemoteObjectName() + { + return getRemoteAdapter().getName(getRemoteObject()); + } + /** + * Returns the id of the subsystem factory of the input remote object. + */ + public String getRemoteObjectSubSystemFactoryId() + { + return getRemoteAdapter().getSubSystemFactoryId(getRemoteObject()); + } + /** + * Returns the type category of the input remote object + */ + public String getRemoteObjectTypeCategory() + { + return getRemoteAdapter().getRemoteTypeCategory(getRemoteObject()); + } + /** + * Returns the type of the input remote object + */ + public String getRemoteObjectType() + { + return getRemoteAdapter().getRemoteType(getRemoteObject()); + } + /** + * Returns the subtype of the input remote object + */ + public String getRemoteObjectSubType() + { + return getRemoteAdapter().getRemoteSubType(getRemoteObject()); + } + /** + * Returns the sub-subtype of the input remote object + */ + public String getRemoteObjectSubSubType() + { + return getRemoteAdapter().getRemoteSubSubType(getRemoteObject()); + } + /** + * Returns the subsystem from which the input remote object was resolved + */ + public ISubSystem getSubSystem() + { + return getRemoteAdapter().getSubSystem(getRemoteObject()); + } + /** + * Returns the subsystem factory which owns the subsystem from which the input remote object was resolved + */ + public ISubSystemConfiguration getSubSystemFactory() + { + ISubSystem ss = getSubSystem(); + if (ss != null) + return ss.getSubSystemConfiguration(); + else + return null; + } + + /** + * Return the SystemConnection from which the selected remote objects were resolved + */ + public IHost getSystemConnection() + { + IHost conn = null; + ISubSystem ss = getRemoteAdapter().getSubSystem(getRemoteObject()); + if (ss != null) + conn = ss.getHost(); + return conn; + } + + + + /** + * Debug method to print out details of given selected object, in a composite GUI widget... + */ + protected Composite createTestComposite(Composite parent) + { + // Inner composite + int nbrColumns = 2; + Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns); + + //System.out.println("Remote object name................: " + getRemoteObjectName()); + //System.out.println("Remote object subsystem factory id: " + getRemoteObjectSubSystemFactoryId()); + //System.out.println("Remote object type category.......: " + getRemoteObjectTypeCategory()); + //System.out.println("Remote object type ...............: " + getRemoteObjectType()); + //System.out.println("Remote object subtype ............: " + getRemoteObjectSubType()); + //System.out.println("Remote object subsubtype .........: " + getRemoteObjectSubSubType()); + + SystemWidgetHelpers.createLabel(composite_prompts, "Remote object name: "); + SystemWidgetHelpers.createLabel(composite_prompts, checkForNull(getRemoteObjectName())); + + SystemWidgetHelpers.createLabel(composite_prompts, "Remote object subsystem factory id: "); + SystemWidgetHelpers.createLabel(composite_prompts, checkForNull(getRemoteObjectSubSystemFactoryId())); + + SystemWidgetHelpers.createLabel(composite_prompts, "Remote object type category: "); + SystemWidgetHelpers.createLabel(composite_prompts, checkForNull(getRemoteObjectTypeCategory())); + + SystemWidgetHelpers.createLabel(composite_prompts, "Remote object type: "); + SystemWidgetHelpers.createLabel(composite_prompts, checkForNull(getRemoteObjectType())); + + SystemWidgetHelpers.createLabel(composite_prompts, "Remote object subtype: "); + SystemWidgetHelpers.createLabel(composite_prompts, checkForNull(getRemoteObjectSubType())); + + SystemWidgetHelpers.createLabel(composite_prompts, "Remote object subsubtype: "); + SystemWidgetHelpers.createLabel(composite_prompts, checkForNull(getRemoteObjectSubSubType())); + + return composite_prompts; + } + + /** + * Check for null, and if so, return "" + */ + private String checkForNull(String input) + { + if (input == null) + return ""; + else + return input; + } + +} \ 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 new file mode 100644 index 00000000000..5d88db78604 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemBasePropertyPage.java @@ -0,0 +1,536 @@ +/******************************************************************************** + * 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.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +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.SystemDialogPageMessageLine; +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: + *
      + *
    • Adds a message line and {@link org.eclipse.rse.ui.messages.ISystemMessageLine} message methods. + *
    • Automatically assigns mnemonics to controls on this page, simplifying this common task. See {#wantMnemonics()}. + *
    • If no Default and Apply buttons wanted (default), the area reserved for this is removed, removing extra white space. + *
    • For pages with input controls, simplifies the page validation burden: only one method need be overridden: {@link #verifyPageContents()} + *
      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. + *
      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. + *
    + *

    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. + *

    + * + */ +public abstract class SystemBasePropertyPage extends PropertyPage + implements ISystemMessages, 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(); + } + + /** + * Parent intercept. No need to call or override.
    + * 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; + } + + /** + * Configuration method. Override only to change the default.
    + * 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 false. + */ + protected boolean wantDefaultAndApplyButton() + { + return false; + } + + /** + * Configuration method. Override only to change the default.
    + * Return false if you don't want to have mnemonics automatically applied to your page + * by this parent class. Default is true. + */ + protected boolean wantMnemonics() + { + return true; + } + /** + * Configuration method. Override only to change the default.
    + * Return false if you don't want to automatically set whether the page is valid based + * on error message status. Default is true + */ + protected boolean wantAutomaticValidManagement() + { + return true; + } + + /** + * 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 (contentArea != null) + { + SystemWidgetHelpers.setHelp(contentArea, helpId); + SystemWidgetHelpers.setHelp(contentArea, helpId); + //SystemWidgetHelpers.setCompositeHelp(parentComposite, helpId, helpIdPerControl); + //SystemWidgetHelpers.setCompositeHelp(buttonsComposite, helpId, helpIdPerControl); + } + this.helpId = helpId; + } + + /** + * Abstract. You must override.
    + * 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); + + + /** + * Private. No need to call or override.
    + * 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); + } + + /** + * Private. No need to call or override.
    + * 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(); + } + } + } + + /** + * Parent intercept. No need to call or override.
    + * The PreferencePage implementation of this + * IPreferencePage method returns true + * if the page is valid. + *

    + * 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. + *

    + * 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; + } + + /** + * Abstract. You must override. Return true if no input fields to check.
    + * 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. + *

    + * Subclasses should override to do full error checking on all the widgets on the page. Recommendation:
    + *

      + *
    • If an error is detected, issue a {@link org.eclipse.rse.ui.messages.SystemMessage} via {@link #setErrorMessage(SystemMessage)} or text message via {@link #setErrorMessage(String)}. + *
    • If no errors detected, clear the message line via {@link #clearErrorMessage()} + *
    + * + * @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... + // ----------------------------------- + /** + * ISystemMessageLineTarget method.
    + * 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); + } + /** + * ISystemMessageLineTarget method.
    + * Get the message line to use for issuing messages + */ + public ISystemMessageLine getMessageLine() + { + //if (msgLineSet) + // return msgLine; + //else + return this; + } + + // ----------------------------- + // Helper methods... + // ----------------------------- + /** + * Helper method.
    + * 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; + } + } + + /** + * Helper method.
    + * 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; + } + /** + * Helper method.
    + * 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, ResourceBundle, 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, ResourceBundle, 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, ResourceBundle, 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 verbage 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, ResourceBundle, String) + * @see #grabExcessSpace(Control) + */ + protected Label createLabeledVerbage(Composite c, String label, String tooltip) + { + Label verbage = SystemWidgetHelpers.createLabeledVerbage(c, label, tooltip, 1, false, 200); + GridData gd = (GridData)verbage.getLayoutData(); + if (gd != null) + { + gd.grabExcessHorizontalSpace = true; + gd.horizontalIndent = 10; + } + return verbage; + } + // ----------------------------- + // ISystemMessageLine methods... + // ----------------------------- + /** + * ISystemMessageLine method.
    + * 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); + } + /** + * ISystemMessageLine method.
    + * Clears the currently displayed message. + */ + public void clearMessage() + { + if (msgLine!=null) + msgLine.clearMessage(); + else + super.setMessage(null); + } + /** + * ISystemMessageLine method.
    + * Get the currently displayed error text. + * @return The error message. If no error message is displayed null is returned. + */ + public SystemMessage getSystemErrorMessage() + { + if (msgLine!=null) + return msgLine.getSystemErrorMessage(); + else + return null; + } + /** + * ISystemMessageLine method.
    + * 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) + ((SystemDialogPageMessageLine)msgLine).internalSetErrorMessage(message); + } + + /** + * ISystemMessageLine method.
    + * 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); + } + /** + * ISystemMessageLine method.
    + * Convenience method to set an error message from an exception + */ + public void setErrorMessage(Throwable exc) + { + if (msgLine != null) + msgLine.setErrorMessage(exc); + } + + /** + * ISystemMessageLine method.
    + * 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()); + } + /** + * ISystemMessageLine method.
    + * 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) + ((SystemDialogPageMessageLine)msgLine).internalSetMessage(message); + } + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..c8ebc67c413 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemBooleanFieldEditor.java @@ -0,0 +1,109 @@ +/******************************************************************************** + * 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.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; + + /** + * 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 DEFAULT or + * SEPARATE_LABEL + * @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); + } + + /** + * 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); + } + /** + * 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); + setToolTipText(rb.getString(labelKey+"tooltip")); + } + + /** + * 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; + } +} \ 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 new file mode 100644 index 00000000000..1efc2805ff3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemChangeFilterPropertyPage.java @@ -0,0 +1,316 @@ +/******************************************************************************** + * 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.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.core.subsystems.SubSystemConfiguration; +import org.eclipse.rse.core.subsystems.SubSystemHelpers; +import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.ISystemPageCompleteListener; +import org.eclipse.rse.ui.SystemPropertyResources; +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.validators.ISystemValidator; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +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 com.ibm.etools.systems.filters.SystemFilter or + * com.ibm.systems.filters.SystemFilterReference. + *

    + * If you have your own change filter dialog (versus configuring ours) you must configure this + * pane yourself by overriding {@link SubSystemConfiguration#customizeChangeFilterPropertyPage(SystemChangeFilterPropertyPage, ISystemFilter, Shell)} + * and configuring the pane as described in that method's javadoc. + */ +public class SystemChangeFilterPropertyPage extends SystemBasePropertyPage + implements ISystemMessages, ISystemPageCompleteListener, ISystemChangeFilterPaneEditPaneSupplier +{ + + protected String errorMessage; + protected boolean initDone = false; + + protected SystemChangeFilterPane changeFilterPane; + protected SystemFilterStringEditPane editPane; + + /** + * Constructor for SystemFilterPropertyPage + */ + public SystemChangeFilterPropertyPage() + { + super(); + SystemPlugin sp = SystemPlugin.getDefault(); + changeFilterPane = new SystemChangeFilterPane(null, this, this); + changeFilterPane.addPageCompleteListener(this); + setHelp(SystemPlugin.HELPPREFIX+"dufr0000"); + } + + // INPUT/CONFIGURATION + /** + * Configuration method
    + * Specify an edit pane that prompts the user for the contents of a filter string. + */ + public void setFilterStringEditPane(SystemFilterStringEditPane editPane) + { + this.editPane = editPane; + } + /** + * Configuration method
    + * 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) + *

    + * 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); + } + /** + * Configuration method
    + * 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) + *

    + * 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); + } + + /** + * Configuration method
    + * Set the Parent Filter Pool prompt label and tooltip text. + */ + public void setParentPoolPromptLabel(String label, String tip) + { + changeFilterPane.setParentPoolPromptLabel(label, tip); + } + /** + * Configuration method
    + * Set the name prompt label and tooltip text. + */ + public void setNamePromptLabel(String label, String tip) + { + changeFilterPane.setNamePromptLabel(label, tip); + } + /** + * Configuration method
    + * 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); + } + /** + * Configuration method
    + * Call this to specify a validator for the filter string. It will be called per keystroke. + * A default validator is supplied otherwise: ValidatorFilterString. + *

    + * Your validator should extend ValidatorFilterString to inherited the uniqueness error checking. + *

    + * 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); + } + /** + * Configuration method
    + * 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); + } + /** + * Configuration method
    + * 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!"); + + } + changeFilterPane.setShell(shell); + + ISystemFilter selectedFilter = getFilter(); + if (selectedFilter.isPromptable()) + { + 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.getParentSubSystemFactory(selectedFilter); + ISubsystemConfigurationAdapter 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 new file mode 100644 index 00000000000..dac346064f2 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemComboBoxFieldEditor.java @@ -0,0 +1,497 @@ +/******************************************************************************** + * 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 = ""; + contentArray = new String[contents.size()]; + for (int idx=0; idx + * The control is created if it does not yet exist + *

    + * + * @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 && (idxVALUE
    property) provided that the old and + * new values are different. + *

    + * This hook is not called when the text is initialized + * (or reset to the default value) from the preference store. + *

    + */ + 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/SystemCommunicationsPreferencePage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemCommunicationsPreferencePage.java new file mode 100644 index 00000000000..acdb985e9d3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemCommunicationsPreferencePage.java @@ -0,0 +1,134 @@ +/******************************************************************************** + * 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.FieldEditorPreferencePage; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.IntegerFieldEditor; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.comm.SystemCommunicationsDaemon; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.ISystemPreferencesConstants; +import org.eclipse.rse.ui.Mnemonics; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.SystemWidgetHelpers; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + + +/** + * Preference page for generic Remote System communication preferences + */ +public class SystemCommunicationsPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage +{ + + + private IntegerFieldEditor portEditor; + + /** + * Constructor + */ + public SystemCommunicationsPreferencePage() + { + super(GRID); + setPreferenceStore(SystemPlugin.getDefault().getPreferenceStore()); + setDescription(SystemResources.RESID_PREF_COMMUNICATIONS_TITLE); + } + + /** + * Configure the composite. We intercept to set the help. + */ + public void createControl(Composite parent) + { + super.createControl(parent); + } + + + /** + * + */ + protected void createFieldEditors() + { + Composite parent= getFieldEditorParent(); + + // Auto-start the daemon preference + SystemBooleanFieldEditor autoStartEditor = new SystemBooleanFieldEditor( + ISystemPreferencesConstants.DAEMON_AUTOSTART, + SystemResources.RESID_PREF_DAEMON_AUTOSTART_LABEL, + parent + ); + autoStartEditor.setToolTipText(SystemResources.RESID_PREF_DAEMON_AUTOSTART_TOOLTIP); + addField(autoStartEditor); + + + // Daemon port preference + portEditor = new IntegerFieldEditor( + ISystemPreferencesConstants.DAEMON_PORT, + SystemResources.RESID_PREF_DAEMON_PORT_LABEL, + parent + ); + portEditor.setValidRange(1, 65536); + portEditor.setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_PORT_NOTVALID).getLevelOneText()); + addField(portEditor); + portEditor.getTextControl(parent).setToolTipText(SystemResources.RESID_PREF_DAEMON_PORT_TOOLTIP); + + SystemWidgetHelpers.setHelp(portEditor.getTextControl(parent), SystemPlugin.HELPPREFIX + "cmmp0000"); + + + (new Mnemonics()).setOnPreferencePage(true).setMnemonics(parent); + SystemWidgetHelpers.setCompositeHelp(parent, SystemPlugin.HELPPREFIX + "cmmp0000"); + + } + + /** + * Inherited method. + */ + public void init(IWorkbench workbench) + { + } + + /** + * Set default preferences for the communications preference page. + * + * @param store PreferenceStore used for this preference page. + */ + public static void initDefaults(IPreferenceStore store) + { + store.setDefault(ISystemPreferencesConstants.DAEMON_AUTOSTART, ISystemPreferencesConstants.DEFAULT_DAEMON_AUTOSTART); + store.setDefault(ISystemPreferencesConstants.DAEMON_PORT, ISystemPreferencesConstants.DEFAULT_DAEMON_PORT); + } + + /** + * @see FieldEditorPreferencePage#performOk() + */ + public boolean performOk() { + // Restart the communications daemon if required + int port = portEditor.getIntValue(); + SystemCommunicationsDaemon daemon = SystemCommunicationsDaemon.getInstance(); + + // Restart communications daemon if it is already running and the + // port number has changed + if (daemon.isRunning() && port != daemon.getPort()) { + SystemCommunicationsDaemon.getInstance().stopDaemon(); + SystemCommunicationsDaemon.getInstance().startDaemon(); + } + + return super.performOk(); + + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemConnectionPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemConnectionPropertyPage.java new file mode 100644 index 00000000000..22d5f9a174c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemConnectionPropertyPage.java @@ -0,0 +1,168 @@ +/******************************************************************************** + * 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.rse.core.ISystemTypes; +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.ui.ISystemConnectionFormCaller; +import org.eclipse.rse.ui.SystemConnectionForm; +import org.eclipse.rse.ui.SystemWidgetHelpers; +import org.eclipse.rse.ui.messages.ISystemMessageLine; +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 com.ibm.etools.systems.model.SystemConnection + */ +public class SystemConnectionPropertyPage extends SystemBasePropertyPage + implements ISystemMessageLine, ISystemConnectionFormCaller +{ + + protected SystemConnectionForm form; + protected String parentHelpId; + + /** + * Constructor for SystemConnectionPropertyPage + */ + public SystemConnectionPropertyPage() + { + super(); + SystemPlugin sp = SystemPlugin.getDefault(); + + parentHelpId = SystemPlugin.HELPPREFIX + "pcon0000"; + 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); + // 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 = SystemPlugin.getDefault().getSystemRegistry(); + sr.updateHost( getShell(),conn,conn.getSystemType(),form.getConnectionName(), + form.getHostName(), form.getConnectionDescription(), + form.getDefaultUserId(), form.getUserIdLocation() ); + + + 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(getShell(), false); + } catch (InterruptedException e) { + // user cancelled disconnect + cancelled = true; + } catch (Exception e) { + SystemBasePlugin.logError("SystemConnectionPropertyPage.performOk", e); + } + } + } + + // check that everything was disconnedted okay and this is not the local connection + if(sr.isAnySubSystemConnected(conn) && !ISystemTypes.SYSTEMTYPE_LOCAL.equals(conn.getSystemType())) + { + // backout changes, likely because user cancelled the disconnect + sr.setHostOffline(conn, false); + okToClose = false; + } + } + } + } + return okToClose; + } + + /** + * Validate all the widgets on the page + *

    + * 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(String systemType, boolean duringInitialization) + { + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemConnectionSubSystemsPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemConnectionSubSystemsPropertyPage.java new file mode 100644 index 00000000000..05e8916c103 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemConnectionSubSystemsPropertyPage.java @@ -0,0 +1,391 @@ +/******************************************************************************** + * 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.core.runtime.IAdaptable; +import org.eclipse.rse.core.SystemAdapterHelpers; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.ui.ISystemConnectionFormCaller; +import org.eclipse.rse.ui.SystemPropertyResources; +import org.eclipse.rse.ui.SystemTabFolderLayout; +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.view.ISystemRemoteElementAdapter; +import org.eclipse.rse.ui.view.ISystemViewElementAdapter; +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 com.ibm.etools.systems.model.SystemConnection + + + */ +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(); + SystemPlugin sp = SystemPlugin.getDefault(); + parentHelpId = SystemPlugin.HELPPREFIX + "pcon0000"; + } + + /** + * 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]; + PropertyPage page = ss.getPropertyPage(tabFolder); + + if (page != null) + { + page.setContainer(getContainer()); + } + + if ((page != null) && (page instanceof IWorkbenchPropertyPage)) + { + ((IWorkbenchPropertyPage)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; idxPreferencePage implementation of this + * IPreferencePage method returns true + * if the page is valid. + *

    + * 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 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 + *

    + * 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 getAdapter(Object o) + { + return SystemAdapterHelpers.getAdapter(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(String systemType, boolean duringInitialization) + { + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemConnectorServicesPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemConnectorServicesPropertyPage.java new file mode 100644 index 00000000000..0f7cefc4304 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemConnectorServicesPropertyPage.java @@ -0,0 +1,88 @@ +/******************************************************************************** + * 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.propertypages; + +import org.eclipse.rse.core.subsystems.IConnectorService; +import org.eclipse.rse.model.IHost; +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(); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterPoolPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterPoolPropertyPage.java new file mode 100644 index 00000000000..cba40bae38c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterPoolPropertyPage.java @@ -0,0 +1,126 @@ +/******************************************************************************** + * 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.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.ui.SystemPropertyResources; +import org.eclipse.rse.ui.SystemResources; +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 filter pool properties. + * This is an output-only page. + * The plugin.xml file registers this for objects of class com.ibm.etools.systems.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(); + SystemPlugin sp = SystemPlugin.getDefault(); + } + /** + * 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()); + } + + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterPoolReferencePropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterPoolReferencePropertyPage.java new file mode 100644 index 00000000000..61ef94958c5 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterPoolReferencePropertyPage.java @@ -0,0 +1,117 @@ +/******************************************************************************** + * 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.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.ui.SystemResources; +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 filter pool properties. + * This is an output-only page. + * The plugin.xml file registers this for objects of class com.ibm.etools.systems.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(); + SystemPlugin sp = SystemPlugin.getDefault(); + } + /** + * 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(); + ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration(); + + // name + labelName.setText(pool.getName()); + // subsystem + labelSubSystem.setText(ss.getName()); + // connection + labelConnection.setText(ss.getHostAliasName()); + // profile + labelProfile.setText(ss.getSystemProfileName()); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterPropertyPage.java new file mode 100644 index 00000000000..ab726376466 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterPropertyPage.java @@ -0,0 +1,135 @@ +/******************************************************************************** + * 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.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.ui.SystemResources; +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 filter properties. + * This is an output-only page. + * The plugin.xml file registers this for objects of class com.ibm.etools.systems.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(); + SystemPlugin sp = SystemPlugin.getDefault(); + } + /** + * 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); + 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); + } + } + +} \ 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 new file mode 100644 index 00000000000..dac3af36cb8 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterStringPropertyPage.java @@ -0,0 +1,340 @@ +/******************************************************************************** + * 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.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider; +import org.eclipse.rse.filters.ISystemFilterString; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.services.clientserver.messages.SystemMessageException; +import org.eclipse.rse.ui.SystemResources; +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.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 com.ibm.etools.systems.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(); + SystemPlugin sp = SystemPlugin.getDefault(); + } + + // configuration methods, called by customizeFilterStringPropertyPage in SubSystemFactoryImpl... + + /** + * Configuration method
    + * Specify an edit pane that prompts the user for the contents of a filter string. + */ + public void setFilterStringEditPane(SystemFilterStringEditPane editPane) + { + this.editPane = editPane; + } + /** + * Configuration method
    + * 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) + *

    + * 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); + } + /** + * Configuration method
    + * 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) + *

    + * 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); + } + /** + * Configuration method
    + * Call this to specify a validator for the filter string. It will be called per keystroke. + * A default validator is supplied otherwise: ValidatorFilterString. + *

    + * Your validator should extend ValidatorFilterString to inherited the uniqueness error checking. + *

    + * 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; + } + /** + * Configuration method
    + * 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) + { + editable = false; + } + + // 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) + { + Vector existingStrings = filter.getFilterStringsVector(); + 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); + e.printStackTrace(); + SystemMessageDialog.displayMessage(getShell(), e); + ok = false; + } + catch (Exception e) + { + SystemBasePlugin.logError("Error updating filter string from property page", e); + e.printStackTrace(); + SystemMessageDialog.displayExceptionMessage(getShell(), e); + ok = false; + } + + /* + String[] listItems = listView.getItems(); + String[] filterStrings = new String[listItems.length - 1]; + for (int idx=0; idx0)) + { + 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. + *

    + * The control is created if it does not yet exist + *

    + * + * @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 ISystemValidator object. + * If the ISystemValidator 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(""); + 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); + }*/ +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemLoggingPreferencePage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemLoggingPreferencePage.java new file mode 100644 index 00000000000..f328db9fcf4 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemLoggingPreferencePage.java @@ -0,0 +1,35 @@ +/******************************************************************************** + * 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.propertypages; + +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.logging.LoggingPreferencePage; +import org.eclipse.ui.plugin.AbstractUIPlugin; + + +/** + * The logging preference page for Remote Systems. + */ +public class SystemLoggingPreferencePage extends LoggingPreferencePage { + + /** + * @see com.ibm.etools.systems.logging.LoggingPreferencePage#getPlugin() + */ + protected AbstractUIPlugin getPlugin() { + return SystemPlugin.getDefault(); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemPreferenceInitializer.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemPreferenceInitializer.java new file mode 100644 index 00000000000..341ffa27406 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemPreferenceInitializer.java @@ -0,0 +1,41 @@ +/******************************************************************************** + * 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.propertypages; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.rse.core.SystemPlugin; + + +/** + * 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() { + SystemPlugin.getDefault().initializeDefaultPreferences(); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemRemotePropertyPageNode.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemRemotePropertyPageNode.java new file mode 100644 index 00000000000..945bd1680e2 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemRemotePropertyPageNode.java @@ -0,0 +1,90 @@ +/******************************************************************************** + * 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.core.runtime.IAdaptable; +import org.eclipse.jface.preference.PreferenceNode; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.rse.core.SystemPropertyPageExtension; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.IWorkbenchPropertyPage; + + +/** + * Our version of PropertyPageNode that does not require a RegistryPageContributor input. + */ +public class SystemRemotePropertyPageNode extends PreferenceNode +{ + + private SystemPropertyPageExtension contributor; + private IWorkbenchPropertyPage page; + private Image icon; + private IAdaptable element; + /** + * Constructor. + */ + public SystemRemotePropertyPageNode(SystemPropertyPageExtension contributor, IAdaptable element) + { + super(contributor.getId()); + this.contributor = contributor; + this.element = element; + } + /** + * Creates the preference page this node stands for. If the page is null, + * it will be created by loading the class. If loading fails, + * empty filler page will be created instead. + */ + public void createPage() + { + page = contributor.createPage(element); + setPage(page); + } + /** (non-Javadoc) + * Method declared on IPreferenceNode. + */ + public void disposeResources() + { + page = null; + if (icon != null) + { + icon.dispose(); + icon = null; + } + } + /** + * Returns page icon, if defined. + */ + public Image getLabelImage() + { + if (icon==null) + { + ImageDescriptor desc = contributor.getImage(); + if (desc != null) + { + icon = desc.createImage(); + } + } + return icon; + } + /** + * Returns page label as defined in the registry. + */ + public String getLabelText() + { + return contributor.getName(); + } + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..79bbcd72c0f --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemStringFieldEditor.java @@ -0,0 +1,371 @@ +/******************************************************************************** + * 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); + this.oldValue = ""; + //createControl(parent); + doOurFillIntoGrid(); + setToolTipText(rb.getString(rbKey+"tooltip")); + } + + /** + * 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 = ""; + } + + /** + * 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. + *

    + * The control is created if it does not yet exist + *

    + * + * @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 (VALUE property) provided that the old and + * new values are different. + *

    + * This hook is not called when the text is initialized + * (or reset to the default value) from the preference store. + *

    + */ + 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 new file mode 100644 index 00000000000..c122e012328 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemSubSystemPropertyPageCore.java @@ -0,0 +1,89 @@ +/******************************************************************************** + * 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.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemWidgetHelpers; +import org.eclipse.rse.ui.messages.ISystemMessageLine; +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 com.ibm.etools.systems.subsystems.SubSystem + */ +public class SystemSubSystemPropertyPageCore extends SystemBasePropertyPage + implements ISystemMessages, 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, SystemPlugin.HELPPREFIX + "psubs0000"); + 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 + *

    + * 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 new file mode 100644 index 00000000000..ebccdf54681 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemSubSystemPropertyPageCoreForm.java @@ -0,0 +1,404 @@ +/******************************************************************************** + * 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.wizard.WizardPage; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemPropertyResources; +import org.eclipse.rse.ui.SystemResources; +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.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().getSubSystemConfiguration().supportsUserId(); + } + + private ISystemValidator getPortValidator() + { + if (portValidator == null) + { + portValidator = getSubSystem().getSubSystemConfiguration().getPortValidator(); + } + return portValidator; + } + /** + * Initialize values of input fields based on input + */ + protected void doInitializeFields() + { + initDone = true; + ISubSystem ss = getSubSystem(); + ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration(); + userIdValidator = ssFactory.getUserIdValidator(); + //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("0 "+SystemResources.RESID_PORT_DYNAMICSELECT)); + 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); + textUserId.setLocal((localUserId!=null)&&(localUserId.length()>0)); + } + } + + public void doInitializeInnerFields() + { + initDone = true; + ISubSystem ss = getSubSystem(); + ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration(); + userIdValidator = ssFactory.getUserIdValidator(); + + // userId + if (userIdApplicable) + { + String localUserId = ss.getLocalUserId(); + textUserId.setLocalText(localUserId); + String parentUserId = ss.getHost().getDefaultUserId(); + textUserId.setInheritedText(parentUserId+" "+SystemPropertyResources.RESID_PROPERTY_INHERITED); + textUserId.setLocal((localUserId!=null)&&(localUserId.length()>0)); + } + } + + /** + * Validate user id value per keystroke + */ + protected SystemMessage validateUserIdInput() + { + errorMessage= null; + if (textUserId != null) + { + if (!textUserId.isLocal()) + return null; + if (userIdValidator != null) + errorMessage= userIdValidator.validate(textUserId.getText()); + else if (getUserId().equals("")) + errorMessage = SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_USERID_EMPTY); + } + setErrorMessage(errorMessage); + //setPageComplete(); + 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 = SystemPlugin.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; + 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) + { + String userId = getUserId(); + updateUserId(ss); + } + } + 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(getShell(), 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(getShell(), 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 new file mode 100644 index 00000000000..b0446a5122b --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTeamViewCategoryPropertyPage.java @@ -0,0 +1,110 @@ +/******************************************************************************** + * 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.rse.ui.SystemPropertyResources; +import org.eclipse.rse.ui.SystemWidgetHelpers; +import org.eclipse.rse.ui.view.SystemViewResources; +import org.eclipse.rse.ui.view.team.SystemTeamViewCategoryNode; +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 = (Label)SystemWidgetHelpers.createVerbage(composite_prompts, "", 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 category node + */ + protected 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()); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTeamViewProfilePropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTeamViewProfilePropertyPage.java new file mode 100644 index 00000000000..16a093ab9c8 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTeamViewProfilePropertyPage.java @@ -0,0 +1,114 @@ +/******************************************************************************** + * 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.rse.core.SystemPlugin; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.ui.SystemPropertyResources; +import org.eclipse.rse.ui.SystemWidgetHelpers; +import org.eclipse.rse.ui.view.SystemViewResources; +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 = SystemPlugin.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/ui/propertypages/SystemTeamViewSubSystemFactoryPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTeamViewSubSystemFactoryPropertyPage.java new file mode 100644 index 00000000000..8505bf21d06 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTeamViewSubSystemFactoryPropertyPage.java @@ -0,0 +1,145 @@ +/******************************************************************************** + * 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.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemPropertyResources; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.SystemWidgetHelpers; +import org.eclipse.rse.ui.view.SystemViewResources; +import org.eclipse.rse.ui.view.team.SystemTeamViewSubSystemFactoryNode; +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 SystemTeamViewSubSystemFactoryPropertyPage extends SystemBasePropertyPage + implements ISystemMessages +{ + + protected Label labelType, labelName, labelId, labelVendor, labelTypes; + protected String errorMessage; + protected boolean initDone = false; + + /** + * Constructor for SystemFilterPropertyPage + */ + public SystemTeamViewSubSystemFactoryPropertyPage() + { + 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.createVerbage(composite_prompts, SystemResources.RESID_PP_SUBSYSFACTORY_VERBAGE, 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 getSubSystemFactory() + { + Object element = getElement(); + SystemTeamViewSubSystemFactoryNode ssfNode = (SystemTeamViewSubSystemFactoryNode)element; + return ssfNode.getSubSystemFactory(); + } + + /** + * Initialize values of input fields based on input + */ + protected void doInitializeFields() + { + initDone = true; + ISubSystemConfiguration ssf = getSubSystemFactory(); + ISubSystemConfigurationProxy proxy = ssf.getSubSystemFactoryProxy(); + // populate GUI... + labelName.setText(ssf.getName()); + labelId.setText(proxy.getId()); + labelVendor.setText(proxy.getVendor()); + String systypes = ""; + String[] types = ssf.getSystemTypes(); + if (ssf.getSubSystemFactoryProxy().supportsAllSystemTypes()) + { + systypes = SystemResources.TERM_ALL; + } + else + { + for (int idx=0; idx0)) + { + sb.append(key); + sb.append(KEYVALUE_DELIMITER); + sb.append(value); + sb.append(KEYVALUEPAIR_DELIMITER); + } + } + + return sb.toString(); + } + + private SystemType[] getSystemTypes(boolean defaults) + { + return SystemPlugin.getDefault().getAllSystemTypes(defaults); + } + + // ------------------------ + // 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) + { + SystemType row = (SystemType)element; + Object value = ""; + + if (property.equals(P_NAME)) + value = row.getName(); + else if (property.equals(P_ENABLED)) + value = (row.isEnabled() ? new Integer(0) : new Integer(1)); + else if (property.equals(P_USERID)) + value = (row.getDefaultUserID() == null) ? "" : row.getDefaultUserID(); + else + value = (row.getDescription() == null) ? "" : row.getDescription(); + + 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) + { + SystemType row = (SystemType)(((TableItem)element).getData()); + + if (property.equals(P_ENABLED)) + { + Integer val = (Integer)value; + row.setEnabled(enabledStates[val.intValue()]); + enabledStateChanged = true; + } + else if (property.equals(P_USERID)) + { + row.setDefaultUserID((String)value); + } + else + return; + + keyValues.put(row.getName(), SystemType.getPreferenceStoreString(row)); + 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) + { + SystemType currType = (SystemType)element; + + if (columnIndex == COLUMN_NAME) + return currType.getName(); + else if (columnIndex == COLUMN_ENABLED) + return Boolean.toString(currType.isEnabled()); + else if (columnIndex == COLUMN_USERID) + return (currType.getDefaultUserID()==null ? "" : currType.getDefaultUserID()); + else + return (currType.getDescription()==null ? "" : currType.getDescription()); + } + + /* (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, SystemType[] systemTypes) + { + 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 systemtype 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=""; + 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"; + } + } + } + // find this system type in the array... + SystemType matchingType = SystemType.getSystemType(systemTypes, key); + // update this system type's attributes as per preferences... + if (matchingType!=null) + { + matchingType.setEnabled(attr1.equals("true")); + if (!attr2.equals("null")) + matchingType.setDefaultUserID(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 new file mode 100644 index 00000000000..e9d865f574d --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ISystemValidator.java @@ -0,0 +1,52 @@ +/******************************************************************************** + * 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. + *

    + * Will be null if isValid returned null. + */ + public SystemMessage getSystemMessage(); + + /** + * For convenience, this is a shortcut to calling: + *

    
    +     *  if (isValid(text) != null)
    +     *    msg = getSystemMessage();
    +     * 
    + */ + 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 new file mode 100644 index 00000000000..d6cbc438ad5 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ISystemValidatorUniqueString.java @@ -0,0 +1,45 @@ +/******************************************************************************** + * 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 java.util.Vector; + +/** + * 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. + */ + public void setExistingNamesList(Vector existingList); + /** + * Return the existing names list. This will be a case-normalized and sorted list. + */ + public String[] getExistingNamesList(); +} \ No newline at end of file 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 new file mode 100644 index 00000000000..6794660be4f --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/IValidatorRemoteSelection.java @@ -0,0 +1,40 @@ +/******************************************************************************** + * 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.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. + *

    + * 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 new file mode 100644 index 00000000000..c255a680789 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/SystemNumericVerifyListener.java @@ -0,0 +1,46 @@ +/******************************************************************************** + * 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. + */ +public class SystemNumericVerifyListener implements VerifyListener { + + /** + * @see org.eclipse.swt.events.VerifyListener#verifyText(org.eclipse.swt.events.VerifyEvent) + */ + public void verifyText(VerifyEvent e) { + + 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; + } +} \ 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 new file mode 100644 index 00000000000..c57af419946 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorArchiveName.java @@ -0,0 +1,72 @@ +/******************************************************************************** + * 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.validators; +import java.util.Vector; + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; + + +/** + * @author mjberger + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class ValidatorArchiveName extends ValidatorFileName { + + protected SystemMessage msg_NotRegisteredArchive; + + public ValidatorArchiveName(Vector 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 = SystemPlugin.getPluginMessage(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; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorCompileCommandLabel.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorCompileCommandLabel.java new file mode 100644 index 00000000000..4814d632315 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorCompileCommandLabel.java @@ -0,0 +1,131 @@ +/******************************************************************************** + * 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 java.util.Vector; + +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; + + +/** + * This class is used to verify a user defined compile command's label + */ +public class ValidatorCompileCommandLabel extends ValidatorUniqueString + implements ISystemMessages, ISystemValidator +{ + public static final int MAX_CMDLABEL_LENGTH = 50; // max name for a compile command name + + protected boolean fUnique; + protected SystemMessage msg_Invalid; + protected IWorkspace workspace = ResourcesPlugin.getWorkspace(); + + /** + * Use this constructor when you have a vector of existing labels. + */ + public ValidatorCompileCommandLabel(Vector existingLabelList) + { + super(existingLabelList, CASE_INSENSITIVE); // case insensitive uniqueness + init(); + } + /** + * Use this constructor when you have an array of existing labels. + */ + public ValidatorCompileCommandLabel(String existingLabelList[]) + { + super(existingLabelList, CASE_INSENSITIVE); // case insensitive uniqueness + init(); + } + + /** + * Use this constructor when the name need not be unique, and you just want + * the syntax checking. Or if you will call setExistingNamesList later. + */ + public ValidatorCompileCommandLabel() + { + super(new String[0], CASE_INSENSITIVE); + init(); + } + + private void init() + { + super.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_COMPILELABEL_EMPTY), + SystemPlugin.getPluginMessage(MSG_VALIDATE_COMPILELABEL_NOTUNIQUE)); + fUnique = true; + msg_Invalid = SystemPlugin.getPluginMessage(MSG_VALIDATE_COMPILELABEL_NOTVALID); + } + /** + * Supply your own error message text. By default, messages from SystemPlugin resource bundle are used. + * @param error message when entry field is empty + * @param error message when value entered is not unique + * @param 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 ((newText.indexOf('&') == -1) && // causes problems in menu popup as its a mnemonic character. + (newText.indexOf('@') == -1)); // defect 43950 + } + + public String toString() + { + return getClass().getName(); + } + + // --------------------------- + // 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 compile commands: 50 + */ + public int getMaximumNameLength() + { + return MAX_CMDLABEL_LENGTH; + } + + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..e2a8b71aaf1 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorConnectionName.java @@ -0,0 +1,97 @@ +/******************************************************************************** + * 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 java.util.Vector; + +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +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. + *

    + * The IInputValidator interface is used by jface's + * InputDialog class and numerous other platform and system classes. + */ +public class ValidatorConnectionName extends ValidatorFolderName implements ISystemMessages, ISystemValidator +{ + public static final int MAX_CONNECTIONNAME_LENGTH = 100; // arbitrary restriction due to defects + + /** + * Constructor. + * @param existingNameList Vector of existing names (strings) in owning profile. Can be null if not a rename operation. + */ + public ValidatorConnectionName(Vector existingNameList) + { + super(existingNameList); + super.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_CONNECTIONNAME_EMPTY), + SystemPlugin.getPluginMessage(MSG_VALIDATE_CONNECTIONNAME_NOTUNIQUE), + SystemPlugin.getPluginMessage(MSG_VALIDATE_CONNECTIONNAME_NOTVALID)); + } + + /** + * 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; + Vector profileNames = SystemPlugin.getTheSystemProfileManager().getSystemProfileNamesVector(); + String profileName = null; + for (int idx=0; (msg==null)&& (idx 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; + } + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..60fc56435f9 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterName.java @@ -0,0 +1,101 @@ +/******************************************************************************** + * 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 java.util.Vector; + +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemMessages; + + +/** + * This class is used in dialogs that prompt for filter name. Filter names + * have to be unique, and to enable saving per file, must be a valid file name. + *

    + * 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 ValidatorFileName implements ISystemMessages, 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 Vector. + * @param A vector containing list of existing filter names to compare against. + * Note that toString() is used to get the string from each item. + * @param true if comparisons are to be case sensitive, false if case insensitive. + */ + public ValidatorFilterName(Vector existingList) + { + super(existingList); + init(); + } + /** + * Constructor accepting an Array. + * @param An array containing list of existing strings to compare against. + * @param true if comparisons are to be case sensitive, false if case insensitive. + */ + public ValidatorFilterName(String[] existingList) + { + super(existingList); + init(); + } + + private void init() + { + super.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_FILTERNAME_EMPTY), + SystemPlugin.getPluginMessage(MSG_VALIDATE_FILTERNAME_NOTUNIQUE), + SystemPlugin.getPluginMessage(MSG_VALIDATE_FILTERNAME_NOTVALID)); + } + + public String toString() + { + return "FilterNameValidator class"; + } + + // --------------------------- + // 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; + } + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..316391b1fdb --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterPoolName.java @@ -0,0 +1,98 @@ +/******************************************************************************** + * 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 java.util.Vector; + +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemMessages; + + +/** + * 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. + *

    + * 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 ValidatorFolderName implements ISystemMessages, ISystemValidator +{ + public static final int MAX_FILTERPOOLNAME_LENGTH = 50; + + /** + * Constructor accepting a Vector. + * @param A vector containing list of existing filter names to compare against. + * Note that toString() is used to get the string from each item. + * @param true if comparisons are to be case sensitive, false if case insensitive. + */ + public ValidatorFilterPoolName(Vector existingList) + { + super(existingList); + init(); + } + /** + * Constructor accepting an Array. + * @param An array containing list of existing strings to compare against. + * @param true if comparisons are to be case sensitive, false if case insensitive. + */ + public ValidatorFilterPoolName(String[] existingList) + { + super(existingList); + init(); + } + + private void init() + { + super.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_FILTERPOOLNAME_EMPTY), + SystemPlugin.getPluginMessage(MSG_VALIDATE_FILTERPOOLNAME_NOTUNIQUE), + SystemPlugin.getPluginMessage(MSG_VALIDATE_FILTERPOOLNAME_NOTVALID)); + } + + + public String toString() + { + return "FilterNameValidator class"; + } + + // --------------------------- + // 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; + } +} \ No newline at end of file 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 new file mode 100644 index 00000000000..0f5528c5ec0 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterString.java @@ -0,0 +1,155 @@ +/******************************************************************************** + * 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 java.util.Vector; + +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.filters.ISystemFilterString; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; + + + +/** + * 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 ISystemMessages, 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 Vector for the list of existing strings, as simple strings. + * @param existingList A vector of strings to compare against. + * @param caseSensitive true if comparisons are to be case sensitive, false if case insensitive. + */ + public ValidatorFilterString(Vector 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 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; + } + + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..bd389725324 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorIntegerInput.java @@ -0,0 +1,163 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; + + + +/** + * 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(SystemPlugin.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, SystemPlugin.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: + *

    
    +     *  if (isValid(text) != null)
    +     *    msg = getSystemMessage();
    +     * 
    + */ + 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 new file mode 100644 index 00000000000..8b3167509f6 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorIntegerRangeInput.java @@ -0,0 +1,115 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; + + +/** + * 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(SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NUMBER_EMPTY), + SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NUMBER_NOTVALID)); + msg_InvalidRange = SystemPlugin.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 new file mode 100644 index 00000000000..0b57ba755d3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLocalPath.java @@ -0,0 +1,95 @@ +/******************************************************************************** + * 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 java.io.File; +import java.util.Vector; + +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; + public static final char SEPCHAR = File.separatorChar; + + /** + * Constructor for ValidatorLocalPath + */ + public ValidatorLocalPath(Vector 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; + } + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..9cce9ba54f0 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLongInput.java @@ -0,0 +1,162 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; + + + +/** + * 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(SystemPlugin.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, SystemPlugin.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: + *
    
    +     *  if (isValid(text) != null)
    +     *    msg = getSystemMessage();
    +     * 
    + */ + 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 new file mode 100644 index 00000000000..def59e06d0a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLongRangeInput.java @@ -0,0 +1,113 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; + + +/** + * 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(SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NUMBER_EMPTY), + SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NUMBER_NOTVALID)); + msg_InvalidRange = SystemPlugin.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 new file mode 100644 index 00000000000..e4eb81942ea --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorPathName.java @@ -0,0 +1,124 @@ +/******************************************************************************** + * 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 java.util.Vector; + +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; + + +/** + * 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. Give the + * ctor a vector containing a list of existing names to compare against. + */ + public ValidatorPathName(Vector existingNameList) + { + super(existingNameList, CASE_INSENSITIVE); // case insensitive uniqueness + init(); + } + /** + * Use this constructor when the name must be unique. Give the + * ctor 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(SystemPlugin.getPluginMessage(MSG_VALIDATE_PATH_EMPTY), + SystemPlugin.getPluginMessage(MSG_VALIDATE_PATH_NOTUNIQUE)); + fUnique = true; + msg_Invalid = SystemPlugin.getPluginMessage(MSG_VALIDATE_PATH_NOTVALID); + specialChars = new StringBuffer("*?;'<>|"); + nbrSpecialChars = specialChars.length(); + } + /** + * Supply your own error message text. By default, messages from SystemPlugin resource bundle are used. + * @param error message when entry field is empty + * @param error message when value entered is not unique + * @param 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 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 = SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_PORT_EMPTY); + currentMessage = SystemPlugin.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 = SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_PORT_EMPTY); + currentMessage = SystemPlugin.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 new file mode 100644 index 00000000000..d12be4083c7 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorProfileName.java @@ -0,0 +1,89 @@ +/******************************************************************************** + * 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 java.util.Vector; + +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; + + +/** + * This class is used in dialogs that prompt for a profile name. + * 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 ValidatorProfileName + extends ValidatorFolderName implements ISystemMessages, ISystemValidator +{ + public static final int MAX_PROFILENAME_LENGTH = 100; // arbitrary restriction! Defect 41816 + private SystemMessage reservedNameMsg; + + /** + * Constructor. The list of existing names can be null if this is not a rename operation. + */ + public ValidatorProfileName(Vector existingNameList) + { + super(existingNameList); + super.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_PROFILENAME_EMPTY), + SystemPlugin.getPluginMessage(MSG_VALIDATE_PROFILENAME_NOTUNIQUE), + SystemPlugin.getPluginMessage(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 = SystemPlugin.getPluginMessage(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")) { + currentMessage = getReservedNameMessage(); + } + else if (newText.indexOf('.') != -1) { + currentMessage = msg_Invalid; + } + + } + return currentMessage; + } + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..e73a5c71cc8 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorRemoteSelection.java @@ -0,0 +1,39 @@ +/******************************************************************************** + * 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.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. + *

    + * 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 new file mode 100644 index 00000000000..018c0ea7e74 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorServerPortInput.java @@ -0,0 +1,65 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemMessages; + + + +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 == 4035) + { + currentMessage = SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PORT_WARNING); + currentMessage.makeSubstitution("4035", "RSE daemon"); + 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 == 4035) + { + currentMessage = SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PORT_WARNING); + currentMessage.makeSubstitution("4035", "RSE daemon"); + 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/ValidatorSourceType.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSourceType.java new file mode 100644 index 00000000000..429952f8e17 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSourceType.java @@ -0,0 +1,110 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; + + +/** + * 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 ISystemMessages, 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(SystemPlugin.getPluginMessage(MSG_VALIDATE_SRCTYPE_EMPTY), + SystemPlugin.getPluginMessage(MSG_VALIDATE_SRCTYPE_NOTUNIQUE)); + msg_Invalid = SystemPlugin.getPluginMessage(MSG_VALIDATE_SRCTYPE_NOTVALID); + } + + /** + * Supply your own error message text. By default, messages from SystemPlugin resource bundle are used. + * @param error message when entry field is empty + * @param error message when value entered is not unique + * @param 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"; + } + + // --------------------------- + // 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 new file mode 100644 index 00000000000..acccf2cff5b --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSpecialChar.java @@ -0,0 +1,206 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; + + +/** + * 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 ISystemMessages, 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, SystemPlugin.getPluginMessage(MSG_VALIDATE_ENTRY_NOTVALID), SystemPlugin.getPluginMessage(MSG_VALIDATE_ENTRY_EMPTY)); + } + /** + * Constructor + * @param specialChars String containing special characters to test for. + * @param isEmptyAllowed true if an empty string is valid + * @param error message when invalid characters entered + */ + public ValidatorSpecialChar(String specialChars, boolean isEmptyAllowed, SystemMessage msg_Invalid) + { + this(specialChars, isEmptyAllowed, msg_Invalid, SystemPlugin.getPluginMessage(MSG_VALIDATE_ENTRY_EMPTY)); + } + /** + * Constructor + * @param specialChars String containing special characters to test for. + * @param isEmptyAllowed true if an empty string is valid + * @param error message when invalid characters entered + * @param 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 SystemPlugin resource bundle are used. + * @param error message when entry field is empty or null if to keep the default + * @param 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 + * if (isValid(text) != null) + * msg = getSystemMessage(); + * + */ + 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 new file mode 100644 index 00000000000..d2eb65f7433 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSystemName.java @@ -0,0 +1,119 @@ +/******************************************************************************** + * 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 java.util.Vector; + +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; + + +/** + * 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. Give the + * ctor a vector containing a list of existing names to compare against. + */ + public ValidatorSystemName(Vector existingNameList) + { + super(existingNameList, true); // case sensitive uniqueness + super.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_NAME_EMPTY), + SystemPlugin.getPluginMessage(MSG_VALIDATE_NAME_NOTUNIQUE)); + fUnique = true; + msg_Invalid = SystemPlugin.getPluginMessage(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(SystemPlugin.getPluginMessage(MSG_VALIDATE_NAME_EMPTY), + SystemPlugin.getPluginMessage(MSG_VALIDATE_NAME_NOTUNIQUE)); + fUnique = true; + msg_Invalid = SystemPlugin.getPluginMessage(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(SystemPlugin.getPluginMessage(MSG_VALIDATE_NAME_EMPTY), + SystemPlugin.getPluginMessage(MSG_VALIDATE_NAME_NOTUNIQUE)); + fUnique = false; + msg_Invalid = SystemPlugin.getPluginMessage(MSG_VALIDATE_NAME_NOTVALID); + } + /** + * Supply your own error message text. By default, messages from SystemPlugin resource bundle are used. + * @param error message when entry field is empty + * @param error message when value entered is not unique + * @param 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"; + } + + // ------------------- + // 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 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 + * null 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: + *

    
    +     *  if (isValid(text) != null)
    +     *    msg = getSystemMessage();
    +     * 
    + */ + 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/ValidatorUserActionCommand.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserActionCommand.java new file mode 100644 index 00000000000..0a14bf53b47 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserActionCommand.java @@ -0,0 +1,120 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; + + +/** + * This class is used to verify a user defined action's command + */ +public class ValidatorUserActionCommand + implements ISystemMessages, ISystemValidator +{ + public static final int MAX_UDACMD_LENGTH = 512; // max command for an action + + protected SystemMessage emptyMsg, invalidMsg, currentMessage; + + /** + * Constructor to use when wanting to specify the "value required" error message, + * but use the default for the "Value not valid" error message + */ + public ValidatorUserActionCommand() + { + setErrorMessages(SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDACMD_EMPTY), + SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDACMD_NOTVALID)); + } + + /** + * 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 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)) + { + currentMessage = emptyMsg; + } + else + { + if (input.length() > MAX_UDACMD_LENGTH) + currentMessage = invalidMsg; + } + 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 comments + */ + public int getMaximumNameLength() + { + return MAX_UDACMD_LENGTH; + } + + /** + * For convenience, this is a shortcut to calling: + *
    
    +     *  if (isValid(text) != null)
    +     *    msg = getSystemMessage();
    +     * 
    + */ + 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/ValidatorUserActionComment.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserActionComment.java new file mode 100644 index 00000000000..ed05126303b --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserActionComment.java @@ -0,0 +1,120 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; + + +/** + * This class is used to verify a user defined action's comment + */ +public class ValidatorUserActionComment + implements ISystemMessages, ISystemValidator +{ + public static final int MAX_UDACMT_LENGTH = 256; // max comment for an action + + protected SystemMessage emptyMsg, invalidMsg, currentMessage; + + /** + * Constructor to use when wanting to specify the "value required" error message, + * but use the default for the "Value not valid" error message + */ + public ValidatorUserActionComment() + { + setErrorMessages(SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDACMT_EMPTY), + SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDACMT_NOTVALID)); + } + + /** + * 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 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)) + { + //currentMessage = emptyMsg; + } + else + { + if (input.length() > MAX_UDACMT_LENGTH) + currentMessage = invalidMsg; + } + 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 comments + */ + public int getMaximumNameLength() + { + return MAX_UDACMT_LENGTH; + } + + /** + * For convenience, this is a shortcut to calling: + *
    
    +     *  if (isValid(text) != null)
    +     *    msg = getSystemMessage();
    +     * 
    + */ + 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/ValidatorUserActionName.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserActionName.java new file mode 100644 index 00000000000..8fbbcb7f1f2 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserActionName.java @@ -0,0 +1,133 @@ +/******************************************************************************** + * 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 java.util.Vector; + +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; + + +/** + * This class is used to verify a user defined action's name. + */ +public class ValidatorUserActionName extends ValidatorUniqueString + implements ISystemMessages, ISystemValidator +{ + public static final int MAX_UDANAME_LENGTH = 256; // max name for an action + + protected boolean fUnique; + protected SystemMessage msg_Invalid; + protected IWorkspace workspace = ResourcesPlugin.getWorkspace(); + + /** + * Use this constructor when the name must be unique. Give the + * ctor a vector containing a list of existing names to compare against. + */ + public ValidatorUserActionName(Vector existingNameList) + { + super(existingNameList, CASE_SENSITIVE); // case sensitive uniqueness + init(); + } + /** + * Use this constructor when the name must be unique. Give the + * ctor a string array of existing names to compare against. + */ + public ValidatorUserActionName(String existingNameList[]) + { + super(existingNameList, CASE_SENSITIVE); // case sensitive uniqueness + init(); + } + + /** + * Use this constructor when the name need not be unique, and you just want + * the syntax checking. + */ + public ValidatorUserActionName() + { + super(new String[0], CASE_SENSITIVE); + init(); + } + + private void init() + { + super.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_UDANAME_EMPTY), + SystemPlugin.getPluginMessage(MSG_VALIDATE_UDANAME_NOTUNIQUE)); + fUnique = true; + msg_Invalid = SystemPlugin.getPluginMessage(MSG_VALIDATE_UDANAME_NOTVALID); + } + /** + * Supply your own error message text. By default, messages from SystemPlugin resource bundle are used. + * @param error message when entry field is empty + * @param error message when value entered is not unique + * @param 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 ((newText.indexOf('&') == -1) && // causes problems in menu popup as its a mnemonic character + (newText.indexOf('@') == -1)); // defect 43950 + } + + public String toString() + { + return "UserActionNameValidator class"; + } + + // --------------------------- + // 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: 256 + */ + public int getMaximumNameLength() + { + return MAX_UDANAME_LENGTH; + } + + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..ca9074362f3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserId.java @@ -0,0 +1,51 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; + + +/** + * 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 implements ISystemMessages +{ + /** + * Constructor + */ + public ValidatorUserId(boolean isEmptyAllowed) + { + super("=;", isEmptyAllowed, SystemPlugin.getPluginMessage(MSG_VALIDATE_USERID_NOTVALID), SystemPlugin.getPluginMessage(MSG_VALIDATE_USERID_EMPTY)); + } + + /** + * 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/validators/ValidatorUserTypeName.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserTypeName.java new file mode 100644 index 00000000000..985c99e8b71 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserTypeName.java @@ -0,0 +1,106 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; + + +/** + * This class is used to verify a user defined type's name. + */ +public class ValidatorUserTypeName extends ValidatorUniqueString + implements ISystemMessages, ISystemValidator +{ + public static final int MAX_UDTNAME_LENGTH = 50; // max name for a file type + + protected SystemMessage msg_Invalid; + + /** + * Use this constructor when the name need not be unique, and you just want the syntax checking. + */ + public ValidatorUserTypeName() + { + super(new String[0], CASE_INSENSITIVE); + init(); + } + + private void init() + { + super.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_UDTNAME_EMPTY), + SystemPlugin.getPluginMessage(MSG_VALIDATE_UDTNAME_NOTUNIQUE)); + msg_Invalid = SystemPlugin.getPluginMessage(MSG_VALIDATE_UDTNAME_NOTVALID); + } + + /** + * Supply your own error message text. By default, messages from SystemPlugin resource bundle are used. + * @param error message when entry field is empty + * @param error message when value entered is not unique + * @param 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 "UserTypeNameValidator class"; + } + + // --------------------------- + // 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_UDTNAME_LENGTH; + } + + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserTypeTypes.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserTypeTypes.java new file mode 100644 index 00000000000..848c4e71cc3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserTypeTypes.java @@ -0,0 +1,120 @@ +/******************************************************************************** + * 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.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; + + +/** + * This class is used to verify a user defined action's comment + */ +public class ValidatorUserTypeTypes + implements ISystemMessages, ISystemValidator +{ + public static final int MAX_UDTTYPES_LENGTH = 512; + + protected SystemMessage emptyMsg, invalidMsg, currentMessage; + + /** + * Constructor to use when wanting to specify the "value required" error message, + * but use the default for the "Value not valid" error message + */ + public ValidatorUserTypeTypes() + { + setErrorMessages(SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDTTYPES_EMPTY), + SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDTTYPES_NOTVALID)); + } + + /** + * 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 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)) + { + currentMessage = emptyMsg; + } + else + { + if (input.length() > MAX_UDTTYPES_LENGTH) + currentMessage = invalidMsg; + } + 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 comments + */ + public int getMaximumNameLength() + { + return MAX_UDTTYPES_LENGTH; + } + + /** + * For convenience, this is a shortcut to calling: + *
    
    +     *  if (isValid(text) != null)
    +     *    msg = getSystemMessage();
    +     * 
    + */ + 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/view/AbstractSystemRemoteAdapterFactory.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemRemoteAdapterFactory.java new file mode 100644 index 00000000000..e86fd21fb8a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemRemoteAdapterFactory.java @@ -0,0 +1,47 @@ +/******************************************************************************** + * 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.view; + +import org.eclipse.core.runtime.IAdapterFactory; +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 new file mode 100644 index 00000000000..d0816a29162 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemViewAdapter.java @@ -0,0 +1,1808 @@ +/******************************************************************************** + * 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 java.lang.reflect.InvocationTargetException; +import java.util.List; +import java.util.ResourceBundle; +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.jobs.ISchedulingRule; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.rse.core.SystemAdapterHelpers; +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.internal.subsystems.AbstractResource; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemMessageObject; +import org.eclipse.rse.model.ISystemPromptableObject; +import org.eclipse.rse.model.ISystemResourceSet; +import org.eclipse.rse.model.SystemMessageObject; +import org.eclipse.rse.model.SystemRemoteResourceSet; +import org.eclipse.rse.model.SystemWorkspaceResourceSet; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemMenuManager; +import org.eclipse.rse.ui.SystemPropertyResources; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.actions.SystemDynamicPopupMenuExtensionManager; +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.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.IWorkbenchPart; +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.IPropertySource; +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, IPropertySource, ISystemPropertyConstants, IWorkbenchAdapter, + ISystemViewActionFilter, IDeferredWorkbenchAdapter +{ + //protected boolean isEditable = false; + + protected String filterString = null; + + /** + * Current viewer. Set by content provider + */ + protected Viewer viewer = null; + /** + * Current input provider. Set by content provider + */ + protected Object propertySourceInput = null; + /** + * Current shell, set by the content provider + */ + 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; + /** + * For returning an empty list from getChildren: new Object[0] + */ + protected Object[] emptyList = new Object[0]; + /** + * For returning a msg object from getChildren. Will be an array with one item, + * one of nullObject, canceledObject or errorObject + */ + protected Object[] msgList = new Object[1]; + /** + * Frequently returned msg object from getChildren: "empty list" + */ + protected SystemMessageObject nullObject = null; + /** + * Frequently returned msg object from getChildren: "operation canceled" + */ + protected SystemMessageObject canceledObject = null; + /** + * Frequently returned msg object from getChildren: "operation ended in error" + */ + protected SystemMessageObject errorObject = null; + + /** + * Message substitution prefix: "&" + */ + protected static final String MSG_SUB_PREFIX = "&"; + /** + * Message substitution variable 1: "&1" + */ + protected static final String MSG_SUB1 = MSG_SUB_PREFIX+"1"; + /** + * Message substitution variable 2: "&2" + */ + protected static final String MSG_SUB2 = MSG_SUB_PREFIX+"2"; + + /** + * 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; + + // ------------------------------------------------------------------ + // Configuration methods, called by the label and content provider... + // ------------------------------------------------------------------ + + /** + * Configuration method. Typically called by content provider, viewer or action. Do not override.
    + * Set the viewer that is driving this adapter + * Called by label and content provider. + */ + public void setViewer(Viewer viewer) + { + this.viewer = viewer; + } + /** + * Configuration method. Typically called by content provider, viewer or action. Do not override.
    + * Set the shell to be used by any method that requires it. + */ + public void setShell(Shell shell) + { + this.shell = shell; + } + /** + * Configuration method. Typically called by content provider, viewer or action. Do not override.
    + * 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) + { + this.input = input; + } + + // ------------------------------------------------------------------ + // Getter methods, for use by subclasses and actions... + // ------------------------------------------------------------------ + + /** + * Getter method. Callable by subclasses. Do not override.
    + * Get the shell currently hosting the objects in this adapter + */ + public Shell getShell() + { + if (shell == null || shell.isDisposed() || !shell.isVisible() || !shell.isEnabled()) + { + // get a new shell + 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; + } + /** + * Getter method. Callable by subclasses. Do not override.
    + * 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() + { + if (viewer == null) + { + ISystemViewInputProvider ip = getInput(); + if (ip != null) + { + return ip.getViewer(); + } + else + { + IWorkbenchPart currentPart = SystemBasePlugin.getActiveWorkbenchWindow().getActivePage().getActivePart(); + if (currentPart instanceof IRSEViewPart) + { + return ((IRSEViewPart)currentPart).getRSEViewer(); + } + } + + } + return viewer; + } + /** + * Getter method. Callable by subclasses. Do not override.
    + * 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; + } + + /** + * Getter method. Callable by subclasses. Do not override.
    + * 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() + { + return input; + } + + /** + * Overridable by subclasses. You should override if not using AbstractResource.
    + * Returns the subsystem that contains this object. By default, if the + * given element is instanceof {@link org.eclipse.rse.core.internal.subsystems.AbstractResource AbstractResource}, + * it calls getSubSystem on it, else returns null. + */ + public ISubSystem getSubSystem(Object element) + { + if (element instanceof AbstractResource) + return ((AbstractResource)element).getSubSystem(); + else + return null; + } + + /** + * Called by SystemView viewer. No need to override or call.
    + * 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. + * + * @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); + } + } + + } + + + /** + * Called by system viewers. No need to override or call.
    + * Contributes actions provided via the dynamicPopupMenuExtensions extension point. 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) + { + // system view adapter menu extensions + // these extensions are independent of subsystem factories and are contributed via extension point + SystemDynamicPopupMenuExtensionManager.getInstance().populateMenu(shell, menu.getMenuManager(), selection, menuGroup); + } + + /** + * This is your opportunity to add actions to the popup menu for the given selection. + *

    + * 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 menuGroup 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. + *

    + * For the actions themselves, you will probably use one of the base action classes: + *

      + *
    • {@link org.eclipse.rse.ui.actions.SystemBaseAction SystemBaseAction}. For a simple action doesn't present any UI. + *
    • {@link org.eclipse.rse.ui.actions.SystemBaseDialogAction SystemBaseDialogAction}. For an action that presents a {@link org.eclipse.rse.ui.dialogs.SystemPromptDialog dialog}. + *
    • {@link org.eclipse.rse.ui.actions.SystemBaseDialogAction SystemBaseWizardAction}. For an action that presents a {@link org.eclipse.rse.ui.wizards.AbstractSystemWizard wizard}. + *
    • {@link org.eclipse.rse.ui.actions.SystemBaseSubMenuAction SystemBaseSubMenuAction}. For an action that cascades into a submenu with other actions. + *
    + * + * @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. + * + * @see org.eclipse.rse.ui.view.ISystemViewElementAdapter#addActions(SystemMenuManager, IStructuredSelection, Shell, String) + */ + public abstract void addActions(SystemMenuManager menu,IStructuredSelection selection,Shell parent,String menuGroup); + + /** + * Abstract. Must be overridden by subclasses.
    + * IWorkbenchAdapter method. Returns an image descriptor for the image. + * More efficient than getting the image. + * @param element The element for which an image is desired + */ + public abstract ImageDescriptor getImageDescriptor(Object element); + + + /** + * Abstract. Must be overridden by subclasses.
    + * Return the label for this object. + * @see #getName(Object) + * @see #getAbsoluteName(Object) + */ + public abstract String getText(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); + } + + /** + * Overridable by subclasses, but rarely needs to be.
    + * Return the name of this object, which may be different than the display text ({#link #getText(Object)}. + * By default, returns getText(element);, but child classes can override if display name doesn't equal real name. + *

    + * Called by common rename and delete actions, and used to populate property sheet. + * @see #getText(Object) + * @see #getAbsoluteName(Object) + */ + public String getName(Object element) + { + return getText(element); + } + /** + * Abstract. Must be overridden.
    . + * Return the fully-qualified name, versus just the displayable name, for this object. + * For remote objects, this should be sufficient to uniquely identify this object within its + * subsystem. + * @see #getText(Object) + * @see #getName(Object) + */ + public abstract String getAbsoluteName(Object object); + + /** + * Internal use. Can be safely ignored.
    + * Return the name for this object. Unique requirement for IWorkbenchAdapter. + * We map to getText(element). + */ + public String getLabel(Object element) + { + return getText(element); + } + + /** + * Abstract. Must be overridden by subclasses.
    + * Return the type label for this object. + */ + public abstract String getType(Object element); + + /** + * Overridable by subclasses, but rarely needs to be.
    + * Return the string to display in the status line when the given object is selected. + * The default is: + *

    
    +	 *   getType(): getName()
    +	 * 
    + */ + public String getStatusLineText(Object element) + { + return getType(element) + ": " + getName(element); + } + + /** + * Abstract. Must be overridden by subclasses.
    + * 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 can return a parent, why not, go for it. + */ + public abstract Object getParent(Object element); + + /** + * Abstract. Must be overridden by subclasses.
    + * Return true if this object has children. + */ + public abstract boolean hasChildren(Object element); + + /** + * Abstract. Must be overridden by subclasses.
    + * Return the children of this object. Return null if children not supported. + */ + public abstract Object[] getChildren(Object element); + + /** + * 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. + */ + public Object[] getChildren(IProgressMonitor monitor, Object element) + { + return getChildren(element); + } + + + /** + * Overridable by subclasses, but rarely needs to be.
    + * 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. + */ + public Object[] getChildrenUsingExpandToFilter(Object element, String expandToFilter) + { + return getChildren(element); + } + + /** + * Callable by subclasses.
    + * Return the default descriptors for all system elements. + */ + 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(P_TYPE, SystemPropertyResources.RESID_PROPERTY_TYPE_LABEL, SystemPropertyResources.RESID_PROPERTY_TYPE_TOOLTIP); + // resource name + propertyDescriptorArray[idx++] = createSimplePropertyDescriptor(P_TEXT, SystemPropertyResources.RESID_PROPERTY_NAME_LABEL, SystemPropertyResources.RESID_PROPERTY_NAME_TOOLTIP); + // number of children in tree currently + propertyDescriptorArray[idx++] = createSimplePropertyDescriptor(P_NBRCHILDREN, SystemViewResources.RESID_PROPERTY_NBRCHILDREN_LABEL, SystemViewResources.RESID_PROPERTY_NBRCHILDREN_TOOLTIP); + + } + //System.out.println("In getDefaultDescriptors() in AbstractSystemViewAdapter"); + return propertyDescriptorArray; + } + + /** + * Callable by subclasses.
    + * Create and return a simple string readonly property descriptor. + * @param propertyKey Key for this property, sent back in getPropertyValue. + * @param label + * @param description + */ + protected static PropertyDescriptor createSimplePropertyDescriptor(String propertyKey, String label, String description) + { + PropertyDescriptor pd = new PropertyDescriptor(propertyKey, label); + pd.setDescription(description); + return pd; + } + + + /** + * Needed by framework for property sheet. No need to call or override.
    + * Returns a value for this object that can be edited in a property sheet. + * + * @return a value that can be editted + */ + public Object getEditableValue() + { + return this; + } + /** + * Implemented. Do not override typically. See {@link #internalGetPropertyDescriptors()}.
    + * 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(). + * + * @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; idxAbstract.
    + * 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. + *

    + * Override if want to include more properties in the property sheet,

    + *

    If you override this for readonly properties, you must also override:

    + *
      + *
    • {@link #getPropertyValue(Object)} + *
    + *

    If you override this for editable properties, you must also override:

    + *
      + *
    • {@link #isPropertySet(Object)} + *
    • {@link #resetPropertyValue(Object)} + *
    • {@link #setPropertyValue(Object,Object)} + *
    + * + * @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,ResourceBundle,String) + */ + protected abstract IPropertyDescriptor[] internalGetPropertyDescriptors(); + + + /** + * Callable by subclasses. Do not override.
    + * 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. + *

    + * 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}. + */ + 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; + } + + /** + * Overridable by subclasses, but usually is not.
    + * Similar to getPropertyValue(Object key) but takes an argument + * for determining whether to return a raw value or formatted value. + * + * By default, simply calls getPropertyValue(key). + *

    + * 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. + * + * @param property 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); + } + + /** + * Implemented. Do not override typically. See {@link #internalGetPropertyValue(Object)}.
    + * Returns the current value for the named property.
    + * By default handles ISystemPropertyConstants.P_TEXT, P_TYPE and P_NBRCHILDREN only, then defers to {@link #internalGetPropertyValue(Object)} for + * subclasses. + *
    Note: you will need to reference propertySourceInput, which is the currently selected object. Just case it to what you expect the selected object's type to be. + * + * @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(P_TEXT)) + //return getText(propertySourceInput); + return getName(propertySourceInput); + else if (name.equals(P_TYPE)) + return getType(propertySourceInput); + else if (name.equals(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"; + } + } + else + return internalGetPropertyValue(key); + } + /** + * Abstract.
    + * 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 + */ + 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; + } + + 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; + } + + 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; + } + private Item[] getChildren(Widget o) + { + if (o instanceof TreeItem) + return ((TreeItem) o).getItems(); + if (o instanceof Tree) + return ((Tree) o).getItems(); + return null; + } + + + /** + * Overridable by subclasses. Must be iff editable properties are supported.
    + * Returns whether the property value has changed from the default. + * Only applicable for editable properties. + *
    RETURNS FALSE BY DEFAULT. + * @return true if the value of the specified property has changed + * from its original default value; false otherwise. + */ + public boolean isPropertySet(Object key) + { + return false; + } + /** + * Overridable by subclasses. Must be iff editable properties are supported.
    + * Resets the specified property's value to its default value. + * Called on editable property when user presses reset button in property sheet viewer. + * DOES NOTHING BY DEFAULT. + * + * @param key the key identifying property to reset + */ + public void resetPropertyValue(Object key) + { + } + /** + * Overridable by subclasses. Must be iff editable properties are supported.
    + * Sets the named property to the given value. + * Called after an editable property is changed by the user. + * + * 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) + { + } + + /** + * Called from adapter factories. Do not override.
    + * Set input object for property source queries. This must be called by your + * XXXAdaptorFactory before returning this adapter object. + */ + public void setPropertySourceInput(Object propertySourceInput) + { + this.propertySourceInput = propertySourceInput; + } + + /** + * Overridable by subclasses, but usually is not.
    + * 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) + { + return false; + } + + // ------------------------------------------ + // METHODS TO SUPPORT GLOBAL DELETE ACTION... + // ------------------------------------------ + + /** + * Overridable by subclasses, but usually is not.
    + * 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. + *

    By default, returns true. + * @see #canDelete(Object) + * @see #doDelete(Shell,Object) + */ + public boolean showDelete(Object element) + { + return true; + } + /** + * Overridable by subclasses, and usually is.
    + * Return true if this object is deletable by the user. If so, when selected, + * the Edit->Delete menu item will be enabled. + *

    + * By default, returns false. Override if your object is deletable. + * @see #showDelete(Object) + * @see #doDelete(Shell,Object) + */ + public boolean canDelete(Object element) + { + return false; + } + + /** + * Overridable by subclasses, and usually is.
    + * Perform the delete action. 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 msg. + * Throw an exception if it failed and you want to use the generic msg. + * @see #showDelete(Object) + * @see #canDelete(Object) + */ + public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) throws Exception + { + return doDelete(shell, element); + } + + /** + * Overridable by subclasses, and usually is.
    + * Perform the delete action. 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 op failed and a msg was issued. + * Throw an exception if ANY failed and you want to use the generic msg. + */ + 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; + } + + /** + * Overridable by subclasses, and usually is.
    + * Perform the delete action. 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 msg. + * Throw an exception if it failed and you want to use the generic msg. + * @see #showDelete(Object) + * @see #canDelete(Object) + * @deprecated use the one with the monitor + */ + public boolean doDelete(Shell shell, Object element) throws Exception + { + return false; + } + + // ------------------------------------------ + // METHODS TO SUPPORT COMMON RENAME ACTION... + // ------------------------------------------ + + /** + * Overridable by subclasses, but usually is not.
    + * 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. + *

    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) + */ + public boolean showRename(Object element) + { + return true; + } + /** + * Overridable by subclasses, and usually is.
    + * Return true if this object is renamable by the user. If so, when selected, + * the Rename popup menu item will be enabled. + * By default, returns false. Override if your object is renamable. + * @return true if this object is renamable by the user + * @see #showRename(Object) + * @see #doRename(Shell,Object,String) + * @see #getNameValidator(Object) + * @see #getCanonicalNewName(Object,String) + * @see #namesAreEqual(Object,String) + */ + public boolean canRename(Object element) + { + return false; + } + + /** + * Overridable by subclasses, and usually is.
    + * Perform the rename action. By default does nothing. Override if your object is renamable. + * Return true if this was successful. Return false if it failed and you issued a msg. + * Throw an exception if it failed and you want to use the generic msg. + * @return true if the rename was successful + * @see #showRename(Object) + * @see #canRename(Object) + */ + public boolean doRename(Shell shell, Object element, String name) throws Exception + { + //org.eclipse.rse.core.ui.SystemMessage.displayErrorMessage("INSIDE DORENAME"); + return false; + } + + /** + * Overridable by subclasses, and usually is iff canRename is.
    + * 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!! + *

    + * Used in the common rename dialogs, and only if you return true to {@link #canRename(Object)}. + *

    + * 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; + } + + /** + * Overridable by subclasses, and usually is iff canRename is.
    + * 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. + *

    + * 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. + *

    + * Used in the common rename dialogs, and only if you return true to {@link #canRename(Object)}. + *

    + * This method returns a name that can be used for uniqueness checking because it is qualified + * sufficiently to make it unique. + *

    + * 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; + } + /** + * Overridable by subclasses, but usually is not.
    + * 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. + *

    + * Used in the common rename dialogs, and only if you return true to {@link #canRename(Object)}. + *

    + * 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... + // ------------------------------------------ + /** + * Overridable by subclasses, and usually is.
    + * 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. + *

    + * Default is true. + */ + public boolean showRefresh(Object element) + { + return true; + } + + // ------------------------------------------------------------ + // METHODS TO SUPPORT COMMON OPEN-IN-NEW-PERSPECTIVE ACTIONS... + // ------------------------------------------------------------ + /** + * Overridable by subclasses, and usually is NOT.
    + * Return true if we should show the Go Into; and Open In New Window + * and Go To actions in the popup for the given element. + *

    + * Only applicable for non-remote resources. Remote always show Go To only. + */ + public boolean showOpenViewActions(Object element) + { + return true; + } + + /** + * Overridable by subclasses, and usually is NOT.
    + * Return true if we should show the generic show in table action in the popup for the given element. + */ + public boolean showGenericShowInTableAction(Object element) + { + return true; + } + + + // ------------------------------------------ + // METHODS TO SUPPORT COMMON DRAG AND DROP FUNCTION... + // ------------------------------------------ + /** + * Overridable by subclasses, and is iff drag and drop supported.
    + * Return true if this object can be copied to another location. 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; + } + + /** + * Overridable by subclasses, and is iff drag and drop supported.
    + * Return true if this object can be copied to another location. 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; + } + + /** + * Overridable by subclasses, and is iff drag and drop supported.
    + * Perform the drag on the given object. 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; + } + + /** + * Overridable by subclasses, and is iff drag and drop supported.
    + * Return true if another object can be copied into this object. 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; + + } + + /** + * Overridable by subclasses, and is iff drag and drop supported.
    + * Perform the drag on the given objects. This default implementation simply iterates through the + * set. For optimal performance, this should be overridden. + * + * @param set the set of objects to copy + * @param sameSystemType indication of whether the source and target reside on the same type of system + * @param monitor the progress monitor + * @return a temporary workspace copies of the object that was copied + * + */ + 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; + } + + /** + * Overridable by subclasses, and is iff drag and drop supported.
    + * Perform drop from the "fromSet" of objects to the "to" object + * @param from 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; + } + + /** + * Overridable by subclasses, and is iff drag and drop supported.
    + * Perform drop from the "from" object to the "to" object. 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 compatability + return doDrop(from, to, sameSystemType, sameSystem, monitor); + } + + /** + * Overridable by subclasses, and is iff drag and drop supported.
    + * Perform drop from the "from" object to the "to" object. 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; + } + + /** + * Overridable by subclasses, and usually is iff drag and drop supported..
    + * Return true if it is valid for the src object to be dropped in the target. 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... + // ------------------------------------------------------------ + /** + * Overridable by subclasses, but usually is not.
    + * 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) + { + if (this instanceof ISystemRemoteElementAdapter) + return ((ISystemRemoteElementAdapter)this).getAbsoluteName(element); + else + return getName(element); + } + /** + * Overridable by subclasses, but usually is not.
    + * Return what to save to disk to identify this element when it is the input object to a secondary + * Remote Systems Explorer perspective. Defaults to getMementoHandle(element). + */ + public String getInputMementoHandle(Object element) + { + return getMementoHandle(element); + } + /** + * Overridable by subclasses, but usually is not.
    + * 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) + { + if (this instanceof ISystemRemoteElementAdapter) + return ISystemMementoConstants.MEMENTO_KEY_REMOTE; + else + return getType(element); + } + + /** + * Overridable by subclasses, but usually is not.
    + * 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) + { + return true; + } + + /** + * Overridable by subclasses, but usually is not.
    + * 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. + *

    + * Default is false unless element implements ISystemPromptable object. Override as appropriate. + */ + public boolean isPromptable(Object element) + { + return (element instanceof ISystemPromptableObject); + } + /** + * Overridable by subclasses, but usually is not.
    + * 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. + * @param element - first selected object + */ + public void selectionChanged(Object element) // d40615 + { + } + + /** + * Overridable by subclasses, typically if additional properties are supported.
    + * From IActionFilter so the popupMenus extension point can use <filter>, <enablement> + * or <visibility>. The support is for the following: + *

      + *
    1. name="value". The given value must match getName(target) exactly, or if ends with asterisk must match the beginning. + *
    2. name="type". The given value must match getType(target) exactly. Be careful, as this is usually translated. + *
    3. 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. + *
    4. 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. + *
    5. 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. + *
    6. 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. + *
    7. name="subsystemFactoryId". 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. + *
    8. name="subsystemFactoryCategory". 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. + *
    + *

    + * If desired, override, and call super(), to support additional filter criteria for <filter>, <enablement> and <visibility>. + * + * @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")) + { + if (value.endsWith("*")) + { + // 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")) + return value.equals(getType(target)); + else if (name.equalsIgnoreCase("hasChildren")) + { + return hasChildren(target) ? value.equals("true") : value.equals("false"); + } + else if (name.equalsIgnoreCase("connected")) + { + ISubSystem ss = getSubSystem(target); + if (ss != null) + return ss.isConnected() ? value.equals("true") : value.equals("false"); + else + return false; + } + else if (name.equalsIgnoreCase("offline")) + { + ISubSystem ss = getSubSystem(target); + if (ss != null) + return ss.isOffline() ? value.equals("true") : value.equals("false"); + else + return false; + } + else if (name.equalsIgnoreCase("systemType")) + { + ISubSystem ss = getSubSystem(target); + String[] values = tokenize(value); + if (ss == null) + { + if (!(target instanceof IHost)) + return false; + String connSysType = ((IHost)target).getSystemType(); + for (int idx=0; idxOverridable by subclasses, but usually is not.
    + * 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. + *

    + * 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. + } + + /** + * Overridable by subclasses, but usually is not.
    + * 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. + *

    + * Returns null. Override if the remote resource is compilable. + */ + public String getRemoteSourceType(Object element) + { + return null; + } + /** + * Overridable by subclasses, and must be for editable objects.
    + * 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) + { + return null; + } + + /** + * Overridable by subclasses, and must be for editable objects.
    + * Indicates whether the specified object can be edited or not. + * @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... + // ------------------ + /** + * Callable by subclasses.
    + * Returns the implementation of ISystemViewElement for the given + * object. Returns null if the adapter is not defined or the + * object is not adaptable. + *

    Just a convenient shortcut to {@link org.eclipse.rse.core.SystemAdapterHelpers#getAdapter(Object, Viewer)} + */ + protected ISystemViewElementAdapter getAdapter(Object o) + { + return SystemAdapterHelpers.getAdapter(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) + SystemPlugin.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; + */ + } + /** + * Callable by subclasses.
    + * Returns the implementation of ISystemRemoteElement for the given + * object. Returns null if this object does not adaptable to this. + *

    Just a convenient shortcut to {@link org.eclipse.rse.core.SystemAdapterHelpers#getRemoteAdapter(Object, Viewer)} + */ + 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; + */ + } + + /** + * Callable by subclasses.
    + * Do message variable substitution. Using you are replacing &1 (say) with + * a string. + * @param message containing substitution variable. Eg "Connect failed with return code &1" + * @param substitution variable. Eg "%1" + * @param substitution data. Eg "001" + * @return message with all occurrences of variable substituted with data. + */ + 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(); + } + + /** + * Callable by subclasses. Do not override
    + * 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. + */ + protected ISystemTree getSystemTree() + { + Viewer v = getViewer(); + if ((v != null) && (v instanceof ISystemTree)) + return (ISystemTree)v; + else + return null; + } + + /** + * Callable by subclasses. Do not override
    + * Return "Yes" translated + */ + public String getTranslatedYes() + { + if (xlatedYes == null) + xlatedYes = SystemResources.TERM_YES; + return xlatedYes; + } + + /** + * Callable by subclasses. Do not override
    + * Return "No" translated + */ + protected String getTranslatedNo() + { + if (xlatedNo == null) + xlatedNo = SystemResources.TERM_NO; + return xlatedNo; + } + + /** + * Callable by subclasses. Do not override
    + * Return "True" translated + */ + protected String getTranslatedTrue() + { + if (xlatedTrue == null) + xlatedTrue = SystemResources.TERM_TRUE; + return xlatedTrue; + } + /** + * Callable by subclasses. Do not override
    + * Return "False" translated + */ + protected String getTranslatedFalse() + { + if (xlatedFalse == null) + xlatedFalse = SystemResources.TERM_FALSE; + return xlatedFalse; + } + /** + * Callable by subclasses. Do not override
    + * Return "Not application" translated + */ + protected String getTranslatedNotApplicable() + { + if (xlatedNotApplicable == null) + xlatedNotApplicable = SystemPropertyResources.RESID_TERM_NOTAPPLICABLE; + return xlatedNotApplicable; + } + /** + * Callable by subclasses. Do not override
    + * Return "Not available" translated + */ + protected String getTranslatedNotAvailable() + { + if (xlatedNotAvailable == null) + xlatedNotAvailable = SystemPropertyResources.RESID_TERM_NOTAVAILABLE; + return xlatedNotAvailable; + } + + /** + * Internal use. Do not override
    + */ + protected void initMsgObjects() + { + nullObject = new SystemMessageObject(SystemPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_EMPTY),ISystemMessageObject.MSGTYPE_EMPTY, null); + canceledObject = new SystemMessageObject(SystemPlugin.getPluginMessage(ISystemMessages.MSG_LIST_CANCELLED),ISystemMessageObject.MSGTYPE_CANCEL, null); + errorObject = new SystemMessageObject(SystemPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_FAILED),ISystemMessageObject.MSGTYPE_ERROR, null); + } + + /** + * Callable by subclasses. Do not override
    + * In getChildren, return 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 + */ + 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; + } + + /** + * Callable by subclasses. Do not override
    + * Return the "Operation cancelled by user" msg as an object array so can be used to answer getChildren() + */ + protected Object[] getCancelledMessageObject() + { + if (canceledObject == null) + initMsgObjects(); + msgList[0] = canceledObject; + return msgList; + } + /** + * Callable by subclasses. Do not override
    + * 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; + } + /** + * Callable by subclasses. Do not override
    + * Return the "Empty list" msg as an object array so can be used to answer getChildren() + */ + protected Object[] getEmptyMessageObject() + { + if (nullObject == null) + initMsgObjects(); + msgList[0] = nullObject; + return msgList; + } + + /** + * Callable by subclasses. Do not override
    + * Get the first selected object of the given selection + */ + 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 + */ + + /* + * 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. + */ + public boolean supportsDeferredQueries() + { + return false; + } + + + public void fetchDeferredChildren(Object o, IElementCollector collector, IProgressMonitor monitor) + { + try + { + monitor = Policy.monitorFor(monitor); + monitor.beginTask(Policy.bind("RemoteFolderElement.fetchingRemoteChildren", getLabel(o)), 100); //$NON-NLS-1$ + SystemFetchOperation operation = getSystemFetchOperation(o, collector); + operation.run(Policy.subMonitorFor(monitor, 100)); + } + catch (InvocationTargetException e) + { + e.printStackTrace(); + } + 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) + { + return new SystemFetchOperation(null, (IAdaptable)o, this, collector); + } + + + /* (non-Javadoc) + * @see org.eclipse.ui.progress.IDeferredWorkbenchAdapter#isContainer() + */ + public boolean isContainer() + { + return true; + } + + public ISchedulingRule getRule(Object element) { + IAdaptable location = (IAdaptable)element; + return new SystemSchedulingRule(location); + } +} \ No newline at end of file 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 new file mode 100644 index 00000000000..e854d327bdf --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/IRSEViewPart.java @@ -0,0 +1,24 @@ +/******************************************************************************** + * 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/ISystemDragDropAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemDragDropAdapter.java new file mode 100644 index 00000000000..cd013a28684 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemDragDropAdapter.java @@ -0,0 +1,117 @@ +/******************************************************************************** + * 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.core.runtime.IProgressMonitor; +import org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.model.ISystemResourceSet; +import org.eclipse.rse.model.SystemRemoteResourceSet; + + +public interface ISystemDragDropAdapter extends IRemoteObjectIdentifier +{ + + // ------------------------------------------ + // METHODS TO SUPPORT COMMON DRAG AND DROP FUNCTION... + // ------------------------------------------ + /** + * Return true if this object can be copied to another location via drag and drop, or clipboard copy. + */ + public boolean canDrag(Object element); + + /** + * Return true if these objects can be copied to another location via drag and drop, or clipboard copy. + */ + public boolean canDrag(SystemRemoteResourceSet elements); + + /** + * Perform the drag on the given object. + * @param element the object to copy + * @param sameSystemType indication of whether the source and target reside on the same type of system + * @param monitor the progress monitor + * @return a temporary local copy of the object that was copied + */ + public Object doDrag(Object element, boolean sameSystemType, IProgressMonitor monitor); + + + /** + * Perform the drag on the given objects. + * @param set the set of objects to copy + * @param monitor the progress monitor + * @return a set of temporary files of the object that was copied + */ + public ISystemResourceSet doDrag(SystemRemoteResourceSet set, IProgressMonitor monitor); + + /** + * Return true if another object can be copied into this object + * @param element the target of a drop operation + * @return whether this object may be dropped on + */ + public boolean canDrop(Object element); + + /** + * Perform drop from the "from" object to the "to" object + * @param from the source object 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 object to be dropped. + * @param monitor the progress monitor + * @return the new copy of the object that was dropped + */ + public Object doDrop(Object from, Object to, boolean sameSystemType, boolean sameSystem, int srcType, IProgressMonitor monitor); + + /** + * Perform drop from the "fromSet" of objects to the "to" object + * @param from 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); + + + /** + * Return true if it is valid for the src object to be dropped in the target + * @param src the object to drop + * @param target the object which src is dropped in + * @param sameSystem whether this is the same system + * @return whether this is a valid operation + */ + public boolean validateDrop(Object src, Object target, boolean sameSystem); + + /** + * Return true if it is valid for the src objects to be dropped in the target + * @param srcSet set of resources to drop on the target + * @param target the object which src is dropped in + * @param sameSystem whether this is the same system + * @return whether this is a valid operation + */ + public boolean validateDrop(ISystemResourceSet srcSet, Object target, boolean sameSystem); + + /** + * Get the subsystem that corresponds to this object if one exists. + * + */ + public ISubSystem getSubSystem(Object element); +} \ 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 new file mode 100644 index 00000000000..aedb522c257 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemEditableRemoteObject.java @@ -0,0 +1,159 @@ +/******************************************************************************** + * 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.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 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 the progress monitor + * @returns 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. + * @returns 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); + + + /** + * 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 + * @return + */ + public String getAbsolutePath(); + + /** + * Return the subsystem for the edited object + * @return + */ + public ISubSystem getSubSystem(); + + /** + * Returns whether the edited object exists + * @return + */ + 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 new file mode 100644 index 00000000000..0a082e930a2 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemLongRunningRequestListener.java @@ -0,0 +1,33 @@ +/******************************************************************************** + * 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; +/** + * 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); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemMementoConstants.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemMementoConstants.java new file mode 100644 index 00000000000..701b9c98928 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemMementoConstants.java @@ -0,0 +1,50 @@ +/******************************************************************************** + * 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; +public interface ISystemMementoConstants +{ + + /** + * Memento ID for profiles + */ + public static final String MEMENTO_KEY_PROFILE = "Profile"; + /** + * Memento ID for connections + */ + public static final String MEMENTO_KEY_CONNECTION = "Conn"; + /** + * Memento ID for subsystems + */ + public static final String MEMENTO_KEY_SUBSYSTEM = "Subs"; + /** + * Memento ID for filter pool references + */ + public static final String MEMENTO_KEY_FILTERPOOLREFERENCE = "FPoolRef"; + /** + * Memento ID for filter references + */ + public static final String MEMENTO_KEY_FILTERREFERENCE = "FRef"; + /** + * Memento ID for filter string references + */ + public static final String MEMENTO_KEY_FILTERSTRINGREFERENCE = "FSRef"; + /** + * Memento ID for remote objects + */ + public static final String MEMENTO_KEY_REMOTE = "Remote"; + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..7d93dc5b9e6 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemPropertyConstants.java @@ -0,0 +1,107 @@ +/******************************************************************************** + * 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.IBasicPropertyConstants; +/** + * Constants that are the key values used to identify properties that populate the + * Property Sheet viewer. + */ +public interface ISystemPropertyConstants extends IBasicPropertyConstants +{ + public static final String P_PREFIX = org.eclipse.rse.ui.ISystemIconConstants.PREFIX; + // GENERIC / COMMON + public static final String P_TYPE = P_PREFIX+"type"; + public static final String P_NEWNAME = P_PREFIX+"newName"; + public static final String P_ERROR = P_PREFIX+"error"; + public static final String P_OK = P_PREFIX+"ok"; + public static final String P_FILTERSTRING = P_PREFIX+"filterString"; + public static final String P_NBRCHILDREN = P_PREFIX+"nbrChildren"; + + // CONNECTION PROPERTIES + public static final String P_PROFILE = P_PREFIX+"profile"; + public static final String P_SYSTEMTYPE = P_PREFIX+"systemType"; + public static final String P_HOSTNAME = P_PREFIX+"hostname"; + public static final String P_DEFAULTUSERID = P_PREFIX+"defaultuserid"; + public static final String P_DESCRIPTION = P_PREFIX+"description"; + + // 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"; + public static final String P_FILTERSTRINGS_COUNT = P_PREFIX+"filterstringsCount"; + public static final String P_PARENT_FILTER = P_PREFIX+"filterParent"; + public static final String P_PARENT_FILTERPOOL = P_PREFIX+"filterParentPool"; + public static final String P_RELATED_CONNECTION = P_PREFIX+"filterRelatedConnection"; + public static final String P_IS_CONNECTION_PRIVATE = P_PREFIX+"filterConnectionPrivate"; + + // FILE PROPERTIES + public static final String P_FILE_LASTMODIFIED = P_PREFIX+"file.lastmodified"; + public static final String P_FILE_SIZE = P_PREFIX+"file.size"; + public static final String P_FILE_PATH = P_PREFIX+"file.path"; + public static final String P_FILE_CANONICAL_PATH = P_PREFIX+"file.canonicalpath"; + public static final String P_FILE_CLASSIFICATION= P_PREFIX+"file.classification"; + public static final String P_FILE_READONLY = P_PREFIX+"file.readonly"; + public static final String P_FILE_READABLE = P_PREFIX+"file.readable"; + public static final String P_FILE_WRITABLE = P_PREFIX+"file.writable"; + public static final String P_FILE_HIDDEN = P_PREFIX+"file.hidden"; + + // SEARCH LOCATION PROPERTIES + public static final String P_SEARCH_LINE = P_PREFIX+"search.line"; + //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"; + public static final String P_ARCHIVE_COMMENT = P_PREFIX+"archive.comment"; + + // VIRTUAL FILE PROPERTIES + public static final String P_VIRTUAL_COMPRESSEDSIZE = P_PREFIX+"virtual.compressedsize"; + public static final String P_VIRTUAL_COMMENT = P_PREFIX+"virtual.comment"; + public static final String P_VIRTUAL_COMPRESSIONRATIO = P_PREFIX+"virtual.compressionratio"; + public static final String P_VIRTUAL_COMPRESSIONMETHOD = P_PREFIX+"virtual.compressionmethod"; + + // SHELL PROPERTIES + public static final String P_SHELL_STATUS = P_PREFIX+"shell.status"; + public static final String P_SHELL_CONTEXT = P_PREFIX+"shell.context"; + + // ERROR PROPERTIES + public static final String P_ERROR_FILENAME = P_PREFIX+"error.filename"; + public static final String P_ERROR_LINENO = P_PREFIX+"error.lineno"; + + // USER ACTION PROPERTIES + public static final String P_USERACTION_DOMAIN = P_PREFIX+"action.domain"; + + // COMPILE TYPE PROPERTIES + public static final String P_COMPILETYPE_TYPES = P_PREFIX+"compiletypes.types"; + + // MISCELLANEOUS PROPERTIES + public static final String P_USERID = P_PREFIX+"userid"; + public static final String P_PASSWORD = P_PREFIX+"password"; + public static final String P_CCSID = P_PREFIX+"ccsid"; + public static final String P_VRM = P_PREFIX+"vrm"; + public static final String P_ENVLIST = P_PREFIX+"envlist"; // indexed + public static final String P_FILTERS = P_PREFIX+"filters"; // indexed + public static final String P_FILTER = P_PREFIX+"filter"; // scalar + public static final String P_IS_CONNECTED = P_PREFIX+"connected"; // transient + public static final String P_IS_ACTIVE = P_PREFIX+"active"; // for profiles + public static final String P_HAS_CHILDREN = P_PREFIX+"hasChildren"; // see SystemElementViewerAdapter + public static final String P_PORT = P_PREFIX+"port"; + public static final String P_ORIGIN = P_PREFIX+"origin"; + public static final String P_VENDOR = P_PREFIX+"vendor"; + public static final String P_COMMAND = P_PREFIX+"command"; + public static final String P_COMMENT = P_PREFIX+"comment"; +} \ No newline at end of file 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 new file mode 100644 index 00000000000..fde3c9b6646 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemRemoteElementAdapter.java @@ -0,0 +1,160 @@ +/******************************************************************************** + * 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.subsystems.IRemoteObjectIdentifier; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.swt.widgets.Shell; + + + + +/** + * This is an interface that only remote system objects supply adapters for. + *

    + * This interface is designed to allow remote property pages to be registered + * against specific remote system objects of specific name, type or subtype. + */ +public interface ISystemRemoteElementAdapter extends IRemoteObjectIdentifier +{ + /** + * Return the name of this object, which may be different than the display text ({#link #getText(Object)}. + */ + public String getName(Object element); + /** + * Return the fully qualified name of this remote object. + * Unlike getName, this should include the full path to the name. + * This should be enough information to uniquely identify this object within its subsystem. + */ + public String getAbsoluteName(Object element); + /** + * Return fully qualified name that uniquely identifies this remote object's remote parent within its subsystem. + * This is used when deleting a remote resource for example, all occurrences of its parent are found and refreshed in the RSE views. + */ + public String getAbsoluteParentName(Object element); + /** + * Return the subsystem that is responsible for getting this remote object. + * When used together with getAbsoluteName, allows for unique identification of this object. + */ + public ISubSystem getSubSystem(Object element); + /** + * Return the subsystem factory id that owns this remote object + * The value must not be translated, so that property pages registered via xml can subset by it. + */ + public String getSubSystemFactoryId(Object element); + /** + * Return a value for the type category property for this object + * The value must not be translated, so that property pages registered via xml can subset by it. + */ + public String getRemoteTypeCategory(Object element); + /** + * Return a value for the type property for this object + * The value must not be translated, so that property pages registered via xml can subset by it. + */ + public String getRemoteType(Object element); + /** + * Return a value for the subtype property for this object. + * Not all object types support a subtype, so returning null is ok. + * The value must not be translated, so that property pages registered via xml can subset by it. + */ + public String getRemoteSubType(Object element); + /** + * Return a value for the sub-subtype property for this object. + * Not all object types support a sub-subtype, so returning null is ok. + * The value must not be translated, so that property pages registered via xml can subset by it. + */ + public String getRemoteSubSubType(Object element); + /** + * Return the source type of the selected object. Typically, this only makes sense for compilable + * source members. For non-compilable remote objects, this typically just returns null. + */ + public String getRemoteSourceType(Object element); + /** + *

    Short answer: treat this like clone(), and just copy any important instance variables

    + *

    + * 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.
    + * 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.
    + * 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. + *

    + * 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. + *

    + * This is called by viewers like SystemView in response to rename and property change events. + *

    + * @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. Eg, given a file, return the folder + * it is contained in. + */ + public Object getRemoteParent(Shell shell, Object element) throws Exception; + /** + * Given a remote object, return the unqualified names of the objects contained in that parent. 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. + */ + public String[] getRemoteParentNamesInUse(Shell shell, Object element) throws Exception; + + /** + * Returns whether user defined actions should be shown for the object. + * @param object the object. + * @return true if the object supports user defined actions, false otherwise. + */ + public boolean supportsUserDefinedActions(Object object); +} \ No newline at end of file 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 new file mode 100644 index 00000000000..3d0b7d2179b --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemRemoveElementAdapter.java @@ -0,0 +1,42 @@ +/******************************************************************************** + * 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 true if the children have been removed, false + * 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 true if the child has been removed, false + * 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/ISystemSelectAllTarget.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectAllTarget.java new file mode 100644 index 00000000000..5071c1da1a7 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectAllTarget.java @@ -0,0 +1,43 @@ +/******************************************************************************** + * 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/ISystemSelectRemoteObjectAPIProviderCaller.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectRemoteObjectAPIProviderCaller.java new file mode 100644 index 00000000000..091431137fd --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectRemoteObjectAPIProviderCaller.java @@ -0,0 +1,39 @@ +/******************************************************************************** + * 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.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/ISystemShellProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemShellProvider.java new file mode 100644 index 00000000000..2f3fdef584c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemShellProvider.java @@ -0,0 +1,27 @@ +/******************************************************************************** + * 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; +import org.eclipse.ui.IActionBars; +/** + * Abstraction of any parent window that can supply sub-windows with a Shell object + */ +public interface ISystemShellProvider +{ + public Shell getShell(); + public IActionBars getActionBars(); +} \ No newline at end of file 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 new file mode 100644 index 00000000000..28e5d0e5d8e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemTree.java @@ -0,0 +1,99 @@ +/******************************************************************************** + * 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.Item; +/** + * 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. + *

    + * Ultimately, these are methods that AbstractTreeViewer itself should have! + */ +public interface ISystemTree +{ + + + /** + * 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. + *

    + * Designed to be as fast as possible by going directly to the SWT widgets + */ + public boolean sameParent(); + /** + * Called to select an object within the tree, and optionally expand it + */ + public void select(Object element, boolean expand); + /** + * 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 very unreliable... adapters can't be sure + * of the context which can change via filtering and view options. + */ + 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. + */ + 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. + */ + 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. + */ + 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. + */ + public Object[] getElementNodes(Object 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); + /** + * 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. + */ + public Item getViewerItem(); + + /** + * Returns true if any of the selected items are currently expanded + */ + public boolean areAnySelectedItemsExpanded(); + /** + * Returns true if any of the selected items are expandable but not yet expanded + */ + public boolean areAnySelectedItemsExpandable(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewActionFilter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewActionFilter.java new file mode 100644 index 00000000000..aa5570fff25 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewActionFilter.java @@ -0,0 +1,52 @@ +/******************************************************************************** + * 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.ui.IActionFilter; + +/** + * This interface is implemented by the adapters for every object shown in the + * Remote System Explorer. It enables complex filtering of action and popup menu + * extensions via the <filter> element, and action extensions + * via the <visibility> and <enablement> + * elements. + *

    + * The base adapter class used for all RSE objects supports the following properties + * by default: + *

      + *
    1. name="value". The given value must match getName(target) exactly, or if ends with asterisk must match the beginning. + *
    2. name="type". The given value must match getType(target) exactly. Be careful, as this is usually translated. + *
    3. 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. + *
    4. 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. + *
    5. 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. + *
    6. 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. + *
    7. name="subsystemFactoryId". 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. + *
    8. name="subsystemFactoryCategory". 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. + *
    + */ +public interface ISystemViewActionFilter extends IActionFilter +{ + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..569c54d8623 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewDropDestination.java @@ -0,0 +1,34 @@ +/******************************************************************************** + * 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 +{ + + /** + * ask source adapter if it supports drop of its type on this target + * @parm resource (type) in question + * @returns true if copy/move/drop is supported + */ + 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 new file mode 100644 index 00000000000..32b50bba543 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewElementAdapter.java @@ -0,0 +1,346 @@ +/******************************************************************************** + * 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 java.util.List; + +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.subsystems.ISubSystem; +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.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. + *

    + * This interface supports a union of all the methods needed to support a TreeViewer + * content provider and label provider. The {@link org.eclipse.rse.ui.view.SystemViewLabelAndContentProvider} + * delegates to objects of this interface almost completely. It gets such an + * object by calling:

    + *
    
    + *  isve = object.getAdapter(ISystemViewElementAdapter.class);
    + *  interestingInfo = isve.getXXXX(object);
    + * 
    + *

    + * This interface also supports IPropertySource via inheritance, so we can feed the + * PropertySheet. + *

    + *

    For remote resource objects, their adapter should also implement + * {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter} + *

    + * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter + */ +public interface ISystemViewElementAdapter extends IPropertySource, ISystemDragDropAdapter, ISystemViewActionFilter +{ + 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. + * + */ + 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. + *

    + * 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 menuGroup 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. + *

    + * For the actions themselves, you will probably use one of the base action classes: + *

      + *
    • {@link org.eclipse.rse.ui.actions.SystemBaseAction SystemBaseAction}. For a simple action doesn't present any UI. + *
    • {@link org.eclipse.rse.ui.actions.SystemBaseDialogAction SystemBaseDialogAction}. For an action that presents a {@link org.eclipse.rse.ui.dialogs.SystemPromptDialog dialog}. + *
    • {@link org.eclipse.rse.ui.actions.SystemBaseDialogAction SystemBaseWizardAction}. For an action that presents a {@link org.eclipse.rse.ui.wizards.AbstractSystemWizard wizard}. + *
    • {@link org.eclipse.rse.ui.actions.SystemBaseSubMenuAction SystemBaseSubMenuAction}. For an action that cascades into a submenu with other actions. + *
    + * + * @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. + * @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); + /** + * Return the parent of this object + */ + public Object getParent(Object element); + /** + * Return the children of this object + */ + public Object[] getChildren(Object element); + + /** + * Return the children of this object. This version (with monitor) is used when the + * request happens on a modal thread. The implementation needs to take this into + * account so that SWT thread exceptions are avoided. + */ + public Object[] getChildren(IProgressMonitor monitor, Object element); + + /** + * 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 + */ + public boolean hasChildren(Object 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); + + /** + * 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 on the given item. This is after the user has been asked to confirm deletion. + * @deprecated use the one with the monitor + */ + public boolean doDelete(Shell shell, Object element) + throws Exception; + + /** + * Perform the delete on the given item. This is after the user has been asked to confirm deletion. + */ + public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) + throws Exception; + + /** + * Perform the delete on the given set of items. This is after the user has been asked to confirm deletion. + */ + 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. + */ + public boolean doRename(Shell shell, Object element, String name) + 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. + *

    + * 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. + *

    + * 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 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 Systems 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. + * @return true if it supports deferred queries, false otherwise. + */ + public boolean supportsDeferredQueries(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewInputProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewInputProvider.java new file mode 100644 index 00000000000..0915b4805d0 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewInputProvider.java @@ -0,0 +1,97 @@ +/******************************************************************************** + * 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.core.runtime.IAdaptable; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.rse.model.IHost; +import org.eclipse.swt.widgets.Shell; + + +/** + * Abstraction for any object that wishes to be a roots-provider for the SystemView tree viewer. + * + */ +public interface ISystemViewInputProvider extends IAdaptable +{ + /** + * Return the children objects to consistute the root elements in the system view tree + */ + public Object[] getSystemViewRoots(); + /** + * Return true if {@link #getSystemViewRoots()} will return a non-empty list + */ + public boolean hasSystemViewRoots(); + /** + * Return true if we are listing connections or not, so we know whether we are interested in + * connection-add events + */ + public boolean showingConnections(); + /** + * 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); + /** + * 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); + /** + * 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); + + /** + * Set the shell in case it is needed for anything. + * The label and content provider will call this. + */ + public void setShell(Shell shell); + /** + * Return the shell of the viewer we are currently associated with + */ + public Shell getShell(); + /** + * Set the viewer in case it is needed for anything. + * The label and content provider will call this. + */ + public void setViewer(Viewer viewer); + /** + * Return the viewer we are currently associated with + */ + public Viewer getViewer(); + + /** + * Return true to show the action bar (ie, toolbar) above the viewer. + * The action bar contains connection actions, predominantly. + */ + public boolean showActionBar(); + /** + * Return true to show the button bar above the viewer. + * The tool bar contains "Get List" and "Refresh" buttons and is typicall + * shown in dialogs that list only remote system objects. + */ + public boolean showButtonBar(); + /** + * Return true to show right-click popup actions on objects in the tree. + */ + public boolean showActions(); + + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..fdae9ddf0c8 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewRunnableObject.java @@ -0,0 +1,29 @@ +/******************************************************************************** + * 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/SubsystemFactoryAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SubsystemFactoryAdapter.java new file mode 100644 index 00000000000..5a2f2989a13 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SubsystemFactoryAdapter.java @@ -0,0 +1,1440 @@ +/******************************************************************************** + * 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 java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; +import java.util.Vector; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtensionRegistry; +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.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.servicesubsystem.IServiceSubSystemConfiguration; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.core.subsystems.SubSystemConfiguration; +import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.filters.ISystemFilterString; +import org.eclipse.rse.filters.SystemFilterPoolWrapperInformation; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemMenuManager; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.actions.ISystemAction; +import org.eclipse.rse.ui.actions.SystemClearPasswordAction; +import org.eclipse.rse.ui.actions.SystemConnectAction; +import org.eclipse.rse.ui.actions.SystemDisconnectAction; +import org.eclipse.rse.ui.actions.SystemPasteFromClipboardAction; +import org.eclipse.rse.ui.filters.SystemFilterStringEditPane; +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.SystemFilterCascadingNewFilterPoolReferenceAction; +import org.eclipse.rse.ui.filters.actions.SystemFilterCopyFilterAction; +import org.eclipse.rse.ui.filters.actions.SystemFilterCopyFilterPoolAction; +import org.eclipse.rse.ui.filters.actions.SystemFilterMoveDownFilterAction; +import org.eclipse.rse.ui.filters.actions.SystemFilterMoveDownFilterPoolReferenceAction; +import org.eclipse.rse.ui.filters.actions.SystemFilterMoveFilterAction; +import org.eclipse.rse.ui.filters.actions.SystemFilterMoveFilterPoolAction; +import org.eclipse.rse.ui.filters.actions.SystemFilterMoveUpFilterAction; +import org.eclipse.rse.ui.filters.actions.SystemFilterMoveUpFilterPoolReferenceAction; +import org.eclipse.rse.ui.filters.actions.SystemFilterNewFilterPoolAction; +import org.eclipse.rse.ui.filters.actions.SystemFilterRemoveFilterPoolReferenceAction; +import org.eclipse.rse.ui.filters.actions.SystemFilterSelectFilterPoolsAction; +import org.eclipse.rse.ui.filters.actions.SystemFilterWorkWithFilterPoolsAction; +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.validators.ISystemValidator; +import org.eclipse.rse.ui.widgets.IBMServerLauncherForm; +import org.eclipse.rse.ui.widgets.IServerLauncherForm; +import org.eclipse.rse.ui.wizards.ISystemNewConnectionWizardPage; +import org.eclipse.rse.ui.wizards.SubSystemServiceWizardPage; +import org.eclipse.rse.ui.wizards.SystemSubSystemsPropertiesWizardPage; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.dialogs.PropertyPage; + + +public class SubsystemFactoryAdapter 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 SubsystemFactoryAdapter() + { + } + + + /** + * 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 + * factory of the selected objects to determine if these actions are appropriate to add. + * + *

    + * 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 factory, SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystem subsystem) + { + /** FIXME - UDAs should not be coupled to factory adapter + SystemCompileManager mgr = factory.getCompileManager(); + + if (factory.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 (factory.supportsUserDefinedActions() && factory.supportsUserDefinedActions(selection)) + { + addUserDefinedActions(factory, shell, selection, menu, menuGroup, getActionSubSystem(factory, 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 factory supports. + *

    + * Some details: + *

      + *
    • The wizard pages must implement ISystemNewConnectionWizardPage, so as to fit into the wizard's framework + *
    • When the user successfully presses Finish, the createConnection method in the SystemRegistry will call + * your {@link #createSubSystem(IHost,boolean, ISystemNewConnectionWizardPage[])} 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. + *
    + * Tip: consider extending {@link org.eclipse.rse.ui.wizards.AbstractSystemNewConnectionWizardPage} for your wizard page class. + */ + public ISystemNewConnectionWizardPage[] getNewConnectionWizardPages(ISubSystemConfiguration factory, IWizard wizard) + { + if (factory instanceof IServiceSubSystemConfiguration) + { + SubSystemServiceWizardPage page = new SubSystemServiceWizardPage(wizard, factory); + return new ISystemNewConnectionWizardPage[] {page}; + } + else + { + List pages = getSubSystemPropertyPages(factory); + if (pages != null && pages.size() > 0) + { + SystemSubSystemsPropertiesWizardPage page = new SystemSubSystemsPropertiesWizardPage(wizard, factory, pages); + return new ISystemNewConnectionWizardPage[] {page}; + } + } + return new ISystemNewConnectionWizardPage[0]; + } + + + + + /* + * Return the form used in the subsyste property page. This default implementation returns Syste + */ + public ISystemSubSystemPropertyPageCoreForm getSubSystemPropertyPageCoreFrom(ISubSystemConfiguration factory, ISystemMessageLine msgLine, Object caller) + { + return new SystemSubSystemPropertyPageCoreForm(msgLine, caller); + } + + /** + * Gets the list of property pages applicable for a subsystem associated with this factory + * @return the list of subsystem property pages + */ + protected List getSubSystemPropertyPages(ISubSystemConfiguration factory) + { + List propertyPages= new ArrayList(); + // Get reference to the plug-in registry + IExtensionRegistry registry = Platform.getExtensionRegistry(); + + // Get configured property page extenders + IConfigurationElement[] propertyPageExtensions = + registry.getConfigurationElementsFor("org.eclipse.ui", "propertyPages"); + + for (int i = 0; i < propertyPageExtensions.length; i++) + { + IConfigurationElement configurationElement = propertyPageExtensions[i]; + String objectClass = configurationElement.getAttribute("objectClass"); + String name = configurationElement.getAttribute("name"); + Class objCls = null; + try + { + ClassLoader loader = getClass().getClassLoader(); + objCls = Class.forName(objectClass, false, loader); + } + catch (Exception e) + { + } + + + if (objCls != null && ISubSystem.class.isAssignableFrom(objCls) && factory.isFactoryFor(objCls)) + { + try + { + PropertyPage page = (PropertyPage) configurationElement.createExecutableExtension("class"); + page.setTitle(name); + propertyPages.add(page); + } + catch (Exception e) + { + } + } + } + return propertyPages; + } + + // FIXME - UDAs no longer coupled with factory 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. +// *

    +// * Called in the Work With User Actions and the User Actions cascading action. +// *

    +// * Do not override this, as the implementation is complete. However, +// * you must override createActionSubSystem. +// * +// * @see #supportsUserDefinedActions() +// * @see #createActionSubSystem() +// */ +// public SystemUDActionSubsystem getActionSubSystem(ISubSystemFactory factory, ISubSystem subsystem) +// { +// if (udas == null) +// udas = createActionSubSystem(factory); +// if (udas != null) +// { +// udas.setSubsystem(subsystem); +// udas.setSubSystemFactory(factory); +// } +// 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(ISubSystemFactory factory) +// { +// return null; +// } +// +// /** +// * Populate main context menu with a "User Actions->" submenu cascade, +// * which will only be populated when the submenu is selected. +// *

    +// * This is called by the addCommonRemoteObjectsActions method, if this subsystem +// * supports user defined actions. +// */ +// public static void addUserDefinedActions(ISubSystemFactory factory, 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... + // --------------------------------- + + + /** + * Return image descriptor of this factory. + * This comes from the xml "icon" attribute of the extension point. + */ + public ImageDescriptor getImage(ISubSystemConfiguration factory) + { + return factory.getImage(); + } + /** + * Return actual graphics Image of this factory. + * This is the same as calling getImage().createImage() but the resulting + * image is cached. + */ + public Image getGraphicsImage(ISubSystemConfiguration factory) + { + ImageDescriptor id = getImage(factory); + 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; + } + + /** + * Return image to use when this susystem is connection. + * This comes from the xml "iconlive" attribute of the extension point. + */ + public ImageDescriptor getLiveImage(ISubSystemConfiguration factory) + { + return factory.getLiveImage(); + } + + /** + * Return actual graphics LiveImage of this factory. + * This is the same as calling getLiveImage().createImage() but the resulting + * image is cached. + */ + public Image getGraphicsLiveImage(ISubSystemConfiguration factory) + { + ImageDescriptor id = getLiveImage(factory); + 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 factory. + * By default returns a single item array with a SystemNewFilterPoolAction object and + * calls overridable method getAdditionalSubSystemActions. + *

    + * If you wish to support more actions, override getAdditionalSubSystemActions to return a Vector + * of IAction objects. + * @see #getSubSystemNewFilterPoolActions(ISubSystem, Shell) + * @see #getAdditionalSubSystemActions(ISubSystem, Shell) + * @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(ISubSystemConfiguration factory, ISubSystem selectedSubSystem, Shell shell) + { + Vector ourChildActions = getAdditionalSubSystemActions(factory, selectedSubSystem, shell); + // we need to start with a fresh vector each time not build up on what our child + // class gives us, since that may be cached and hence will grow if we keep adding to i. + Vector childActions = new Vector(); + if (ourChildActions != null) + for (int idx = 0; idx < ourChildActions.size(); idx++) + childActions.addElement(ourChildActions.elementAt(idx)); + if (factory.supportsFilters()) + { + boolean showFilterPools = factory.showFilterPools(); + // if showing filter pools, we have to add a "new filter pool" action here... + if (showFilterPools) + { + IAction[] newFPActions = getSubSystemNewFilterPoolActions(factory, selectedSubSystem, shell); + 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(factory); + } + 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) + { + IAction[] newFilterActions = getNewFilterPoolFilterActions(factory, null, shell); + 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 + { + } + } + /* + if (anyLegacy) + { + SystemFilterPoolReferenceManager refMgr = selectedSubSystem.getSystemFilterPoolReferenceManager(); + SystemFilterPool[] refdPools = refMgr.getReferencedSystemFilterPools(); + if ( refdPools.length == 0 ) + SystemPlugin.logInfo("SubSystemFactoryImpl::getSubSystemActions - getReferencedSystemFilterPools returned array of lenght zero."); + for (int idx=0; idx 0 ) + ((SystemFilterBaseNewFilterAction)newFilterActions[idx]).setAllowFilterPoolSelection(refdPools); + } // end for loop + } + */ + // 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 (factory.supportsUserDefinedActions()) +// childActions.addElement(new SystemWorkWithUDAsAction(shell, (ISubSystem)null)); +// // if named file types are supported, add an action to work with them... +// if (factory.supportsFileTypes()) +// childActions.addElement(new SystemWorkWithFileTypesAction(shell, null)); +// // if compile actions are supported, add an action to work with them... +// if (factory.supportsCompileActions()) +// childActions.addElement(new SystemWorkWithCompileCommandsAction(shell, false)); + + + + if (factory.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 (factory.supportsSubSystemConnect()) + { + //nbrBaseActions += 2; // 4; MJB: RE defect 50854 + if (factory.supportsUserId()) + nbrBaseActions += 1; + } + //if (supportsFilters()) + // nbrBaseActions += 2; + subSystemActions = new IAction[nbrBaseActions]; + int ssIdx = 0; + if (factory.supportsSubSystemConnect()) + { + // MJB: RE defect 40854 + //subSystemActions[ssIdx++] = new SystemConnectAction(shell); + //subSystemActions[ssIdx++] = new SystemDisconnectAction(shell); + + if (factory.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; + } + + private 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. + *

    + * 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. + *

    + * This method is from the ISystemNewFilterActionConfigurator interface + */ + public void configureNewFilterAction(ISubSystemConfiguration factory, SystemNewFilterAction newFilterAction, Object callerData) + { + //System.out.println("Inside configureNewFilterAction! It worked!"); + newFilterAction.setFromRSE(true); + boolean showFilterPools = factory.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("SubSystemFactoryImpl::getSubSystemActions - getReferencedSystemFilterPools returned array of length zero."); + // 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; + SystemFilterPoolWrapperInformation poolWrapperInfo = getNewFilterWizardPoolWrapperInformation(); + ISystemProfile[] activeProfiles = SystemPlugin.getTheSystemRegistry().getActiveSystemProfiles(); + ISystemProfile activeProfile = selectedSubSystem.getHost().getSystemProfile(); + for (int idx = 0; idx < activeProfiles.length; idx++) + { + ISystemFilterPool defaultPool = getDefaultSystemFilterPool(factory, (ISystemProfile)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 factory, ISystemProfile profile) + { + ISystemFilterPool pool = null; + ISystemFilterPoolManager mgr = factory.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. + */ + protected SystemFilterPoolWrapperInformation getNewFilterWizardPoolWrapperInformation() + { + return new SystemFilterPoolWrapperInformation(SystemResources.RESID_NEWFILTER_PAGE2_PROFILE_LABEL, SystemResources.RESID_NEWFILTER_PAGE2_PROFILE_TOOLTIP, + SystemResources.RESID_NEWFILTER_PAGE2_PROFILE_VERBAGE); + } + /** + * 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(ISubSystemConfiguration factory, ISubSystem selectedSubSystem, Shell shell) + { + IAction[] actions = new IAction[2]; + actions[0] = new SystemFilterNewFilterPoolAction(shell); + ((ISystemAction) actions[0]).setHelp(SystemPlugin.HELPPREFIX + "actn0040"); + ((SystemFilterNewFilterPoolAction) actions[0]).setDialogHelp(SystemPlugin.HELPPREFIX + "wnfp0000"); + actions[1] = new SystemFilterCascadingNewFilterPoolReferenceAction(shell, selectedSubSystem.getSystemFilterPoolReferenceManager()); + ((ISystemAction) actions[1]).setHelp(SystemPlugin.HELPPREFIX + "actn0041"); + return actions; + } + /** + * Overridable entry for child classes to contribute subsystem actions + * beyond the default supplied actions. + *

    + * By default, returns null. + * @return Vector of IAction objects. + * @see #getSubSystemActions(ISubSystem,Shell) + */ + protected Vector getAdditionalSubSystemActions(ISubSystemConfiguration factory, ISubSystem selectedSubSystem, Shell shell) + { + return null; + } + + + + + + + /** + * Supply the image to be used for filter pool managers, within actions. + * REQUIRED BY SYSTEMFILTERPOOLMANAGERPROVIDER INTERFACE + */ + public ImageDescriptor getSystemFilterPoolManagerImage() + { + return SystemPlugin.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 SystemPlugin.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 SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTER_ID); + } + /* + * 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 SystemPlugin.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 factory. + * Only supported and used by subsystems that support filters. + *

    + * YOU DO NOT NEED TO OVERRIDE THIS METHOD. + *

    + * Most actions are handled in this base, except if you have your own action for + * creating a new filter. In this case, override getNewFilterAction() + * To add additional actions, override {@link #getAdditionalFilterPoolActions(ISystemFilterPool selectedPool, Shell shell)}. + * + * @param pool the currently selected pool + * @param shell parent shell of viewer where the popup menu is being constructed + */ + public IAction[] getFilterPoolActions(ISubSystemConfiguration factory, ISystemFilterPool selectedPool, Shell shell) + { + Vector childActions = new Vector(); + Vector ourChildActions = getAdditionalFilterPoolActions(factory, selectedPool, shell); + if (ourChildActions != null) + for (int idx = 0; idx < ourChildActions.size(); idx++) + childActions.addElement(ourChildActions.elementAt(idx)); + IAction[] newActions = getNewFilterPoolFilterActions(factory, selectedPool, shell); + 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(SystemPlugin.HELPPREFIX + "actn0060"); + copyAction.setDialogHelp(SystemPlugin.HELPPREFIX + "dcfp0000"); + SystemFilterMoveFilterPoolAction moveAction = new SystemFilterMoveFilterPoolAction(shell); + moveAction.setPromptString(SystemResources.RESID_MOVE_TARGET_PROFILE_PROMPT); + moveAction.setHelp(SystemPlugin.HELPPREFIX + "actn0061"); + moveAction.setDialogHelp(SystemPlugin.HELPPREFIX + "dmfp0000"); + 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 entry for child classes to contribute filter pool actions beyond the + * default supplied actions. + *

    + * By default, this returns null. + * @param pool the currently selected pool + * @param shell parent shell of viewer where the popup menu is being constructed + * @return Vector of IAction objects. + * @see #getFilterPoolActions(ISystemFilterPool,Shell) + */ + protected Vector getAdditionalFilterPoolActions(ISubSystemConfiguration factory, ISystemFilterPool selectedPool, Shell shell) + { + return null; + } + /** + * 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(ISystemFilterPool, Shell)}. + *

    + * If you have multiple actions for creating new filters, override this. + *

    + * If you have only a single action for creating new filters, override getNewFilterPoolFilterAction (without the 's'). + *

    + * @param pool the currently selected pool + * @param shell parent shell of viewer where the popup menu is being constructed + */ + protected IAction[] getNewFilterPoolFilterActions(ISubSystemConfiguration factory, ISystemFilterPool selectedPool, Shell shell) + { + IAction[] actions = new IAction[1]; + actions[0] = getNewFilterPoolFilterAction(factory, 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. + *

    + * If you have multiple actions for creating new filters, override getNewFilterPoolFilterActions (note the 's'). + *

    + * If you have only a single action for creating new filters, override this. + *

    + * @param pool the currently selected pool + * @param shell parent shell of viewer where the popup menu is being constructed + */ + protected IAction getNewFilterPoolFilterAction(ISubSystemConfiguration factory, ISystemFilterPool selectedPool, Shell shell) + { + SystemNewFilterAction action = new SystemNewFilterAction(shell, selectedPool); + action.setHelp(SystemPlugin.HELPPREFIX + "actn0042"); + action.setDialogHelp(SystemPlugin.HELPPREFIX + "wnfr0000"); + 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 pool the currently selected pool + * @param shell parent shell of viewer where the popup menu is being constructed + */ + protected IAction getNewNestedFilterAction(ISubSystemConfiguration factory, ISystemFilter selectedFilter, Shell shell) + { + return getNewFilterPoolFilterAction(factory, 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 factory, 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(SystemPlugin.HELPPREFIX + "actn0081"); + action.setDialogHelp(SystemPlugin.HELPPREFIX + "dufr0000"); + 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. + *

    + * By default, this method will call {@link #getChangeFilterAction(ISystemFilter, Shell)} to get + * your change filter action, and will configure the given page from the dialog created by your + * change filter action. + *

    + * 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): + *

      + *
    • {@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setDuplicateFilterStringErrorMessage(SystemMessage)} + *
    • {@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setFilterStringEditPane(SystemFilterStringEditPane)} + *
    • {@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setFilterStringValidator(ISystemValidator)} + *
    • {@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setListLabel(String, String)} + *
    • {@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setParentPoolPromptLabel(String, String)} + *
    • {@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setNamePromptLabel(String, String)} + *
    • {@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setNewListItemText(String)} + *
    • {@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setDuplicateFilterStringErrorMessage(SystemMessage)} + *
    • {@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setEditable(boolean)} + *
    • {@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setSupportsMultipleStrings(boolean)} + *
    • {@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setDescription(String)} + *
    + */ + public void customizeChangeFilterPropertyPage(ISubSystemConfiguration factory, 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(factory, 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. + * + *

    + * By default, this method will call {@link #getChangeFilterAction(ISystemFilter, Shell)} to get + * your change filter action, and will configure the given page from the dialog created by your + * change filter action. + *

    + * 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): + *

      + *
    • {@link org.eclipse.rse.ui.propertypages.SystemFilterStringPropertyPage#setDuplicateFilterStringErrorMessage(SystemMessage)} + *
    • {@link org.eclipse.rse.ui.propertypages.SystemFilterStringPropertyPage#setFilterStringEditPane(SystemFilterStringEditPane)} + *
    • {@link org.eclipse.rse.ui.propertypages.SystemFilterStringPropertyPage#setFilterStringValidator(ISystemValidator)} + *
    • {@link org.eclipse.rse.ui.propertypages.SystemFilterStringPropertyPage#setDuplicateFilterStringErrorMessage(SystemMessage)} + *
    • {@link org.eclipse.rse.ui.propertypages.SystemFilterStringPropertyPage#setEditable(boolean)} + *
    • {@link org.eclipse.rse.ui.propertypages.SystemFilterStringPropertyPage#setDescription(String)} + *
    + */ + public void customizeFilterStringPropertyPage(ISubSystemConfiguration factory, 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(factory, 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 factory. Note, + * these are added to the list returned by getFilterPoolActions(). + * Only supported by subsystems that support filters. + * @param selectedPoolRef the currently selected pool reference + * @param shell parent shell of viewer where the popup menu is being constructed + */ + public IAction[] getFilterPoolReferenceActions(ISubSystemConfiguration factory, ISystemFilterPoolReference selectedPoolRef, Shell shell) + { + ISystemFilterPool selectedPool = selectedPoolRef.getReferencedFilterPool(); + Vector childActions = getAdditionalFilterPoolReferenceActions(factory, selectedPool, shell); + int nbrChildActions = 0; + if (childActions != null) + nbrChildActions = childActions.size(); + int fpIdx = 0; + if (filterPoolReferenceActions == null) + { + int nbr = 3; + filterPoolReferenceActions = new IAction[nbr + nbrChildActions]; + filterPoolReferenceActions[fpIdx++] = getRemoveFilterPoolReferenceAction(factory, selectedPool, shell); + filterPoolReferenceActions[fpIdx] = new SystemFilterMoveUpFilterPoolReferenceAction(shell); + ((ISystemAction) filterPoolReferenceActions[fpIdx++]).setHelp(SystemPlugin.HELPPREFIX + "actn0063"); + filterPoolReferenceActions[fpIdx] = new SystemFilterMoveDownFilterPoolReferenceAction(shell); + ((ISystemAction) filterPoolReferenceActions[fpIdx++]).setHelp(SystemPlugin.HELPPREFIX + "actn0064"); + } + + if (childActions != null) + for (int idx = 0; idx < nbrChildActions; idx++) + filterPoolReferenceActions[fpIdx++] = (IAction) childActions.elementAt(idx); + + return filterPoolReferenceActions; + } + /** + * Overridable entry for child classes to contribute filter pool reference actions beyond the + * default supplied actions. + *

    + * By default, this returns null. + * @param pool the currently selected pool + * @param shell parent shell of viewer where the popup menu is being constructed + * @return Vector of IAction objects. + * @see #getFilterPoolReferenceActions(ISystemFilterPoolReference,Shell) + */ + protected Vector getAdditionalFilterPoolReferenceActions(ISubSystemConfiguration factory, ISystemFilterPool selectedPool, Shell shell) + { + return null; + } + /** + * Overridable method to return the action for removing a filter pool reference. + * By default returns new SystemRemoveFilterPoolReferenceAction. + * @param pool the currently selected pool + * @param shell parent shell of viewer where the popup menu is being constructed + */ + protected IAction getRemoveFilterPoolReferenceAction(ISubSystemConfiguration factory, ISystemFilterPool selectedPool, Shell shell) + { + ISystemAction action = new SystemFilterRemoveFilterPoolReferenceAction(shell); + action.setHelp(SystemPlugin.HELPPREFIX + "actn0062"); + return action; + } + + // --------------------------------- + // FILTER METHODS + // --------------------------------- + + + + /** + * Prompt the user to create a new filter as a result of the user expanding a promptable + * filter. + *

    + * 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 factory, ISystemFilterReference referenceToPromptableFilter, Shell shell) throws Exception + { + ISystemFilter filterPrompt = referenceToPromptableFilter.getReferencedFilter(); + ISystemFilterPool selectedPool = filterPrompt.getParentFilterPool(); + + SystemNewFilterAction action = new SystemNewFilterAction(shell, selectedPool); + Object simulatedSelectedParent = null; + if (!factory.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. + *

    + * Only supported and used by subsystems that support filters. + *

    + * YOU DO NOT NEED TO OVERRIDE THIS METHOD. + *

    + * Most actions are handled in this base, except if you have your own action for + * creating a new nested filter. In this case, override getNewFilterAction() + */ + public IAction[] getFilterActions(ISubSystemConfiguration factory, ISystemFilter selectedFilter, Shell shell) + { + Vector childActions = new Vector(); + Vector ourChildActions = getAdditionalFilterActions(factory, 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(SystemPlugin.HELPPREFIX + "actn0082"); + copyAction.setDialogHelp(SystemPlugin.HELPPREFIX + "dcfr0000"); + filterActions[fsIdx++] = copyAction; + + // we want to make sure the order is kept consistent at + // Copy, Paste, Move, Delete Rename + if (pasteIndex > -1) + { + filterActions[fsIdx++] = (IAction) ourChildActions.elementAt(pasteIndex); + } + + SystemFilterMoveFilterAction moveAction = new SystemFilterMoveFilterAction(shell); + moveAction.setPromptString(SystemResources.RESID_MOVE_TARGET_FILTERPOOL_PROMPT); + moveAction.setHelp(SystemPlugin.HELPPREFIX + "actn0083"); + moveAction.setDialogHelp(SystemPlugin.HELPPREFIX + "dmfr0000"); + filterActions[fsIdx++] = moveAction; + + filterActions[fsIdx] = new SystemFilterMoveUpFilterAction(shell); + ((SystemFilterMoveUpFilterAction) filterActions[fsIdx++]).setHelp(SystemPlugin.HELPPREFIX + "actn0084"); + filterActions[fsIdx] = new SystemFilterMoveDownFilterAction(shell); + ((SystemFilterMoveDownFilterAction) filterActions[fsIdx++]).setHelp(SystemPlugin.HELPPREFIX + "actn0085"); + } + // add overridable dynamic actions + if (factory.supportsNestedFilters()) + { + IAction newNestedFilterAction = getNewNestedFilterAction(factory, selectedFilter, shell); + if (newNestedFilterAction != null) + childActions.addElement(newNestedFilterAction); + } + IAction chgFilterAction = getChangeFilterAction(factory, selectedFilter, shell); + if (chgFilterAction != null) + childActions.addElement(chgFilterAction); + /* + if (showFilterStrings()) + { + IAction[] newStringActions = getNewFilterStringActions(selectedFilter, shell); + if (newStringActions != null) + for (int idx=0; idx + * By default, this returns null. + * @return Vector of IAction objects. + * @see #getFilterActions(ISystemFilter,Shell) + */ + protected Vector getAdditionalFilterActions(ISubSystemConfiguration factory, 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 factory. + * Only supported and used by subsystems that support filters. + *

    + * YOU DO NOT NEED TO OVERRIDE THIS METHOD. + *

    + * Most actions are handled in this base, except if you have your own action for + * creating a new filter. In this case, override getNewFilterAction() + * To add additional actions, override {@link #getAdditionalFilterReferenceActions(ISystemFilterReference, Shell)}. + * + * @param selectedFilterRef the currently selected filter reference + * @param shell parent shell of viewer where the popup menu is being constructed + */ + public IAction[] getFilterReferenceActions(ISubSystemConfiguration factory, ISystemFilterReference selectedFilterRef, Shell shell) + { + Vector childActions = getAdditionalFilterReferenceActions(factory, selectedFilterRef, shell); + int nbrChildActions = 0; + if (childActions != null) + nbrChildActions = childActions.size(); + else + childActions = new Vector(); + /* + if (filterReferenceActions == null) + { + int nbr = 2; + filterReferenceActions = new IAction[nbr]; + } + for (int idx=0; idx + * By default, this returns null. + * @param selectedFilterRef the currently selected filter reference + * @param shell parent shell of viewer where the popup menu is being constructed + * @return Vector of IAction objects. + */ + protected Vector getAdditionalFilterReferenceActions(ISubSystemConfiguration factory, ISystemFilterReference selectedFilterRef, Shell shell) + { + return null; + } + + // --------------------------------- + // FILTER STRING METHODS + // --------------------------------- + + /* + * Returns a list of actions for the popup menu when user right clicks on a + * filter string object (and has set the preferences to see them). + * Only supported and used by subsystems that support filters. + *

    + * YOU DO NOT NEED TO OVERRIDE THIS METHOD. + *

    + * Most actions are handled in this base, only override if you have something unique. + * + public IAction[] getFilterStringActions(SystemFilterString selectedFilterString, Shell shell) + { + Vector childActions = new Vector(); + Vector ourChildActions = getAdditionalFilterStringActions(selectedFilterString, shell); + if (ourChildActions != null) + for (int idx=0; idx + * By default, this returns null. + * @param selectedFilterString the currently selected filter string + * @param shell parent shell of viewer where the popup menu is being constructed + * @return Vector of IAction objects. + * + protected Vector getAdditionalFilterStringActions(SystemFilterString selectedFilterString, Shell shell) + { + return null; + }*/ + /* + * Overridable entry for child classes to contribute their own change filter string action. + *

    + * By default, this returns the default change filter string action. + * @param selectedFilterString the currently selected filter string + * @param shell parent shell of viewer where the popup menu is being constructed + * @return change action. + * + protected IAction getChangeFilterStringAction(SystemFilterString selectedFilterString, Shell shell) + { + //IAction chgAction = new SystemFilterDefaultUpdateFilterStringAction(shell); + //return chgAction; + return null; + }*/ + + /* + * Returns a list of actions for the popup menu when user right clicks on a + * filter string reference object (and has set the preferences to see them). + *

    + * Only supported and used by subsystems that support filters. + *

    + * Most actions are handled in this base, only override if you have something unique. + * + public IAction[] getFilterStringReferenceActions(SystemFilterStringReference selectedFilterStringRef, Shell shell) + { + Vector childActions = new Vector(); + Vector ourChildActions = getAdditionalFilterStringReferenceActions(selectedFilterStringRef, shell); + if (ourChildActions != null) + for (int idx=0; idx + * By default, this returns null. + * @param selectedFilterStringRef the currently selected filter string reference + * @param shell parent shell of viewer where the popup menu is being constructed + * @return Vector of IAction objects. + * + protected Vector getAdditionalFilterStringReferenceActions(SystemFilterStringReference selectedFilterStringRef, Shell shell) + { + return null; + }*/ + + // ------------------------- + // SERVER LAUNCH SUPPORT ... + // ------------------------- + + /** + * Return the form used in the property page, etc for this server launcher. + * Only called if {@link #supportsServerLaunchProperties()} returns true. + *

    + * We return {@link org.eclipse.rse.ui.widgets.ServerLauncherForm}. + * Override if appropriate. + */ + public IServerLauncherForm getServerLauncherForm(ISubSystemConfiguration factory, Shell shell, ISystemMessageLine msgLine) + { + return new IBMServerLauncherForm(shell, msgLine); + } + + /** + * Called by SystemRegistry's renameSystemProfile method to ensure we update our + * filter pool manager names (and their folders) + *

    + * Must be called AFTER changing the profile's name!! + */ + public void renameSubSystemProfile(ISubSystemConfiguration factory, String oldProfileName, String newProfileName) + { + //SystemPlugin.logDebugMessage(this.getClass().getName(), "Inside renameSubSystemProfile. newProfileName = "+newProfileName); + ISystemProfile profile = factory.getSystemProfile(newProfileName); + factory.renameFilterPoolManager(profile); // update filter pool manager name + //if (profile.isDefaultPrivate()) // I don't remember why this was here, but it caused bad things, Phil. + { + // Rename the default filter pool for this profile, as it's name is derived from the profile. + ISystemFilterPool defaultPoolForThisProfile = factory.getDefaultFilterPool(profile, oldProfileName); + if (defaultPoolForThisProfile != null) + try + { + factory.getFilterPoolManager(profile).renameSystemFilterPool(defaultPoolForThisProfile, SubSystemConfiguration.getDefaultFilterPoolName(newProfileName, factory.getId())); + } + catch (Exception exc) + { + SystemBasePlugin.logError("Unexpected error renaming default filter pool " + SubSystemConfiguration.getDefaultFilterPoolName(newProfileName, factory.getId()), exc); + System.out.println("Unexpected error renaming default filter pool " + SubSystemConfiguration.getDefaultFilterPoolName(newProfileName, factory.getId()) + ": " + exc); + } + } + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SubsystemFactoryAdapterFactory.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SubsystemFactoryAdapterFactory.java new file mode 100644 index 00000000000..8a674d1d211 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SubsystemFactoryAdapterFactory.java @@ -0,0 +1,59 @@ +/******************************************************************************** + * 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.core.runtime.IAdapterFactory; +import org.eclipse.core.runtime.IAdapterManager; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter; + + +public class SubsystemFactoryAdapterFactory implements IAdapterFactory +{ + + private ISubsystemConfigurationAdapter ssFactoryAdapter = new SubsystemFactoryAdapter(); + + /** + * @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/ui/view/SystemAbstractAPIProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemAbstractAPIProvider.java new file mode 100644 index 00000000000..35004908c6a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemAbstractAPIProvider.java @@ -0,0 +1,215 @@ +/******************************************************************************** + * 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.core.runtime.Platform; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.rse.core.SystemAdapterHelpers; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.model.ISystemMessageObject; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.SystemMessageObject; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.swt.widgets.Shell; + + + +/** + * This is a base class that a provider of root nodes to the remote systems tree viewer part can + * use as a parent class. + */ +public abstract class SystemAbstractAPIProvider + implements ISystemViewInputProvider, ISystemMessages +{ + + + protected Shell shell; + protected Viewer viewer; + protected ISystemRegistry sr; + + protected Object[] emptyList = new Object[0]; + protected Object[] msgList = new Object[1]; + protected SystemMessageObject nullObject = null; + protected SystemMessageObject canceledObject = null; + protected SystemMessageObject errorObject = null; + + + /** + * Constructor + */ + public SystemAbstractAPIProvider() + { + super(); + sr = SystemPlugin.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); + } + + /** + * Set the shell in case it is needed for anything. + * The label and content provider will call this. + */ + public void setShell(Shell shell) + { + this.shell = shell; + } + + /** + * Return the shell of the current viewer + */ + public Shell getShell() + { + return shell; + } + + /** + * Set the viewer in case it is needed for anything. + * The label and content provider will call this. + */ + public void setViewer(Viewer viewer) + { + this.viewer = viewer; + } + + /** + * Return the viewer we are currently associated with + */ + public Viewer getViewer() + { + return viewer; + } + + /** + * Return true to show the action bar (ie, toolbar) above the viewer. + * The action bar contains connection actions, predominantly. + * We return false + */ + public boolean showActionBar() + { + return false; + } + + /** + * Return true to show the button bar above the viewer. + * The tool bar contains "Get List" and "Refresh" buttons and is typically + * shown in dialogs that list only remote system objects. + * We return false. + */ + public boolean showButtonBar() + { + return false; + } + + /** + * Return true to show right-click popup actions on objects in the tree. + * We return false. + */ + public boolean showActions() + { + return false; + } + + private void initMsgObjects() + { + nullObject = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_EMPTY),ISystemMessageObject.MSGTYPE_EMPTY, null); + canceledObject = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_LIST_CANCELLED),ISystemMessageObject.MSGTYPE_CANCEL, null); + errorObject = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_FAILED),ISystemMessageObject.MSGTYPE_ERROR, null); + } + + /** + * 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 + */ + 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 (canceledObject == null) + initMsgObjects(); + msgList[0] = canceledObject; + 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 getAdapter(Object o) + { + return SystemAdapterHelpers.getAdapter(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/SystemActionViewerFilter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemActionViewerFilter.java new file mode 100644 index 00000000000..8935025cf03 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemActionViewerFilter.java @@ -0,0 +1,190 @@ +/******************************************************************************** + * 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 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; + +/** + * 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 null 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)); + + // 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/view/SystemComboBoxCellEditor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemComboBoxCellEditor.java new file mode 100644 index 00000000000..88c388e4ef9 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemComboBoxCellEditor.java @@ -0,0 +1,207 @@ +/******************************************************************************** + * 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.view; +import java.text.MessageFormat; + +import org.eclipse.jface.viewers.CellEditor; +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. + *

    + * 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. + *

    + * This class may be instantiated; it is not intended to be subclassed. + *

    + */ +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); + System.out.println("Exiting ctor"); + } + /** + * Change the input items + */ + public void setItems(String[] items) + { + System.out.println("inside setItems"); + this.items = items; + populateComboBoxItems(); + setValueValid(true); + } + /* (non-Javadoc) + * Method declared on CellEditor. + */ + protected Control createControl(Composite parent) + { + System.out.println("inside createControl"); + 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) { + // must set the selection before getting value + selection = comboBox.getSelectionIndex(); + System.out.println("Inside widgetSelected. selection = " + selection); + Object newValue = doGetValue(); + boolean newValidState = isCorrect(newValue); + System.out.println("Inside widgetSelected. selection = " + selection + ", " + newValidState); + if (newValidState) { + doSetValue(newValue); + } else { + // try to insert the current value into the error message. + setErrorMessage( + MessageFormat.format(getErrorMessage(), new Object[] {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 ComboBoxCellEditor implementation of + * this CellEditor framework method returns + * the zero-based index of the current selection. + * + * @return the zero-based index of the current selection wrapped + * as an Integer + */ + protected Object doGetValue() + { + System.out.println("Inside doGetValue"); + return new Integer(selection); + } + /* (non-Javadoc) + * Method declared on CellEditor. + */ + protected void doSetFocus() + { + comboBox.setFocus(); + } + /** + * The ComboBoxCellEditor implementation of + * this CellEditor framework method + * accepts a zero-based index of a selection. + * + * @param value the zero-based index of the selection wrapped + * as an Integer + */ + protected void doSetValue(Object value) + { + System.out.println("in doSetValue: " + comboBox + ", " + value); + if (!(value instanceof Integer)) + { + return; + } + //Assert.isTrue(comboBox != null && (value instanceof Integer)); + selection = ((Integer) value).intValue(); + 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); + } + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemComboBoxPropertyDescriptor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemComboBoxPropertyDescriptor.java new file mode 100644 index 00000000000..eb06f625e32 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemComboBoxPropertyDescriptor.java @@ -0,0 +1,89 @@ +/******************************************************************************** + * 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.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 ComboBoxPropertyDescriptor implementation of this + * IPropertyDescriptor method creates and returns a new + * ComboBoxCellEditor. + *

    + * The editor is configured with the current validator if there is one. + *

    + */ + 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); + } + + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemDNDTransferRunnable.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemDNDTransferRunnable.java new file mode 100644 index 00000000000..f8c3b6e0486 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemDNDTransferRunnable.java @@ -0,0 +1,618 @@ +/******************************************************************************** + * 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 java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.resources.IResource; +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.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemContainer; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.ISystemRemoteChangeEvents; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.ISystemResourceSet; +import org.eclipse.rse.model.SystemRemoteResourceSet; +import org.eclipse.rse.model.SystemResourceChangeEvent; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.GenericMessages; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.messages.SystemMessageDialog; +import org.eclipse.ui.progress.UIJob; + + +/** + * Runnable to perform actual transfer operation. + * + */ +public class SystemDNDTransferRunnable extends UIJob +{ + + 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; + + public SystemDNDTransferRunnable(Object target, ArrayList srcObjects, Viewer originatingViewer, int sourceType) + { + super(GenericMessages.DragAndDropOperation_message); + _srcObjects = srcObjects; + _currentTarget = target; + _sourceType = sourceType; + _originatingViewer = originatingViewer; + _resultSrcObjects = new ArrayList(_srcObjects.size()); + _resultTgtObjects = new ArrayList(); + _setList = new ArrayList(); + this.setUser(true); + } + + 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(IProgressMonitor monitor, Object target, ISubSystem targetSubSystem, ISystemDragDropAdapter targetAdapter) + { + + + // 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 = ""; + 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()) + { + 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) + { + ISubSystemConfiguration factory = targetSubSystem.getSubSystemConfiguration(); + if (factory.supportsDropInFilters()) + { + target = targetSubSystem.getTargetForFilter((ISystemFilterReference)target); + 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 transferNonRSEResources(IProgressMonitor monitor, Object target, ISubSystem targetSubSystem, ISystemDragDropAdapter targetAdapter) + { + + 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) + { + + 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) + { + + if (srcObject instanceof IResource) + { + // Eclipse resource transfer + IResource resource = (IResource) srcObject; + 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) + { + 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) + { + 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 runInUIThread(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); + + if (targetAdapter != null) + { + targetSubSystem = targetAdapter.getSubSystem(target); + + if (targetSubSystem != null && !targetSubSystem.isConnected()) + { + try + { + targetSubSystem.connect(SystemBasePlugin.getActiveWorkbenchShell()); + } + catch (Exception e) + { + } + } + + SystemMessage copyMessage = SystemPlugin.getPluginMessage(ISystemMessages.MSG_COPYGENERIC_PROGRESS); + if (monitor != null) + monitor.beginTask(copyMessage.getLevelOneText(), IProgressMonitor.UNKNOWN); + + if (_sourceType == SRC_TYPE_RSE_RESOURCE) + { + transferRSEResources(monitor, target, targetSubSystem, targetAdapter); + } + else + { + transferNonRSEResources(monitor, target, targetSubSystem, targetAdapter); + } + } + } + + // fire refresh for target + if (_ok && monitor != null) // I added this test: phil + { + monitor.done(); + } + // always refresh + ISystemRegistry registry = SystemPlugin.getTheSystemRegistry(); + + if (target != null && target instanceof ISystemContainer) + { + ((ISystemContainer)target).markStale(true); + } + + 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; + } + } + + if (_originatingViewer instanceof TreeViewer) + { + TreeViewer viewer = (TreeViewer) _originatingViewer; + viewer.setExpandedState(target, true); + } + + if (doRefresh) + { + registry.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CREATED, _resultTgtObjects, target, targetSubSystem, null, _originatingViewer); + } + } + + registry.fireEvent(new SystemResourceChangeEvent(target, ISystemResourceChangeEvents.EVENT_REFRESH, 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 = SystemPlugin.getPluginMessage(ISystemMessages.MSG_TRANSFER_INVALID); + errorMessage.makeSubstitution(srcPath, targetPath); + showErrorMessage(errorMessage); + } + + private void showInvalidTransferMessage(ISystemResourceSet resourceSet, String targetPath) + { + SystemMessage errorMessage = SystemPlugin.getPluginMessage(ISystemMessages.MSG_TRANSFER_INVALID); + errorMessage.makeSubstitution(resourceSet.toString(), targetPath); + showErrorMessage(errorMessage); + } + + private void showErrorMessage(SystemMessage errorMessage) + { + SystemMessageDialog dlg = new SystemMessageDialog(SystemMessageDialog.getDefaultShell(), errorMessage); + dlg.open(); + } + + public boolean dropOkay() + { + return _ok; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemDecoratingLabelProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemDecoratingLabelProvider.java new file mode 100644 index 00000000000..d8aed0a7f48 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemDecoratingLabelProvider.java @@ -0,0 +1,58 @@ +/******************************************************************************** + * 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.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>Preferences>Java>Code Generation>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); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemDropActionDelegate.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemDropActionDelegate.java new file mode 100644 index 00000000000..9b5b8b4c70c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemDropActionDelegate.java @@ -0,0 +1,161 @@ +/******************************************************************************** + * 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.core.resources.IResource; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableContext; +import org.eclipse.rse.core.SystemPlugin; +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-Javadoc) + * Method declared on IDropActionDelegate + */ + public boolean run(Object data, Object target) + { + String localPath = null; + IResource resource = null; + + + + + if (target instanceof IResource) + { + resource = (IResource) target; + localPath = resource.getLocation().toOSString(); + } + else if (target instanceof String) + { + localPath = (String)target; + } + else if (target instanceof IAdaptable) + { + Object resourceObj = ((IAdaptable)target).getAdapter(IResource.class); + if (resourceObj != null && resourceObj instanceof IResource) + { + resource = (IResource)resourceObj; + localPath = resource.getLocation().toOSString(); + } + } + + + if (localPath != null) + { + /** 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 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) + { + } + } + SystemPlugin.getTheSystemRegistry().clearRunnableContext(); + } + } + catch (SystemMessageException e) + { + } + **/ + return true; + } + + return false; + } + + protected IRunnableContext getRunnableContext(Shell shell) + { + IRunnableContext irc = SystemPlugin.getTheSystemRegistry().getRunnableContext(); + if (irc != null) + { + return irc; + } + + irc = new ProgressMonitorDialog(shell); + SystemPlugin.getTheSystemRegistry().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/view/SystemEmptyListAPIProviderImpl.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemEmptyListAPIProviderImpl.java new file mode 100644 index 00000000000..c1c0d371c4b --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemEmptyListAPIProviderImpl.java @@ -0,0 +1,111 @@ +/******************************************************************************** + * 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.model.IHost; + + +/** + * 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 + implements ISystemViewInputProvider +{ + + + protected Object[] emptyList = new Object[0]; + + /** + * Constructor + */ + public SystemEmptyListAPIProviderImpl() + { + super(); + } + + // ---------------------------------- + // SYSTEMVIEWINPUTPROVIDER METHODS... + // ---------------------------------- + /** + * Return the children objects to consistute the root elements in the system view tree. + *

    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. + *

    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. + *

    we return false + */ + public boolean hasConnectionChildren(IHost selectedConnection) + { + return false; + } + + /** + * Return true to show the action bar (ie, toolbar) above the viewer. + * The action bar contains connection actions, predominantly. + */ + public boolean showActionBar() + { + return false; + } + /** + * Return true to show the button bar above the viewer. + * The tool bar contains "Get List" and "Refresh" buttons and is typicall + * shown in dialogs that list only remote system objects. + */ + public boolean showButtonBar() + { + return true; + } + /** + * Return true to show right-click popup actions on objects in the tree. + */ + public boolean showActions() + { + return false; + } + + + + // ---------------------------------- + // OUR OWN METHODS... + // ---------------------------------- + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemInheritablePropertyData.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemInheritablePropertyData.java new file mode 100644 index 00000000000..b789e2ffede --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemInheritablePropertyData.java @@ -0,0 +1,173 @@ +/******************************************************************************** + * 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.view; +import org.eclipse.rse.ui.SystemPropertyResources; +/** + * This class captures the data needed to populate a + * InheritableTextCellEditor. + */ +public class SystemInheritablePropertyData +{ + private String localValue=""; + private String inheritedValue=""; + 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 + 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 + 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; + 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: "); + System.out.println("...localValue = "+localValue); + System.out.println("...inheritedValue = "+inheritedValue); + System.out.println("...isLocal = "+isLocal); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemInheritableTextCellEditor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemInheritableTextCellEditor.java new file mode 100644 index 00000000000..3112b8b8c4c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemInheritableTextCellEditor.java @@ -0,0 +1,517 @@ +/******************************************************************************** + * 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 java.text.MessageFormat; + +import org.eclipse.jface.util.Assert; +import org.eclipse.jface.viewers.CellEditor; +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 TextCellEditor implementation of + * this CellEditor 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 fireEditorValueChanged. + * 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 = ""; + Object typedValue = value; + boolean oldValidState = isValueValid(); + boolean newValidState = isCorrect(typedValue); + if (!newValidState) + { + // try to insert the current value into the error message. + setErrorMessage(MessageFormat.format(getErrorMessage(), new Object[] {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 TextCellEditor implementation of this + * CellEditor method returns true if + * the current selection is not empty. + */ + public boolean isCopyEnabled() + { + if (text == null || text.isDisposed() || !text.isEnabled()) + return false; + return text.getSelectionCount() > 0; + } + /** + * The TextCellEditor implementation of this + * CellEditor method returns true if + * the current selection is not empty. + */ + public boolean isCutEnabled() + { + if (text == null || text.isDisposed() || !text.isEnabled()) + return false; + return text.getSelectionCount() > 0; + } + /** + * The TextCellEditor implementation of this + * CellEditor method returns true + * 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 TextCellEditor implementation of this + * CellEditor method always returns true. + */ + public boolean isPasteEnabled() + { + if (text == null || text.isDisposed() || !text.isEnabled()) + return false; + return true; + } + /** + * The TextCellEditor implementation of this + * CellEditor method always returns true. + */ + public boolean isSaveAllEnabled() + { + if (text == null || text.isDisposed() || !text.isEnabled()) + return false; + return true; + } + /** + * Returns true if this cell editor is + * able to perform the select all action. + *

    + * This default implementation always returns + * false. + *

    + *

    + * Subclasses may override + *

    + * @return true if select all is possible, + * false otherwise + */ + public boolean isSelectAllEnabled() + { + if (text == null || text.isDisposed() || !text.isEnabled()) + return false; + return text.getText().length() > 0; + } + /** + * The TextCellEditor implementation of this + * CellEditor method copies the + * current selection to the clipboard. + */ + public void performCopy() + { + text.copy(); + } + /** + * The TextCellEditor implementation of this + * CellEditor method cuts the + * current selection to the clipboard. + */ + public void performCut() + { + text.cut(); + checkSelection(); + checkDeleteable(); + checkSelectable(); + } + /** + * The TextCellEditor implementation of this + * CellEditor 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(""); + else + { + // remove the next character + int pos = text.getCaretPosition(); + if (pos < text.getCharCount()) + { + text.setSelection(pos, pos + 1); + text.insert(""); + } + } + checkSelection(); + checkDeleteable(); + checkSelectable(); + } + /** + * The TextCellEditor implementation of this + * CellEditor method pastes the + * the clipboard contents over the current selection. + */ + public void performPaste() + { + text.paste(); + checkSelection(); + checkDeleteable(); + checkSelectable(); + } + /** + * The TextCellEditor implementation of this + * CellEditor 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(MessageFormat.format(getErrorMessage(), new Object[] {value})); + } + valueChanged(oldValidState, newValidState); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemInheritableTextPropertyDescriptor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemInheritableTextPropertyDescriptor.java new file mode 100644 index 00000000000..d3893b9d0fb --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemInheritableTextPropertyDescriptor.java @@ -0,0 +1,113 @@ +/******************************************************************************** + * 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.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; + } + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..4c620cd8b35 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemLongRunningRequestEvent.java @@ -0,0 +1,34 @@ +/******************************************************************************** + * 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.Event; + +/** + * An event object as passed for ISystemLongRunningRequestListener methods. + */ +public class SystemLongRunningRequestEvent extends Event +{ + + /** + * Constructor for SystemLongRunningRequestEvent + */ + public SystemLongRunningRequestEvent() + { + super(); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemPerspectiveLayout.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemPerspectiveLayout.java new file mode 100644 index 00000000000..0a7a1729c9b --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemPerspectiveLayout.java @@ -0,0 +1,91 @@ +/******************************************************************************** + * 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.debug.ui.IDebugUIConstants; +import org.eclipse.rse.ui.view.scratchpad.SystemScratchpadViewPart; +import org.eclipse.rse.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 + /** + * 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 factory the factory used to add views to the perspective + */ + public void createInitialLayout(IPageLayout layout) + { + String editorArea = layout.getEditorArea(); + + IFolderLayout folder= layout.createFolder("org.eclipse.rse.ui.view.NavFolder", IPageLayout.LEFT, + (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, + (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, + (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.addView("com.ibm.sed.library.libraryView"); // NEW FOR 5.1.2: SNIPPETS VIEW. PSC + + folder= layout.createFolder("org.eclipse.rse.ui.view.PropertiesFolder", IPageLayout.BOTTOM, + (float).75, "org.eclipse.rse.ui.view.NavFolder"); + //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. + layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET); + layout.addActionSet(IDebugUIConstants.DEBUG_ACTION_SET); + + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemPropertySheetForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemPropertySheetForm.java new file mode 100644 index 00000000000..6e0740cfa0d --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemPropertySheetForm.java @@ -0,0 +1,227 @@ +/******************************************************************************** + * 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.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.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.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; + Object src = event.getSource(); + }; + }; + //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); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemResolveFilterStringAPIProviderImpl.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemResolveFilterStringAPIProviderImpl.java new file mode 100644 index 00000000000..eb3bdc0914b --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemResolveFilterStringAPIProviderImpl.java @@ -0,0 +1,50 @@ +/******************************************************************************** + * 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.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 + + + /** + * Return true to show the button bar above the viewer. + * The tool bar contains "Get List" and "Refresh" buttons and is typicall + * shown in dialogs that list only remote system objects. + */ + public boolean showButtonBar() + { + return false; + } // end showButtonBar() + +} // end class SystemResolveFilterStringAPIProviderImpl \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemResourceSelectionForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemResourceSelectionForm.java new file mode 100644 index 00000000000..e19abeb66d9 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemResourceSelectionForm.java @@ -0,0 +1,610 @@ +/******************************************************************************** + * 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 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.SystemAdapterHelpers; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemRegistry; +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.IValidatorRemoteSelection; +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 SystemResourceSelectionInputProvider _inputProvider; + private SystemHostCombo _connectionCombo; + private SystemViewForm _systemViewForm; + private Composite _propertySheetContainer; + protected 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 _verbage = null; + protected Label verbageLabel; + private Composite _container; + + // history + private HashMap _history; + + // outputs + protected IHost outputConnection = null; + protected Object[] outputObjects = null; + + + public SystemResourceSelectionForm(Shell shell, Composite parent, Object caller, + SystemResourceSelectionInputProvider inputProvider, String verbage, + boolean multipleSelection, + ISystemMessageLine msgLine) + { + _msgLine= msgLine; + _history = new HashMap(); + _inputProvider = inputProvider; + _multipleSelection = multipleSelection; + _shell = shell; + _verbage = verbage; + 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. + * @see #setMultipleSelectionMode(boolean) + */ + public Object[] getSelectedObjects() + { + return outputObjects; + } + + 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/VERBAGE TEXT AT TOP + verbageLabel = (Label) SystemWidgetHelpers.createVerbage(composite_prompts, _verbage, gridColumns, false, PROMPT_WIDTH); + + + boolean allowMultipleConnnections = _inputProvider.allowMultipleConnections(); + if (!allowMultipleConnnections) + { + //Label connectionLabel = SystemWidgetHelpers.createLabel(composite_prompts, _inputProvider.getSystemConnection().getHostName()); + } + else + { + String[] systemTypes = _inputProvider.getSystemTypes(); + if (systemTypes != null) + { + _connectionCombo = new SystemHostCombo(composite_prompts, SWT.NULL, _inputProvider.getSystemTypes(), _inputProvider.getSystemConnection(), _inputProvider.allNewConnection()); + } + else + { + _connectionCombo = new SystemHostCombo(composite_prompts, SWT.NULL, "*", _inputProvider.getSystemConnection(), _inputProvider.allNewConnection()); + + } + _connectionCombo.addSelectionListener(new SelectionAdapter() + { + public void widgetSelected(SelectionEvent evt) + { + IHost connection = _connectionCombo.getHost(); + connectionChanged(connection); + }} + ); + } + + _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.getSystemView().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 getAdapter(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 0) + { + ISystemFilterReference ref = (ISystemFilterReference)filterRefs.get(0); + systemView.setExpandedElements(new Object[] {ref}); + systemView.refreshRemoteObject(selection, selection, true); + return true; + } + else + { + Object parent = adapter.getParent(selection); + if (setPreSelection(parent)) + { + systemView.refreshRemoteObject(selection, selection, true); + 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) + { + ISystemViewElementAdapter adapter = getAdapter(selection); + String 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(""); + 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(""); + 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. + *

    + * 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._verbage = message; + if (verbageLabel != null) + verbageLabel.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/ui/view/SystemResourceSelectionInputProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemResourceSelectionInputProvider.java new file mode 100644 index 00000000000..6fd2249b834 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemResourceSelectionInputProvider.java @@ -0,0 +1,115 @@ +/******************************************************************************** + * 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.view; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemRegistry; + + +public abstract class SystemResourceSelectionInputProvider extends SystemAbstractAPIProvider +{ + private IHost _connection; + private boolean _onlyConnection = false; + private boolean _allowNew = true; + private String[] _systemTypes; + + public SystemResourceSelectionInputProvider(IHost connection) + { + _connection = connection; + } + + public SystemResourceSelectionInputProvider() + { + _connection = null; + } + + public IHost getSystemConnection() + { + return _connection; + } + + public boolean allowMultipleConnections() + { + return !_onlyConnection; + } + + public void setAllowNewConnection(boolean flag) + { + _allowNew = flag; + } + + public boolean allNewConnection() + { + return _allowNew; + } + + public void setSystemConnection(IHost connection, boolean onlyConnection) + { + _connection = connection; + _onlyConnection = onlyConnection; + } + + public String[] getSystemTypes() + { + return _systemTypes; + } + + public void setSystemTypes(String[] types) + { + _systemTypes = types; + } + + public Object[] getSystemViewRoots() + { + if (_connection == null) + { + ISystemRegistry registry = SystemPlugin.getTheSystemRegistry(); + _connection = registry.getHosts()[0]; + + } + return getConnectionChildren(_connection); + } + + public boolean hasSystemViewRoots() + { + return false; + } + + public Object[] getConnectionChildren(IHost selectedConnection) + { + if (selectedConnection != null) + { + return getSubSystem(selectedConnection).getChildren(); + } + return null; + } + + public boolean hasConnectionChildren(IHost selectedConnection) + { + if (selectedConnection != null) + { + return getSubSystem(selectedConnection).hasChildren(); + } + return false; + } + + protected abstract ISubSystem getSubSystem(IHost selectedConnection); + + + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemSelectRemoteObjectAPIProviderImpl.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemSelectRemoteObjectAPIProviderImpl.java new file mode 100644 index 00000000000..c6a923bca4e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemSelectRemoteObjectAPIProviderImpl.java @@ -0,0 +1,634 @@ +/******************************************************************************** + * 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.SystemAdapterHelpers; +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.filters.ISystemFilterStringReference; +import org.eclipse.rse.filters.SystemFilterSimple; +import org.eclipse.rse.internal.model.SystemNewConnectionPromptObject; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.swt.widgets.Shell; + + +/** + * This class is a provider of root nodes to the remote systems tree viewer part. + *

    + * 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. + *

    + * 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 ISystemViewInputProvider, ISystemMessages +{ + + + 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 subsystemFactoryId; + protected String subsystemFactoryCategory; + protected String filterSuffix; + protected String[] 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. + *

    + * This can be done by giving one of two possible pieces of information: + *

      + *
    • 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. + *
    • 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. + *
    + *

    + * You must supply one of these. There is no need to supply both. + *

    + * 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 factoryId The subsystemFactoryId to restrict connections and subsystems to + * An alternative to factoryCategory. Specify only one, pass null for the other. + * @param factoryCategory The subsystemFactory 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 factoryId, String factoryCategory, + boolean showNewConnectionPrompt, String[] systemTypes) + { + super(); + this.subsystemFactoryId = factoryId; + this.subsystemFactoryCategory = factoryCategory; + 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 subsystemFactoryId,if that has been set! + * @see org.eclipse.rse.core.ISystemTypes + */ + public void setSystemTypes(String[] 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 = getAdapter(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(",")) + { + 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 + "' ***"); + } + + /** + * 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.filters.SystemFilterSimple + */ + 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 + "' ***"); + String result = inputFilterString; + if (filterSuffix.equals(" /nf")) + result = inputFilterString + filterSuffix; + else + { + /** FIXME - can't be coupled with IRemoteFile + RemoteFileFilterString rffs = + new RemoteFileFilterString((IRemoteFileSubSystemFactory)getSubSystemFactory(selectedObject), inputFilterString); + rffs.setFile(filterSuffix); + result = rffs.toString(); + */ + result = inputFilterString; + } + SystemBasePlugin.logDebugMessage(this.getClass().getName(), "*** ADORNED FILTER = '" + result + "' ***"); + 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 = getSubSystemFactory(selectedObject); + if (ssf == null) + return false; + /** FIXME - can't be coupled with IRemoteFile + return ((ssf instanceof IRemoteFileSubSystemFactory) && (filterSuffix != null)); + */ + return false; + + } + + /** + * get subsystem factory from filter or filter string + */ + private ISubSystemConfiguration getSubSystemFactory(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(subsystem); + else + { + children = resolveFilterString(subsystem, filterString); + } + + return checkForNull(children, 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(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); + + if ((subsystems != null) && (subsystems.length > 0)) + { + ISubSystem 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 = "+subsystemFactoryId+", SSFCat = "+subsystemFactoryCategory); + + 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; idx1); // 50167pc + children = new Object[1+conns.length]; + children[0] = connPrompt; + for (int idx=0; idx1)); // 50167pc + } + + return checkForNull(children, false); + } + + /** + * Given a connection, return the subsystem(s) appropriate for the given + * ssfactoryid or category + */ + protected ISubSystem[] getSubSystems(IHost selectedConnection) + { + ISubSystem[] subsystems = null; + if (subsystemFactoryId != null) + subsystems = sr.getSubSystems(subsystemFactoryId, selectedConnection); + else if (subsystemFactoryCategory != null) + subsystems = sr.getSubSystemsBySubSystemConfigurationCategory(subsystemFactoryCategory, 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, shell); + } catch (InterruptedException exc) + { + if (canceledObject == null) + children = getCancelledMessageObject(); + } catch (Exception exc) + { + children = getFailedMessageObject(); + SystemBasePlugin.logError("Error in SystemTestFilterStringAPIProviderImpl#getSystemViewRoots()",exc); + } + 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 getAdapter(Object o) + { + return SystemAdapterHelpers.getAdapter(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 + *

    + * Simply passes the request on to the caller. + *

    + * 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/ui/view/SystemTableTreeView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableTreeView.java new file mode 100644 index 00000000000..d6a6a23a5ff --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableTreeView.java @@ -0,0 +1,1839 @@ +/******************************************************************************** + * 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 java.util.ArrayList; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Vector; + +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.SystemAdapterHelpers; +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.SystemPopupMenuActionContributorManager; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.ISystemRemoteChangeEvent; +import org.eclipse.rse.model.ISystemRemoteChangeEvents; +import org.eclipse.rse.model.ISystemRemoteChangeListener; +import org.eclipse.rse.model.ISystemResourceChangeEvent; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.ISystemResourceChangeListener; +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.SystemMenuManager; +import org.eclipse.rse.ui.SystemPropertyResources; +import org.eclipse.rse.ui.actions.ISystemAction; +import org.eclipse.rse.ui.actions.SystemCommonDeleteAction; +import org.eclipse.rse.ui.actions.SystemCommonRenameAction; +import org.eclipse.rse.ui.actions.SystemCommonSelectAllAction; +import org.eclipse.rse.ui.actions.SystemOpenExplorerPerspectiveAction; +import org.eclipse.rse.ui.actions.SystemRefreshAction; +import org.eclipse.rse.ui.actions.SystemRemotePropertiesAction; +import org.eclipse.rse.ui.actions.SystemShowInTableAction; +import org.eclipse.rse.ui.actions.SystemSubMenuManager; +import org.eclipse.rse.ui.messages.ISystemMessageLine; +import org.eclipse.rse.ui.messages.SystemMessageDialog; +import org.eclipse.swt.SWT; +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.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.IWorkbenchPart; +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 tabletree viewer is used to + * show a generic tabletree view of the selected object + *

    + * + * TableViewer comes from com.ibm.jface.viewer + */ +public class SystemTableTreeView +// TODO change TreeViewer to TableTreeViewer when Eclipse fixes SWT viewer +//extends TableTreeViewer +extends TreeViewer +implements IMenuListener, ISystemDeleteTarget, ISystemRenameTarget, ISystemSelectAllTarget, ISystemResourceChangeListener, ISystemRemoteChangeListener, 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 = getAdapter(element); + adapter.setPropertySourceInput(element); + Object value = adapter.getPropertyValue(property); + if (value == null) + { + value = ""; + } + 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 = getAdapter(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 = SystemPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_MOVEUP_ID); + _downI = SystemPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_MOVEDOWN_ID); + } + + + /** + * Handles the case of user selecting the + * header area. + *

    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 SystemRemotePropertiesAction _remotePropertyDialogAction; + 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 IWorkbenchPart _workbenchPart = null; + + 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"); + _menuManager.setRemoveAllWhenShown(true); + _menuManager.addMenuListener(this); + Menu menu = _menuManager.createContextMenu(tableTree); + tableTree.setMenu(menu); + + addSelectionChangedListener(this); + + SystemPlugin.getTheSystemRegistry().addSystemResourceChangeListener(this); + SystemPlugin.getTheSystemRegistry().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 setWorkbenchPart(IWorkbenchPart part) + { + _workbenchPart = part; + } + + 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(); + Object[] children = 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 getAdapter(Object obj) + { + return SystemAdapterHelpers.getAdapter(obj, this); + } + + public SystemTableViewColumnManager getColumnManager() + { + return _columnManager; + } + + private IPropertyDescriptor[] getCustomDescriptors(ISystemViewElementAdapter adapter) + { + return _columnManager.getVisibleDescriptors(adapter); + } + /** + * 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 = getAdapter(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 getAdapter(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(); + 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; + 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; + 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() + { + Composite tree = getTableTree(); + + return new int[0]; + } + + public void setCurrentColumnWidths(int[] widths) + { + Composite tree = getTableTree(); + } + + public int[] getLastColumnWidths() + { + return _lastWidths; + } + + public void setLastColumnWidths(int[] widths) + { + _lastWidths = widths; + } + + protected void initDragAndDrop() + { + int ops = DND.DROP_COPY | DND.DROP_MOVE; + Transfer[] transfers = new Transfer[] { PluginTransfer.getInstance(), TextTransfer.getInstance(), EditorInputTransfer.getInstance(), FileTransfer.getInstance()}; + + addDragSupport(ops, transfers, new SystemViewDataDragAdapter((ISelectionProvider) this)); + addDropSupport(ops | DND.DROP_DEFAULT, transfers, new SystemViewDataDropAdapter(this)); + } + + /** + * Used to asynchronously update the view whenever properties change. + */ + 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_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.model.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); + Vector remoteResourceNames = null; + if (remoteResource instanceof Vector) + { + remoteResourceNames = (Vector) remoteResource; + remoteResource = remoteResourceNames.elementAt(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 = getAdapter(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 = getAdapter(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.getOldName(); + 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 = getAdapter(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 + { + ISystemRemoteElementAdapter ra = getRemoteAdapter(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 = getAdapter(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 getAdapterForContents() + { + SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider) getContentProvider(); + Object[] children = provider.getChildren(getInput()); + if (children != null && children.length > 0) + { + IAdaptable child = (IAdaptable) children[0]; + return getAdapter(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); + SystemPlugin.getTheSystemRegistry().removeSystemResourceChangeListener(this); + SystemPlugin.getTheSystemRegistry().removeSystemRemoteChangeListener(this); + + 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; + } + /** + * Rather than pre-defining this common action we wait until it is first needed, + * for performance reasons. + */ + protected SystemRemotePropertiesAction getRemotePropertyDialogAction() + { + if (_remotePropertyDialogAction == null) + { + _remotePropertyDialogAction = new SystemRemotePropertiesAction(getShell()); + } + _remotePropertyDialogAction.setSelection(getSelection()); + return _remotePropertyDialogAction; + } + /** + * 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 Systems 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 Systems 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 = SystemPlugin.getDefault().getSystemRegistry(); + 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 = getAdapter(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(), SystemPlugin.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.fireEvent(new com.ibm.etools.systems.model.impl.SystemResourceChangeEvent(deleted, ISystemResourceChangeEvent.EVENT_DELETE_REMOTE_MANY, null)); + sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED, deletedVector, null, null, null, this); + else + sr.fireEvent(new org.eclipse.rse.model.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 = SystemPlugin.getDefault().getSystemRegistry(); + 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 = getAdapter(element); + Object parentElement = getParentForContent(element); + + remoteAdapter = getRemoteAdapter(element); + if (remoteAdapter != null) + oldFullName = remoteAdapter.getAbsoluteName(element); + // pre-rename + ok = adapter.doRename(getShell(), element, newNames[nameIdx++]); + if (ok) + { + if (remoteAdapter != null) { + sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED, element, parentElement, remoteAdapter.getSubSystem(element), oldFullName, this); + } + else { + sr.fireEvent(new org.eclipse.rse.model.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(), SystemPlugin.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) + { + + 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 = getAdapter(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); + + if (!_selectionIsRemoteObject) // is not a remote object + { + PropertyDialogAction pdAction = getPropertyDialogAction(); + if (pdAction.isApplicableForSelection()) + { + + menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); + } + // OPEN IN NEW PERSPECTIVE ACTION... if (fromSystemViewPart && showOpenViewActions()) + { + //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); + + } + } + else // is a remote object + { + //Object firstSelection = selection.getFirstElement(); + //ISystemRemoteElementAdapter remoteAdapter = getRemoteAdapter(firstSelection); + //logMyDebugMessage(this.getClass().getName(), ": there is a remote adapter"); + SystemRemotePropertiesAction pdAction = getRemotePropertyDialogAction(); + if (pdAction.isApplicableForSelection()) + menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); + //else + //logMyDebugMessage(this.getClass().getName(), ": but it is not applicable for selection"); + // -------------------------------------------------------------------------------------------------------------------- + // look for and add any popup menu actions registered via our org.eclipse.rse.core.popupMenus extension point... + // -------------------------------------------------------------------------------------------------------------------- + if (_workbenchPart != null) + { + SystemPopupMenuActionContributorManager.getManager().contributeObjectActions(_workbenchPart, ourMenu, this, null); + } + } + + } + } + + /** + * 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. + *

    + * 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; idxtrue if the container must be a direct ancestor of the child item, + * false otherwise. + * @return true if there is an ancestry relationship, false 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. + *

    + * 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 = getAdapter(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(); + Composite tree = getTableTree(); + } + + 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(); + } + } + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableTreeViewProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableTreeViewProvider.java new file mode 100644 index 00000000000..c003c0f499c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableTreeViewProvider.java @@ -0,0 +1,343 @@ +/******************************************************************************** + * 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 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.jface.resource.ImageDescriptor; +import org.eclipse.jface.util.ListenerList; +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.SystemAdapterHelpers; +import org.eclipse.rse.model.ISystemContainer; +import org.eclipse.swt.graphics.Image; +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; + + /** + * 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; + } + + 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) + { + return getAdapterFor(object).getParent(object); + } + + public boolean hasChildren(Object object) + { + return getAdapterFor(object).hasChildren(object); + + } + + public Object getElementAt(Object object, int i) + { + + return null; + } + + + + protected ISystemViewElementAdapter getAdapterFor(Object object) + { + ISystemViewElementAdapter result = null; + if (_viewer != null) + { + result = SystemAdapterHelpers.getAdapter(object, _viewer); + } + else + { + result = SystemAdapterHelpers.getAdapter(object); + } + result.setPropertySourceInput(object); + return result; + } + + public Object[] getElements(Object object) + { + Object[] results = null; + if (object == _lastObject && _lastResults != null) + { + return _lastResults; + } + else + if (object instanceof IAdaptable) + { + ISystemViewElementAdapter adapter = getAdapterFor(object); + adapter.setViewer(_viewer); + if (adapter != null && adapter.hasChildren(object)) + { + results = adapter.getChildren(object); + 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 ""; + } + + } + + 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)); + } + + /** + * The visual part that is using this content provider is about + * to be disposed. Deallocate all allocated SWT resources. + */ + public void dispose() { + } +} \ No newline at end of file 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 new file mode 100644 index 00000000000..3208ba51f29 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java @@ -0,0 +1,1905 @@ +/******************************************************************************** + * 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 java.util.ArrayList; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Vector; + +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.TableViewer; +import org.eclipse.jface.window.SameShellProvider; +import org.eclipse.rse.core.SystemAdapterHelpers; +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.SystemPopupMenuActionContributorManager; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemContainer; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.ISystemRemoteChangeEvent; +import org.eclipse.rse.model.ISystemRemoteChangeEvents; +import org.eclipse.rse.model.ISystemRemoteChangeListener; +import org.eclipse.rse.model.ISystemResourceChangeEvent; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.ISystemResourceChangeListener; +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.SystemMenuManager; +import org.eclipse.rse.ui.SystemPropertyResources; +import org.eclipse.rse.ui.actions.ISystemAction; +import org.eclipse.rse.ui.actions.SystemCommonDeleteAction; +import org.eclipse.rse.ui.actions.SystemCommonRenameAction; +import org.eclipse.rse.ui.actions.SystemCommonSelectAllAction; +import org.eclipse.rse.ui.actions.SystemOpenExplorerPerspectiveAction; +import org.eclipse.rse.ui.actions.SystemRefreshAction; +import org.eclipse.rse.ui.actions.SystemRemotePropertiesAction; +import org.eclipse.rse.ui.actions.SystemShowInTableAction; +import org.eclipse.rse.ui.actions.SystemSubMenuManager; +import org.eclipse.rse.ui.messages.ISystemMessageLine; +import org.eclipse.rse.ui.messages.SystemMessageDialog; +import org.eclipse.swt.SWT; +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.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.IWorkbenchPart; +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 + *

    + * + * TableViewer comes from com.ibm.jface.viewer + */ +public class SystemTableView + extends TableViewer + implements IMenuListener, ISystemDeleteTarget, ISystemRenameTarget, ISystemSelectAllTarget, ISystemResourceChangeListener, ISystemRemoteChangeListener, ISelectionChangedListener, ISelectionProvider +{ + + + // inner class to support cell editing + private ICellModifier cellModifier = new ICellModifier() + { + public Object getValue(Object element, String property) + { + ISystemViewElementAdapter adapter = getAdapter(element); + adapter.setPropertySourceInput(element); + Object value = adapter.getPropertyValue(property); + if (value == null) + { + value = ""; + } + 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 = getAdapter(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 = SystemPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_MOVEUP_ID); + _downI = SystemPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_MOVEDOWN_ID); + } + + + /** + * Handles the case of user selecting the + * header area. + *

    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. + protected SystemRefreshAction _refreshAction; + protected PropertyDialogAction _propertyDialogAction; + protected SystemRemotePropertiesAction _remotePropertyDialogAction; + 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 IWorkbenchPart _workbenchPart = null; + 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, SystemPlugin.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator())); + //setLabelProvider(_provider); + + _filter = new SystemTableViewFilter(); + addFilter(_filter); + + _charWidth = table.getFont().getFontData()[0].getHeight() / 2; + computeLayout(); + + _menuManager = new MenuManager("#PopupMenu"); + _menuManager.setRemoveAllWhenShown(true); + _menuManager.addMenuListener(this); + Menu menu = _menuManager.createContextMenu(table); + table.setMenu(menu); + + addSelectionChangedListener(this); + + SystemPlugin.getTheSystemRegistry().addSystemResourceChangeListener(this); + SystemPlugin.getTheSystemRegistry().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 = SystemPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_ARROW_UP_ID); + _downI = SystemPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_ARROW_DOWN_ID); + } + + 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 setWorkbenchPart(IWorkbenchPart part) + { + _workbenchPart = part; + } + + 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 getAdapter(Object obj) + { + ISystemViewElementAdapter adapter = SystemAdapterHelpers.getAdapter(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 getAdapter(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(getAdapter(child)); + } + + return new IPropertyDescriptor[0]; + } + + public SystemTableViewColumnManager 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 getAdapter(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); + results.add(propertyValue.getClass()); + } + 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; + 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; + } + + protected void initDragAndDrop() + { + int ops = DND.DROP_COPY | DND.DROP_MOVE; + Transfer[] transfers = new Transfer[] { PluginTransfer.getInstance(), TextTransfer.getInstance(), EditorInputTransfer.getInstance(), FileTransfer.getInstance()}; + + addDragSupport(ops, transfers, new SystemViewDataDragAdapter((ISelectionProvider) this)); + addDropSupport(ops | DND.DROP_DEFAULT, transfers, new SystemViewDataDropAdapter(this)); + } + + /** + * Used to asynchronously update the view whenever properties change. + */ + 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) + { + + } + } + 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: + { + if (child == SystemPlugin.getTheSystemRegistry()) + { + // treat this as refresh all + child = _objectInput; + } + } + 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.model.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); + Vector remoteResourceNames = null; + if (remoteResource instanceof Vector) + { + remoteResourceNames = (Vector) remoteResource; + remoteResource = remoteResourceNames.elementAt(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) + { + provider.flushCache(); + madeChange = true; + } + + refresh(); + } + } + break; + + // -------------------------- + // REMOTE RESOURCE DELETED... + // -------------------------- + case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED : + { + { + Object dchild = remoteResource; + + ISystemViewElementAdapter dadapt = getAdapter(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 = getAdapter(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.getOldName(); + 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 = getAdapter(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 + { + ISystemRemoteElementAdapter ra = getRemoteAdapter(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 = getAdapter(firstSelection); + if (adapter != null) + { + displayMessage(adapter.getStatusLineText(firstSelection)); + if ((mouseButtonPressed == LEFT_BUTTON)) + adapter.selectionChanged(firstSelection); + } + else + clearMessage(); + } + + public void dispose() + { + removeSelectionChangedListener(this); + SystemPlugin.getTheSystemRegistry().removeSystemResourceChangeListener(this); + SystemPlugin.getTheSystemRegistry().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; + } + /** + * Rather than pre-defining this common action we wait until it is first needed, + * for performance reasons. + */ + protected SystemRemotePropertiesAction getRemotePropertyDialogAction() + { + if (_remotePropertyDialogAction == null) + { + _remotePropertyDialogAction = new SystemRemotePropertiesAction(getShell()); + } + _remotePropertyDialogAction.setSelection(getSelection()); + return _remotePropertyDialogAction; + } + /** + * 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 Systems 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 Systems 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 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 = SystemPlugin.getDefault().getSystemRegistry(); + 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 = getAdapter(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(), SystemPlugin.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.fireEvent(new com.ibm.etools.systems.model.impl.SystemResourceChangeEvent(deleted, ISystemResourceChangeEvent.EVENT_DELETE_REMOTE_MANY, null)); + sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED, deletedVector, null, null, null, this); + else + sr.fireEvent(new org.eclipse.rse.model.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 = SystemPlugin.getDefault().getSystemRegistry(); + 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 = getAdapter(element); + Object parentElement = getParentForContent(element); + + remoteAdapter = getRemoteAdapter(element); + if (remoteAdapter != null) + oldFullName = remoteAdapter.getAbsoluteName(element); + // pre-rename + ok = adapter.doRename(getShell(), element, newNames[nameIdx++]); + if (ok) + { + if (remoteAdapter != null) + { + // do rename here + Widget widget = findItem(element); + if (widget != null) + { + updateItem(widget, element); + } + + //sr.fireEvent(new com.ibm.etools.systems.model.impl.SystemResourceChangeEvent(element, ISystemResourceChangeEvent.EVENT_RENAME_REMOTE, oldFullName)); + sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED, element, parentElement, remoteAdapter.getSubSystem(element), oldFullName, this); + + } + else + sr.fireEvent(new org.eclipse.rse.model.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(), SystemPlugin.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) + { + 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) + { + SystemView.createStandardGroups(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(); + int selectionCount = selection.size(); + + { + + // 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 = getAdapter(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 (!_selectionIsRemoteObject) // is not a remote object + { + PropertyDialogAction pdAction = getPropertyDialogAction(); + if (pdAction.isApplicableForSelection()) + { + + menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); + } + // OPEN IN NEW PERSPECTIVE ACTION... if (fromSystemViewPart && showOpenViewActions()) + { + //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); + + } + } + else // is a remote object + { + //Object firstSelection = selection.getFirstElement(); + //ISystemRemoteElementAdapter remoteAdapter = getRemoteAdapter(firstSelection); + //logMyDebugMessage(this.getClass().getName(), ": there is a remote adapter"); + SystemRemotePropertiesAction pdAction = getRemotePropertyDialogAction(); + if (pdAction.isApplicableForSelection()) + menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); + //else + //logMyDebugMessage(this.getClass().getName(), ": but it is not applicable for selection"); + // -------------------------------------------------------------------------------------------------------------------- + // look for and add any popup menu actions registered via our org.eclipse.rse.core.popupMenus extension point... + // -------------------------------------------------------------------------------------------------------------------- + if (_workbenchPart != null) + { + SystemPopupMenuActionContributorManager.getManager().contributeObjectActions(_workbenchPart, ourMenu, this, null); + } + } + + } + } + + /** + * -------------------------------------------------------------------------------- + * 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. + *

    + * 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 = getAdapter(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(); + 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 = getAdapter(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/SystemTableViewColumnManager.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewColumnManager.java new file mode 100644 index 00000000000..e668557288d --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewColumnManager.java @@ -0,0 +1,146 @@ +/******************************************************************************** + * 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.view; +import java.util.HashMap; + +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.rse.core.SystemPreferencesManager; +import org.eclipse.ui.views.properties.IPropertyDescriptor; + + +/** + * @author dmcknigh + */ +public class SystemTableViewColumnManager +{ + 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); + SystemPreferencesManager mgr = SystemPreferencesManager.getPreferencesManager(); + String historyKey = getHistoryKey(adapter); + String[] history = new String[descriptors.length]; + for (int i = 0; i < descriptors.length; i++) + { + history[i] = descriptors[i].getId().toString(); + } + + mgr.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 + */ + 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; + } + + protected IPropertyDescriptor[] getCustomDescriptors(ISystemViewElementAdapter adapter) + { + IPropertyDescriptor[] uniqueDescriptors = adapter.getUniquePropertyDescriptors(); + + SystemPreferencesManager mgr = SystemPreferencesManager.getPreferencesManager(); + String historyKey = getHistoryKey(adapter); + String[] history = mgr.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]; + 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/ui/view/SystemTableViewFilter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewFilter.java new file mode 100644 index 00000000000..6760405620c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewFilter.java @@ -0,0 +1,81 @@ +/******************************************************************************** + * 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.ITableLabelProvider; +import org.eclipse.jface.viewers.TableViewer; +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; + } + } + } + } + } + + return result; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewPart.java new file mode 100644 index 00000000000..ff12ddd9a26 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewPart.java @@ -0,0 +1,1839 @@ +/******************************************************************************** + * 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 java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +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.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +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.SystemPlugin; +import org.eclipse.rse.core.SystemPreferencesManager; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemContainer; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.ISystemRemoteChangeEvent; +import org.eclipse.rse.model.ISystemRemoteChangeEvents; +import org.eclipse.rse.model.ISystemRemoteChangeListener; +import org.eclipse.rse.model.ISystemResourceChangeEvent; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.ISystemResourceChangeListener; +import org.eclipse.rse.model.SystemResourceChangeEvent; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemPropertyResources; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.SystemWidgetHelpers; +import org.eclipse.rse.ui.actions.SystemCommonDeleteAction; +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.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.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.progress.UIJob; +import org.eclipse.ui.views.properties.IPropertyDescriptor; +import org.osgi.framework.Bundle; + + + +/** + * Comment goes here + */ +public class SystemTableViewPart extends ViewPart implements ISelectionListener, ISelectionChangedListener, + ISystemMessageLine, 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")); + + setTitleToolTip(SystemResources.ACTION_HISTORY_MOVEFORWARD_TOOLTIP); + setDisabledImageDescriptor(getEclipseImageDescriptor("dlcl16/forward_nav.gif")); + } + + 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")); + setTitleToolTip(SystemResources.ACTION_HISTORY_MOVEBACKWARD_TOOLTIP); + setDisabledImageDescriptor(getEclipseImageDescriptor("dlcl16/backward_nav.gif")); + } + + 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_MOVEUP_LABEL, getEclipseImageDescriptor("elcl16/up_nav.gif")); + + setDisabledImageDescriptor(getEclipseImageDescriptor("dlcl16/up_nav.gif")); + } + + 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; + boolean enabled = _parent != null; + setEnabled(enabled); + } + } + 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(SystemPlugin.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_LABEL, + //SystemPlugin.getDefault().getImageDescriptor(ICON_SYSTEM_REFRESH_ID)); + SystemPlugin.getDefault().getImageDescriptorFromIDE(ISystemIconConstants.ICON_IDE_REFRESH_ID)); + } + + public void run() + { + Object inputObject = _viewer.getInput(); + if (inputObject instanceof ISystemContainer) + { + ((ISystemContainer)inputObject).markStale(true); + } + ((SystemTableViewProvider) _viewer.getContentProvider()).flushCache(); + ISystemRegistry registry = SystemPlugin.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); + Object inputObject = _viewer.getInput(); + if (inputObject == null) + { + inputObject = SystemPlugin.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("*"); + _cbName.setToolTipText(SystemResources.RESID_TABLE_POSITIONTO_ENTRY_TOOLTIP); + + this.getShell().setText(SystemResources.RESID_TABLE_POSITIONTO_LABEL); + setHelp(); + return c; + } + + private void setHelp() + { + setHelp(SystemPlugin.HELPPREFIX + "gnpt0000"); + } + } + + 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("*"); + _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); + _controls[i + 1].setLayoutData(textData3); + _controls[i + 1].setText("*"); + 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(SystemPlugin.HELPPREFIX + "gnss0000"); + } + } + + 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 UIJob + { + private IMemento _memento; + public RestoreStateRunnable(IMemento memento) + { + super("Restore RSE Table"); + _memento = memento; + } + + public IStatus runInUIThread(IProgressMonitor monitor) + { + IMemento memento = _memento; + 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); + String filterID = memento.getString(TAG_TABLE_VIEW_FILTER_ID); + String objectID = memento.getString(TAG_TABLE_VIEW_OBJECT_ID); + + ISystemRegistry registry = SystemPlugin.getTheSystemRegistry(); + Object input = null; + if (subsystemId == null) + { + if (connectionId != null) + { + + ISystemProfile profile = registry.getSystemProfile(profileId); + input = registry.getHost(profile, connectionId); + } + else + { + // TODO why did we use null for a while? + //input = null; + input = registry; + } + } + else + { + // from the subsystem ID determine the profile, system and subsystem + ISubSystem subsystem = registry.getSubSystem(subsystemId); + + if (subsystem != null) + { + if (filterID == null && objectID == null) + { + input = subsystem; + } + else + { + + if (!subsystem.isConnected()) + { + try + { + subsystem.connect(); + } + catch (Exception e) + { + return Status.CANCEL_STATUS; + } + } + if (subsystem.isConnected()) + { + + if (filterID != null) + { + try + { + input = subsystem.getObjectWithAbsoluteName(filterID); + } + catch (Exception e) + { + } + } + else + { + + if (objectID != null) + { + + try + { + input = subsystem.getObjectWithAbsoluteName(objectID); + } + catch (Exception e) + { + return Status.CANCEL_STATUS; + } + } + } // end else + } // end if (subsystem.isConnected) + } // end else + } // end if (subsystem != null) + } // end else + + 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, ","); + 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); + } + + setInput(_mementoInput); + } + } + return Status.OK_STATUS; + } + + } + + + + private class SelectColumnsAction extends BrowseAction + { + + class SelectColumnsDialog extends SystemPromptDialog + { + private ISystemViewElementAdapter _adapter; + private SystemTableViewColumnManager _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, SystemTableViewColumnManager columnManager) + { + super(shell, SystemResources.RESID_TABLE_SELECT_COLUMNS_LABEL); + _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); + + Label label = 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(SystemPlugin.HELPPREFIX + "gntc0000"); + } + } + + public SelectColumnsAction() + { + super(SystemResources.ACTION_SELECTCOLUMNS_LABEL, null); + setToolTipText(SystemResources.ACTION_SELECTCOLUMNS_TOOLTIP); + setImageDescriptor(SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTER_ID)); + } + + public void checkEnabledState() + { + if (_viewer != null && _viewer.getInput() != null) + { + setEnabled(true); + } + else + { + setEnabled(false); + } + } + public void run() + { + SystemTableViewColumnManager 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 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 + + // Restore memento tags + public static final String TAG_TABLE_VIEW_PROFILE_ID = "tableViewProfileID"; + public static final String TAG_TABLE_VIEW_CONNECTION_ID = "tableViewConnectionID"; + public static final String TAG_TABLE_VIEW_SUBSYSTEM_ID = "tableViewSubsystemID"; + public static final String TAG_TABLE_VIEW_OBJECT_ID = "tableViewObjectID"; + public static final String TAG_TABLE_VIEW_FILTER_ID = "tableViewFilterID"; + + // Subset memento tags + public static final String TAG_TABLE_VIEW_SUBSET = "subset"; + + // layout memento tags + public static final String TAG_TABLE_VIEW_COLUMN_WIDTHS_ID = "columnWidths"; + + public void setFocus() + { + if (_viewer.getInput() == null) + { + if (_memento != null) + { + restoreState(_memento); + } + else + { + setInput(SystemPlugin.getTheSystemRegistry()); + } + } + + _viewer.getControl().setFocus(); + } + + public SystemTableView getViewer() + { + return _viewer; + } + + public Viewer getRSEViewer() + { + return _viewer; + } + + public void createPartControl(Composite parent) + { + Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION | SWT.HIDE_SELECTION); + _viewer = new SystemTableView(table, this); + _viewer.setWorkbenchPart(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 + ISystemRegistry registry = SystemPlugin.getTheSystemRegistry(); + Clipboard clipboard = registry.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); + + editorActionHandler.setCopyAction(_copyAction); + editorActionHandler.setPasteAction(_pasteAction); + editorActionHandler.setDeleteAction(_deleteAction); + editorActionHandler.setSelectAllAction(new SelectAllAction()); + + registry.addSystemResourceChangeListener(this); + registry.addSystemRemoteChangeListener(this); + + SystemWidgetHelpers.setHelp(_viewer.getControl(), SystemPlugin.HELPPREFIX + "sysd0000"); + + 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); + + SystemPlugin.getTheSystemRegistry().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) + { + if (adapter.hasChildren(element)) + { + setInput((IAdaptable) element); + } + else + { + alreadyHandled = adapter.handleDoubleClick(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("/"); + 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")); + menuManager.add(_selectInputAction); + menuManager.add(new Separator("Filter")); + 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")); + // only support history when we're locked + if (_isLocked) + { + toolBarManager.add(_backwardAction); + toolBarManager.add(_forwardAction); + } + + toolBarManager.add(_upAction); + + toolBarManager.add(new Separator("View")); + 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) + { + setInput(object, null, _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(""); + } + else + { + ISystemViewElementAdapter va = (ISystemViewElementAdapter) object.getAdapter(ISystemViewElementAdapter.class); + if (va != null) + { + String type = va.getType(object); + String name = va.getName(object); + //setPartName(type + " " + name); + + setContentDescription(type + " "+ name); + + //SystemTableViewProvider provider = (SystemTableViewProvider) _viewer.getContentProvider(); + //setTitleImage(provider.getImage(object)); + } + } + } + + /** + * 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: + case ISystemResourceChangeEvents.EVENT_DELETE_MANY: + { + if (child instanceof ISystemFilterReference) + { + + if (child == input) + { + removeFromHistory(input); + } + } + } + break; + default: + break; + } + } + + protected void removeFromHistory(Object c) + { + // if the object is in history, remove it since it's been deleted + for (int i = 0; i < _browseHistory.size(); i++) + { + HistoryItem hist = (HistoryItem)_browseHistory.get(i); + if (hist.getObject() == c) + { + + _browseHistory.remove(hist); + if (_browsePosition >= i) + { + _browsePosition--; + if (_browsePosition < 0) + { + _browsePosition = 0; + } + } + if (hist == _currentItem) + { + if (_browseHistory.size() > 0) + { + _currentItem = (HistoryItem)_browseHistory.get(_browsePosition); + setInput(_currentItem.getObject(), null, false); + } + else + { + _currentItem = null; + setInput((IAdaptable)null, null, 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.model.ISystemRemoteChangeEvent + */ + public void systemRemoteResourceChanged(ISystemRemoteChangeEvent event) + { + int eventType = event.getEventType(); + Object remoteResourceParent = event.getResourceParent(); + Object remoteResource = event.getResource(); + + Vector remoteResourceNames = null; + if (remoteResource instanceof Vector) + { + remoteResourceNames = (Vector) remoteResource; + remoteResource = remoteResourceNames.elementAt(0); + } + + Object child = event.getResource(); + + + 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); + + 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(SystemPlugin.getTheSystemRegistry()); + rsr.schedule(); + _memento = null; + } + + /** + * 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. + *

    + * 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.getPreferencesManager().getRememberState()) + { + _memento = memento; + + } + } + + /** + * Method declared on IViewPart. + */ + public void saveState(IMemento memento) + { + super.saveState(memento); + + if (!SystemPreferencesManager.getPreferencesManager().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 = SystemPlugin.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 + ","; + } + } + 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 null is returned. + */ + public String getErrorMessage() + { + return _errorMessage; + } + /** + * Get the currently displayed message. + * @return The message. If no message is displayed null 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 null 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/ui/view/SystemTableViewProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewProvider.java new file mode 100644 index 00000000000..37473ae3641 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewProvider.java @@ -0,0 +1,354 @@ +/******************************************************************************** + * 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 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.jface.resource.ImageDescriptor; +import org.eclipse.jface.util.ListenerList; +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.SystemAdapterHelpers; +import org.eclipse.rse.model.ISystemContainer; +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. + * + */ +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 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 SystemTableViewProvider(SystemTableViewColumnManager 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 + * @param columnManager + */ + 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) + { + return getAdapterFor(object).getParent(object); + } + + 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.getAdapter(object, _viewer); + } + else + { + result = SystemAdapterHelpers.getAdapter(object); + } + result.setPropertySourceInput(object); + return result; + } + + public Object[] getElements(Object object) + { + Object[] results = null; + if (object == _lastObject && _lastResults != null) + { + return _lastResults; + } + else + if (object instanceof IAdaptable) + { + ISystemViewElementAdapter adapter = getAdapterFor(object); + if (adapter != null) + { + adapter.setViewer(_viewer); + results = adapter.getChildren(object); + 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 ""; + } + + } + + 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 + + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewSorter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewSorter.java new file mode 100644 index 00000000000..4f56981f241 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewSorter.java @@ -0,0 +1,184 @@ +/******************************************************************************** + * 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 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.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 ""; + } + + 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; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTestFilterStringAPIProviderImpl.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTestFilterStringAPIProviderImpl.java new file mode 100644 index 00000000000..58a70927a83 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTestFilterStringAPIProviderImpl.java @@ -0,0 +1,175 @@ +/******************************************************************************** + * 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.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemMessageObject; +import org.eclipse.rse.model.SystemMessageObject; +import org.eclipse.rse.ui.ISystemMessages; + + +/** + * 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 + implements ISystemViewInputProvider, ISystemMessages +{ + + + protected String filterString = null; + protected ISubSystem subsystem = null; + protected Object[] emptyList = new Object[0]; + protected Object[] msgList = new Object[1]; + protected SystemMessageObject nullObject = null; + protected SystemMessageObject canceledObject = null; + protected SystemMessageObject errorObject = 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; + } + + private void initMsgObjects() + { + nullObject = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_EMPTY),ISystemMessageObject.MSGTYPE_EMPTY, null); + canceledObject = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_LIST_CANCELLED),ISystemMessageObject.MSGTYPE_CANCEL, null); + errorObject = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_FAILED),ISystemMessageObject.MSGTYPE_ERROR, null); + } + + /** + * 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, shell); + if ((children == null) || (children.length==0)) + { + if (nullObject == null) + initMsgObjects(); + msgList[0] = nullObject; + children = msgList; + } + } catch (InterruptedException exc) + { + if (canceledObject == null) + initMsgObjects(); + msgList[0] = canceledObject; + children = msgList; + } catch (Exception exc) + { + if (errorObject == null) + initMsgObjects(); + msgList[0] = errorObject; + children = msgList; + SystemBasePlugin.logError("Error in SystemTestFilterStringAPIProviderImpl#getSystemViewRoots()",exc); + } + 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. + *

    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. + *

    NOT APPLICABLE TO US + */ + public boolean hasConnectionChildren(IHost selectedConnection) + { + return true; + } + + /** + * Return true to show the action bar (ie, toolbar) above the viewer. + * The action bar contains connection actions, predominantly. + */ + public boolean showActionBar() + { + return false; + } + /** + * Return true to show the button bar above the viewer. + * The tool bar contains "Get List" and "Refresh" buttons and is typicall + * shown in dialogs that list only remote system objects. + */ + public boolean showButtonBar() + { + return true; + } + /** + * Return true to show right-click popup actions on objects in the tree. + */ + public boolean showActions() + { + return false; + } + + + + // ---------------------------------- + // OUR OWN METHODS... + // ---------------------------------- + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemView.java new file mode 100644 index 00000000000..dc8200f5633 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemView.java @@ -0,0 +1,5846 @@ +/******************************************************************************** + * 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 java.util.ArrayList; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Vector; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +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.IDoubleClickListener; +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.ITreeContentProvider; +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.TreeViewer; +import org.eclipse.jface.viewers.ViewerFilter; +import org.eclipse.jface.window.SameShellProvider; +import org.eclipse.rse.core.SystemAdapterHelpers; +import org.eclipse.rse.core.SystemElapsedTimer; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.SystemPopupMenuActionContributorManager; +import org.eclipse.rse.core.SystemPreferencesManager; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterContainer; +import org.eclipse.rse.filters.ISystemFilterContainerReference; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.filters.ISystemFilterString; +import org.eclipse.rse.filters.ISystemFilterStringReference; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemContainer; +import org.eclipse.rse.model.ISystemMessageObject; +import org.eclipse.rse.model.ISystemPromptableObject; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.ISystemRemoteChangeEvent; +import org.eclipse.rse.model.ISystemRemoteChangeEvents; +import org.eclipse.rse.model.ISystemRemoteChangeListener; +import org.eclipse.rse.model.ISystemResourceChangeEvent; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.ISystemResourceChangeListener; +import org.eclipse.rse.model.ISystemResourceSet; +import org.eclipse.rse.model.SystemRemoteElementResourceSet; +import org.eclipse.rse.model.SystemRemoteResourceSet; +import org.eclipse.rse.references.ISystemBaseReferencingObject; +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.SystemMenuManager; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.actions.ISystemAction; +import org.eclipse.rse.ui.actions.SystemCascadingGoToAction; +import org.eclipse.rse.ui.actions.SystemCollapseAction; +import org.eclipse.rse.ui.actions.SystemCommonDeleteAction; +import org.eclipse.rse.ui.actions.SystemCommonRenameAction; +import org.eclipse.rse.ui.actions.SystemCommonSelectAllAction; +import org.eclipse.rse.ui.actions.SystemExpandAction; +import org.eclipse.rse.ui.actions.SystemNewConnectionAction; +import org.eclipse.rse.ui.actions.SystemOpenExplorerPerspectiveAction; +import org.eclipse.rse.ui.actions.SystemRefreshAction; +import org.eclipse.rse.ui.actions.SystemRemotePropertiesAction; +import org.eclipse.rse.ui.actions.SystemShowInMonitorAction; +import org.eclipse.rse.ui.actions.SystemShowInTableAction; +import org.eclipse.rse.ui.actions.SystemSubMenuManager; +import org.eclipse.rse.ui.messages.ISystemMessageLine; +import org.eclipse.rse.ui.messages.SystemMessageDialog; +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.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.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.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.dialogs.PropertyDialogAction; +import org.eclipse.ui.part.EditorInputTransfer; +import org.eclipse.ui.part.PluginTransfer; +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. + */ +public class SystemView extends TreeViewer implements ISystemTree, + ISystemResourceChangeListener, + ISystemRemoteChangeListener, + IMenuListener, + //MenuListener, + //IDoubleClickListener, + //ArmListener, + ISelectionChangedListener, + ISelectionProvider, + ITreeViewerListener, + ISystemResourceChangeEvents, + ISystemDeleteTarget, + ISystemRenameTarget, + ISystemSelectAllTarget + //, IWireEventTarget +{ + + protected Shell shell; // shell hosting this viewer + 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 + protected SystemNewConnectionAction newConnectionAction; + protected SystemRefreshAction refreshAction; + protected PropertyDialogAction propertyDialogAction; + protected SystemRemotePropertiesAction remotePropertyDialogAction; + protected SystemCollapseAction collapseAction; // defect 41203 + protected SystemExpandAction expandAction; // defect 41203 + protected SystemOpenExplorerPerspectiveAction openToPerspectiveAction; + + protected SystemShowInTableAction showInTableAction; + protected SystemShowInMonitorAction showInMonitorAction; + protected GoIntoAction goIntoAction; + protected SystemCascadingGoToAction gotoActions; + // 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 + // special flags needed when building popup menu, set after examining selections + 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; + public boolean doTimings = false; + public SystemElapsedTimer elapsedTime = new SystemElapsedTimer(); + // 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); + this.shell = shell; + this.inputProvider = inputProvider; + this.inputProvider.setShell(shell); // DY: defect 44544 + 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); + this.shell = shell; + this.inputProvider = inputProvider; + this.inputProvider.setShell(shell); // DY: defect 44544 + 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); + this.shell = shell; + this.inputProvider = inputProvider; + this.inputProvider.setShell(shell); // DY: defect 44544 + 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); + this.shell = shell; + this.inputProvider = inputProvider; + this.inputProvider.setShell(shell); // DY: defect 44544 + this.messageLine = msgLine; + init(); + } + + /** + * Set the input provider. Sometimes this is delayed, or can change. + */ + public void setInputProvider(ISystemViewInputProvider inputProvider) + { + this.inputProvider = inputProvider; + inputProvider.setViewer(this); + inputProvider.setShell(getShell()); // DY: Defect 44544, shell was not being set for Test dialogs, when they + // tried to connect there was not shell for the password prompt + // and an error message (expand failed) occured. + 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) + { + setLabelProvider(new DecoratingLabelProvider(lcProvider, SystemPlugin.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator())); + 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 + + // 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 + // ---------------------------------------- + SystemPlugin.getTheSystemRegistry().addSystemResourceChangeListener(this); + SystemPlugin.getTheSystemRegistry().addSystemRemoteChangeListener(this); + // ----------------------------- + // Enable right-click popup menu + // ----------------------------- + menuMgr = new MenuManager("#PopupMenu"); + 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. + * Opens editor if file double-clicked. + */ + protected void handleDoubleClick(DoubleClickEvent event) + { + if (!enabledMode) + { + //event.doit = false; + return; + } + IStructuredSelection s= (IStructuredSelection) event.getSelection(); + Object element= s.getFirstElement(); + if (element == null) + return; + ISystemViewElementAdapter adapter = getAdapter(element); + boolean alreadyHandled = false; + if (adapter != null) + alreadyHandled = adapter.handleDoubleClick(element); + if (!alreadyHandled && isExpandable(element)) + { + boolean expandedState = getExpandedState(element); + setExpandedState(element, !expandedState); + // DY: fire collapse / expand event + if (expandedState) { + fireTreeCollapsed(new TreeExpansionEvent(this, element)); + } else { + fireTreeExpanded(new TreeExpansionEvent(this, element)); + } + return; + } + } + /** + * Handles key events in viewer. + */ + void handleKeyPressed(KeyEvent event) + { + if ((event.character == SWT.DEL) && (event.stateMask == 0) && (((IStructuredSelection)getSelection()).size()>0) ) + { + scanSelections("handleKeyPressed"); + /* 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; idx0)) + { + for (int idx=0; idxfrom popup menu + return newConnectionAction; + } + /** + * Return the refresh action + */ + public IAction getRefreshAction() + { + if (refreshAction == null) + refreshAction = new SystemRefreshAction(getShell()); + return refreshAction; + } + /** + * Return the collapse action + */ + public IAction getCollapseAction() + { + if (collapseAction == null) + collapseAction = new SystemCollapseAction(getShell()); + return collapseAction; + } + /** + * Return the expand action + */ + 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.setToolTipText(" "); + } + propertyDialogAction.selectionChanged(getSelection()); + return propertyDialogAction; + } + /** + * Rather than pre-defining this common action we wait until it is first needed, + * for performance reasons. + */ + public SystemRemotePropertiesAction getRemotePropertyDialogAction() + { + if (remotePropertyDialogAction == null) + { + remotePropertyDialogAction = new SystemRemotePropertiesAction(getShell()); + } + remotePropertyDialogAction.setSelection(getSelection()); + return remotePropertyDialogAction; + } + /** + * 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); + 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); + return deleteAction; + } + /* + * Get the common "Open to->" action for opening a new Remote Systems 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 Systems 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 Systems 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, and then re-expand it one element deep. + * Called by com.ibm.etools.systems.SystemBaseElement. + */ + //public void refreshElementChildren(ISystemBaseElement element) + //{ + // boolean expanded = isElementExpanded(element); + // collapseElement(element, true); // collapse and delete children + // if (expanded) + // expandToLevel(element, 1); // re-expand + //} + /** + * Helper method to collapse a node in the tree. + * Called when a currently expanded subsystem is disconnected. + * @param 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()); + } + 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"); + + // ADD COMMON ACTIONS... + + // COMMON REFRESH ACTION... + if (showRefresh()) + { + menu.appendToGroup(ISystemContextMenuConstants.GROUP_BUILD, getRefreshAction()); + 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); + } + + // ADAPTER SPECIFIC ACTIONS + 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; + + while (elements.hasNext() && !skipAdapterActions) + { + Object element= elements.next(); + if (adapter == null) + { + adapter = getAdapter(element); + } + else if (adapter != getAdapter(element)) + { + // selected elements have different adapters + skipAdapterActions = true; + } + //if (adapter != null) + // adapters.put(adapter,element); // want only unique adapters + } + + //Enumeration uniqueAdapters = adapters.keys(); + if (!skipAdapterActions && adapter != null) + { + 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 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() ); + try{ + item.setInputs(getShell(), this, selection); + } catch (Exception e) + { + SystemPlugin.logError("Error configuring action " + item.getClass().getName(),e); + } + } + else if (items[idx] instanceof SystemSubMenuManager) + { + SystemSubMenuManager item = (SystemSubMenuManager)items[idx]; + item.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 (!selectionIsRemoteObject) // is not a remote object + { + PropertyDialogAction pdAction = getPropertyDialogAction(); + if (pdAction.isApplicableForSelection()) + menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); + // GO INTO ACTION... + // OPEN IN NEW WINDOW ACTION... + if (fromSystemViewPart && showOpenViewActions()) + { + GoIntoAction goIntoAction = getGoIntoAction(); + goIntoAction.setEnabled(selection.size()==1); + menu.appendToGroup(ISystemContextMenuConstants.GROUP_GOTO, goIntoAction); + + SystemOpenExplorerPerspectiveAction openToPerspectiveAction = getOpenToPerspectiveAction(); + openToPerspectiveAction.setSelection(selection); + menu.appendToGroup(openToPerspectiveAction.getContextMenuGroup(), openToPerspectiveAction); + + if (showGenericShowInTableAction()) + { + SystemShowInTableAction showInTableAction = getShowInTableAction(); + showInTableAction.setSelection(selection); + menu.appendToGroup(openToPerspectiveAction.getContextMenuGroup(), showInTableAction); + + SystemShowInMonitorAction showInMonitorAction = getShowInMonitorAction(); + showInMonitorAction.setSelection(selection); + menu.appendToGroup(openToPerspectiveAction.getContextMenuGroup(), showInMonitorAction); + + } + } + } + else // is a remote object + { + //Object firstSelection = selection.getFirstElement(); + //ISystemRemoteElementAdapter remoteAdapter = getRemoteAdapter(firstSelection); + //logMyDebugMessage(this.getClass().getName(), ": there is a remote adapter"); + SystemRemotePropertiesAction pdAction = getRemotePropertyDialogAction(); + if (pdAction.isApplicableForSelection()) + menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); + //else + //logMyDebugMessage(this.getClass().getName(), ": but it is not applicable for selection"); + // -------------------------------------------------------------------------------------------------------------------- + // look for and add any popup menu actions registered via our org.eclipse.rse.core.popupMenus extension point... + // -------------------------------------------------------------------------------------------------------------------- + if (fromSystemViewPart) // these require an IWorkbenchPart as a parameter, so we can't support them from within dialogs + addObjectActions(ourMenu); + } + // GO TO CASCADING ACTIONS... + if (fromSystemViewPart && (selectionIsRemoteObject || showOpenViewActions())) + { + SystemCascadingGoToAction gotoActions = getGoToActions(); + gotoActions.setSelection(selection); + menu.appendToGroup(gotoActions.getContextMenuGroup(), gotoActions.getSubMenu()); + } + } + } + /** + * Contributes popup menu actions and submenus registered for the object type(s) in the current selection. + * Patterned after addObjectActions in PopupMenuExtender class supplied by Eclipse. + */ + protected void addObjectActions(SystemMenuManager menu) + { + if (SystemPopupMenuActionContributorManager.getManager().contributeObjectActions(getWorkbenchPart(), menu, this, null)) + { + //menu.add(new Separator()); + } + } + /** + * 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 + + 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() + { + + Item[] elements = getSelection(getControl()); + for (int i = 0; i < elements.length; i++) + { + TreeItem parentItem = (TreeItem)elements[i]; + for (int j =0; j < elements.length; j++) + { + if (j != i) + { + if (isAncestorOf(parentItem, (TreeItem)elements[j])) + { + 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 = getAdapter(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 = getAdapter(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 + if (debugProperties) + { + ISystemRemoteElementAdapter element = getRemoteAdapter(firstSelection); + if (element == null) + return; + else + { + logMyDebugMessage(this.getClass().getName(),": -----------------------------------------------------------"); + logMyDebugMessage(this.getClass().getName(),": REMOTE SSFID.......: " + element.getSubSystemFactoryId(firstSelection)); + logMyDebugMessage(this.getClass().getName(),": REMOTE NAME........: " + element.getName(firstSelection)); + logMyDebugMessage(this.getClass().getName(),": REMOTE TYPECATEGORY: " + element.getRemoteTypeCategory(firstSelection)); + logMyDebugMessage(this.getClass().getName(),": REMOTE TYPE........: " + element.getRemoteType(firstSelection)); + logMyDebugMessage(this.getClass().getName(),": REMOTE SUBTYPE.....: " + element.getRemoteSubType(firstSelection)); + logMyDebugMessage(this.getClass().getName(),": REMOTE SUBSUBTYPE..: " + element.getRemoteSubSubType(firstSelection)); + } + } + } + protected void logMyDebugMessage(String prefix, String msg) + { + if (!debugProperties) + return; + //SystemPlugin.logDebugMessage(prefix, msg); + System.out.println(prefix+" "+msg); + } + + /** + * Convenience method for returning the shell of this viewer. + */ + public Shell getShell() + { + //return shell; + return getTree().getShell(); + } + + /** + * 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 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[] newResult = new Item[oldResult.length]; + for (int i = 0; i < oldResult.length; i++) + { + Item first = removeFirstItem(parentItem, oldResult); + newResult[i] = first; + } + + return newResult; + } + + protected Item removeFirstItem(Widget parentItem, Item[] items) + { + int firstIndex = 0; + Item firstItem = null; + int firstItemPosition = 0; + for (int i = 0; i < items.length; i++) + { + if (items[i] != null) + { + Item current = items[i]; + int position = getTreeItemPosition(parentItem, current, items); + + if (firstItem == null || position < firstItemPosition) + { + firstItem = current; + firstItemPosition = position; + firstIndex = i; + } + } + } + + items[firstIndex] = null; + return firstItem; + } + + + /** + * Move one tree item to a new location + */ + protected void moveTreeItem(Widget parentItem, Item item, Object src, int newPosition) + { + 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.

    + */ + 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 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= 0) + pos++; // want to add after previous + } + else + pos = event.getPosition(); + //logDebugMsg("ADDING CONN? "+ addingConnection + ", position="+pos); + createTreeItem(parentItem, src, pos); + setSelection(new StructuredSelection(src),true); + } + break; + case EVENT_ADD_MANY: + if (debug) + { + logDebugMsg("SV event: EVENT_ADD_MANY"); + } + multiSource = event.getMultiSource(); + clearSelection(); + parentItem = findItem(parent); + if (parentItem == null) + return; + 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 0 && parentItem != null && 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 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 EVENT_REFRESH: + if (debug) + logDebugMsg("SV event: EVENT_REFRESH "); + //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 == SystemPlugin.getTheSystemRegistry())) + refreshAll(); + else + { + //smartRefresh(src, false); + smartRefresh(src, true); + } + updatePropertySheet(); + break; + // refresh the parent of the currently selected items. + // todo: intelligently re-select previous selections + case EVENT_REFRESH_SELECTED_PARENT: + if (debug) + logDebugMsg("SV event: EVENT_REFRESH_SELECTED_PARENT "); + TreeItem[] items = getTree().getSelection(); + if ((items != null) && (items.length > 0) && (items[0] instanceof Item)) + { + //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 EVENT_REFRESH_SELECTED: + if (debug) + logDebugMsg("SV event: EVENT_REFRESH_SELECTED "); + 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; + Vector selectedRemoteObjects = new Vector(); + ss = null; + items = getTree().getSelection(); + int itemIdx = 0; + SystemElapsedTimer timer = null; + if (doTimings) + timer = new SystemElapsedTimer(); + //System.out.println("Inside EVENT_REFRESH_SELECTED. FIRST SELECTED OBJECT = " + items[0].handle); + while (i.hasNext()) + { + + Object element = i.next(); + ISystemViewElementAdapter adapter = getAdapter(element); + if ((parentElementItem==null) && (adapter != null) && (!adapter.hasChildren(element))) + { + //parentItem = getParentItem((Item)findItem(element)); + parentItem = getParentItem(items[itemIdx]); + if ((parentItem != null) && (parentItem instanceof Item)) + parentElementItem = (Item)parentItem; //.getData(); + } + if (getRemoteAdapter(element) != null) + { + selectedRemoteObjects.addElement(element); + if (ss==null) + ss=getRemoteAdapter(element).getSubSystem(element); + } + itemIdx++; + } + if (parentElementItem != null) + { + //refresh(parentElement); + 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()); + } + if (doTimings) + { + timer.setEndTime(); + System.out.println("Time to refresh selected: " + timer); + } + //else + //{ + //i = selected.iterator(); + //while (i.hasNext()) + //refresh(i.next()); + //} + + updatePropertySheet(); + break; + case EVENT_REFRESH_SELECTED_FILTER: + if (debug) + logDebugMsg("SV event: EVENT_REFRESH_SELECTED_FILTER "); + 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; + Vector selRemoteObjects = new Vector(); + ss = null; + if (j.hasNext()) + { + Object element = j.next(); + ISystemViewElementAdapter adapter = getAdapter(element); + if ((parentElemItem==null) && (adapter != null)) + { + Item parItem = getParentItem((Item)findItem(element)); + + if ((parItem != null) && (parItem instanceof Item)) + parentElemItem = (Item)parItem; //.getData(); + + while (parItem!= null && !(parItem.getData() instanceof ISystemFilterReference)) + { + parItem = getParentItem((Item)parItem); + + if ((parItem != null) && (parItem instanceof Item)) + parentElemItem = (Item)parItem; //.getData(); + } + } + if (getRemoteAdapter(element) != null) + { + selRemoteObjects.addElement(element); + if (ss==null) + ss=getRemoteAdapter(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 EVENT_REFRESH_REMOTE: + if (debug) + logDebugMsg("SV event: EVENT_REFRESH_REMOTE: src = "+src); + refreshRemoteObject(src, parent, originatedHere); + break; + case EVENT_SELECT_REMOTE: + if (debug) + logDebugMsg("SV event: EVENT_SELECT_REMOTE: src = "+src); + //remoteItemsToSkip = null; // reset + selectRemoteObjects(src, (ISubSystem)null, parent); + break; + + case EVENT_MOVE_MANY: + if (debug) + logDebugMsg("SV event: EVENT_MOVE_MANY "); + multiSource = event.getMultiSource(); + if ((multiSource == null) || (multiSource.length == 0)) + return; + parentItem = findItem(parent); + if (parentItem == null) + return; + 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 EVENT_PROPERTY_CHANGE: + if (debug) + logDebugMsg("SV event: EVENT_PROPERTY_CHANGE "); + String[] allProps = {IBasicPropertyConstants.P_TEXT,IBasicPropertyConstants.P_IMAGE}; + ISystemRemoteElementAdapter ra = getRemoteAdapter(src); + if (ra != null) + { + updateRemoteObjectProperties(src); + } + else + update(src, allProps); // for refreshing non-structural properties in viewer when model changes + updatePropertySheet(); + break; + case EVENT_PROPERTYSHEET_UPDATE: + if (debug) + logDebugMsg("SV event: EVENT_PROPERTYSHEET_UPDATE "); + updatePropertySheet(); + break; + case EVENT_MUST_COLLAPSE: + if (debug) + logDebugMsg("SV event: EVENT_MUST_COLLAPSE "); + collapseNode(src, true); // collapse and flush gui widgets from memory + break; + case EVENT_COLLAPSE_ALL: + if (debug) + logDebugMsg("SV event: EVENT_COLLAPSE_ALL "); + collapseAll(); // collapse all + if ((src!=null) && (src instanceof String) && ((String)src).equals("false")) // defect 41203 + {} + else + refresh(); // flush gui widgets from memory + break; + case EVENT_COLLAPSE_SELECTED: // defect 41203 + if (debug) + logDebugMsg("SV event: EVENT_COLLAPSE_SELECTED "); + collapseSelected(); + break; + case EVENT_EXPAND_SELECTED: // defect 41203 + if (debug) + logDebugMsg("SV event: EVENT_EXPAND_SELECTED "); + expandSelected(); + break; + + + case EVENT_REVEAL_AND_SELECT: + if (debug) + logDebugMsg("SV event: EVENT_REVEAL_AND_SELECT "); + parentItem = findItem(parent); + if (parentItem == null) + return; + 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 ISystemBaseReferencingObject) + { + TreeItem child = (TreeItem)internalFindReferencedItem((Item)parentItem, toSelect, 1); + if (child != null) + toSelect = child.getData(); + } + else if ( (parent instanceof ISystemFilterPoolReferenceManagerProvider) && + !(src instanceof ISystemBaseReferencingObject) ) + { + // 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((Item)parentItem, toSelect, 1); + if (child != null) + toSelect = child.getData(); + } + setSelection(new StructuredSelection(toSelect),true); + } + } + break; + case EVENT_SELECT: + if (debug) + logDebugMsg("SV event: EVENT_SELECT "); + item = findItem(src); + if (item == null) // if not showing item, this is a no-op + return; + setSelection(new StructuredSelection(src), true); + break; + case EVENT_SELECT_EXPAND: + if (debug) + logDebugMsg("SV event: EVENT_SELECT_EXPAND "); + item = findItem(src); + if (item == null) // if not showing item, this is a no-op + return; + if (!getExpanded((Item)item)) + setExpandedState(src, true); + setSelection(new StructuredSelection(src), true); + break; + + } + } + // ------------------------------------ + // ISYSTEMREMOTEChangeListener METHOD + // ------------------------------------ + + /** + * 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.model.ISystemRemoteChangeEvent + */ + public void systemRemoteResourceChanged(ISystemRemoteChangeEvent event) + { + int eventType = event.getEventType(); + Object remoteResourceParent = event.getResourceParent(); + Object remoteResource = event.getResource(); + boolean originatedHere = (event.getOriginatingViewer() == this); + Vector remoteResourceNames = null; + if (remoteResource instanceof Vector) + { + remoteResourceNames = (Vector)remoteResource; + remoteResource = remoteResourceNames.elementAt(0); + } + String remoteResourceParentName = getRemoteResourceAbsoluteName(remoteResourceParent); + String remoteResourceName = getRemoteResourceAbsoluteName(remoteResource); + if (remoteResourceName == null) + return; + + ISubSystem ss = getSubSystem(event, remoteResource, remoteResourceParent); + + Vector 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 + Vector 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 0) + ss = getSubSystem(event, v.elementAt(0), null); + } + else + { + ISystemRemoteElementAdapter ra = getRemoteAdapter(remoteResource); + if (ra != null) + ss = ra.getSubSystem(remoteResource); + } + } + if ((ss==null) && (remoteParent != null) && !(remoteParent instanceof String)) + { + if (remoteParent instanceof Vector) + { + Vector v = (Vector)remoteParent; + if (v.size() > 0) + ss = getSubSystem(event, null, v.elementAt(0)); + } + else + { + ISystemRemoteElementAdapter ra = getRemoteAdapter(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() != SystemPlugin.getTheSystemRegistry()) + && !(getInput() instanceof SystemEmptyListAPIProviderImpl)) + { + for (int idx=0; !affected && (idxtrue if structural changes are to be picked up, + * and false if only label provider changes are of interest + */ + protected void ourInternalRefresh(Widget widget, Object element, boolean doStruct, boolean forceRemote, boolean doTimings) + { + 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 + { + clearSelection(); // there is nothing much else we can do. Calling code will restore it anyway hopefully + doOurInternalRefresh(fWidget, fElement, fDoStruct, doTimings); + } + else // it is us that is selected. This might be a refresh selected operation. TreeItem address won't change + { + doOurInternalRefresh(fWidget, fElement, fDoStruct, doTimings); + } + } + else + { + final boolean finalDoTimings = doTimings; + preservingSelection(new Runnable() + { + public void run() + { + doOurInternalRefresh(fWidget, fElement, fDoStruct, finalDoTimings); + } + }); + } + } + protected boolean isSelectionRemote() + { + ISelection s = getSelection(); + if ((s!=null)&&(s instanceof IStructuredSelection)) + { + IStructuredSelection ss = (IStructuredSelection)s; + Object firstSel = ss.getFirstElement(); + if ((firstSel != null) && (getRemoteAdapter(firstSel) != null)) + return true; + } + return false; + } + protected void doOurInternalRefresh(Widget widget, Object element, boolean doStruct, boolean doTimings) + { + if (debug) + { + logDebugMsg("in doOurInternalRefresh on " + getAdapter(element).getName(element)); + logDebugMsg("...current selection is " + getFirstSelectionName(getSelection())); + } + SystemElapsedTimer timer = null; + if (doTimings) + timer = new SystemElapsedTimer(); + if (widget instanceof Item) + { + //System.out.println("Inside doOurInternalRefresh. widget = " + ((TreeItem)widget).handle); + if (doStruct) { + updatePlus((Item)widget, element); + } + updateItem((Item)widget, element); + if (doTimings) + { + System.out.println("doOurInternalRefresh timer 1: time to updatePlus and updateItem:" + timer.setEndTime()); + timer.setStartTime(); + } + } + + if (doStruct) { + // pass null for children, to allow updateChildren to get them only if needed + Object[] newChildren = null; + if ((widget instanceof Item) && getExpanded((Item)widget)) + { + // DKM - get raw children does a query but so does internalRefresh() + // newChildren = getRawChildren(widget); + if (doTimings) + { + System.out.println("doOurInternalRefresh timer 2: time to getRawChildren:" + timer.setEndTime()); + timer.setStartTime(); + } + } + // DKM - without the else we get duplicate queries on expanded folder + // uncommented - seems new results after query aren't showing up + //else + { + internalRefresh(element); + } + + if (doTimings) + { + System.out.println("doOurInternalRefresh timer 3: time to updateChildren:" + timer.setEndTime()); + timer.setStartTime(); + } + } + // recurse + Item[] children= getChildren(widget); + if (children != null) + { + //SystemElapsedTimer timer2 = null; + //int intervalCount = 0; + //if (doTimings) + //timer2 = new SystemElapsedTimer(); + for (int i= 0; i < children.length; i++) + { + Widget item= children[i]; + Object data= item.getData(); + if (data != null) + doOurInternalRefresh(item, data, doStruct, false); + /* + if (doTimings) + { + ++intervalCount; + if (intervalCount == 1000) + { + System.out.println("...time to recurse next 1000 children: " + timer2.setEndTime()); + intervalCount = 0; + timer2.setStartTime(); + } + }*/ + } + } + if (doTimings) + { + System.out.println("doOurInternalRefresh timer 4: time to recurse children:" + timer.setEndTime()); + timer.setStartTime(); + } + } + protected Object[] getRawChildren(Widget w) + { + Object parent = w.getData(); + if (w != null) + { + 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 = getAdapter(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 + { + ISystemRemoteElementAdapter ra = getRemoteAdapter(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!! + { + remoteItem = null; + if (remoteObject instanceof String) + remoteItem = findFirstRemoteItemReference((String)remoteObject, subsystem, (Item)null); + else + { + ISystemRemoteElementAdapter ra = getRemoteAdapter(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 vector 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) + { + ISystemRemoteElementAdapter ra = getRemoteAdapter(parentObject); + if (ra != null) + { + //parentName = ra.getAbsoluteName(parentObject); + if (subsystem == null) + subsystem = ra.getSubSystem(parentObject); + Item parentItem = (Item)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 vector 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 Vector) + { + String elementName = null; + Vector selVector = (Vector)src; + ArrayList selItems = new ArrayList(); + // our goal here is to turn the vector of names or remote objects into a collection of + // actual TreeItems we matched them on... + for (int idx=0; idx 0) + { + setSelection(selItems); + updatePropertySheet(); + return true; + } + } + else + { + if (src instanceof String) + //selItem = (Item)findFirstRemoteItemReference((String)src, (SubSystem)null, parentItem); Phil test + selItem = (Item)findFirstRemoteItemReference((String)src, subsystem, parentItem); + else + selItem = (Item)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; + Vector selectedRemoteObjects = new Vector(); + Widget parentItem = null; + ISubSystem ss = null; + while (i.hasNext()) + { + Object element = i.next(); + if (parentElement == null) + { + parentItem = getParentItem((Item)findItem(element)); + if ((parentItem != null) && (parentItem instanceof Item)) + parentElement = ((Item)parentItem).getData(); + } + if (getRemoteAdapter(element) != null) + { + selectedRemoteObjects.addElement(element); + if (ss == null) + ss = getRemoteAdapter(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 reexpands 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) + { + SystemElapsedTimer timer = null; + if (doTimings) + timer = new SystemElapsedTimer(); + 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]; + boolean anyGivenItemsRemote = false; + for (int idx=0; idx 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 + { + TreeItem item, parentItem; + Object data; + String remoteName; + ISystemRemoteElementAdapter remoteAdapter; + ISubSystem subsystem; + ExpandedItem(TreeItem parentItem, TreeItem item) + { + this.parentItem = parentItem; + this.item = item; + 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); + } + else if (debug) + System.out.println("ExpandedItem added. Data = " + data); + } + else if (debug) + System.out.println("ExpandedItem added. Data = null"); + } + 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(); + if (itemChildren != null) + { + for (int idx=0; idx + * 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) + *

    + * 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 + *

    + * 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 EVENT_RENAME_FILTER_REFERENCE: + eventType = "EVENT_RENAME_FILTER_REFERENCE"; + break; + case EVENT_CHANGE_FILTER_REFERENCE: + eventType = "EVENT_CHANGE_FILTER_REFERENCE"; + break; + } + logDebugMsg("SV event: "+eventType); + } + + // 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); + + 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); + + item = internalFindReferencedItem(widget, filter, SEARCH_INFINITE); + } + + if (item == null) + logDebugMsg("......didn't find renamed/updated filter's reference!"); + else + { + // STEP 3: UPDATE THAT FILTER... + if (type == 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 == 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); + // 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!"); + else + { + // STEP 3: UPDATE THAT FILTER STRING... + if (type == 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!! + *

    + * 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) + *

    + * 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 + *

    + * 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 EVENT_ADD_FILTER_REFERENCE: + add = true; + if (debug) + eventType = "EVENT_ADD_FILTER_REFERENCE"; + break; + case EVENT_DELETE_FILTER_REFERENCE: + delete = true; + if (debug) + eventType = "EVENT_DELETE_FILTER_REFERENCE"; + break; + case EVENT_MOVE_FILTER_REFERENCES: + move = true; + if (debug) + eventType = "EVENT_MOVE_FILTER_REFERENCES"; + break; + case EVENT_ADD_FILTERSTRING_REFERENCE: + add = true; + afilterstring = true; + if (debug) + eventType = "EVENT_ADD_FILTERSTRING_REFERENCE"; + break; + case EVENT_DELETE_FILTERSTRING_REFERENCE: + delete = true; + afilterstring = true; + if (debug) + eventType = "EVENT_DELETE_FILTERSTRING_REFERENCE"; + break; + case EVENT_MOVE_FILTERSTRING_REFERENCES: + move = true; + afilterstring = true; + if (debug) + eventType = "EVENT_MOVE_FILTERSTRING_REFERENCES"; + break; + + } + if (debug) + logDebugMsg("SV event: "+eventType); + //} + //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()); + return; + } + Item ssItem = (Item)item; + boolean wasSelected = false; + IStructuredSelection oldSelections = (IStructuredSelection)getSelection(); + + + + Object parent = event.getParent(); + if (debug) + logDebugMsg("...Found ss "+ss); + + // STEP 2: ARE WE SHOWING A REFERENCE TO THE FILTER's PARENT POOL? + Item 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 = (Item)internalFindReferencedItem(ssItem, refdParent, SEARCH_INFINITE); + } + // 3b and 3d. (filter pool or filter) + else if (parent instanceof ISystemFilterContainer) + { + refdParent = (ISystemFilterContainer)parent; + parentRefItem = (Item)internalFindReferencedItem(ssItem, refdParent, SEARCH_INFINITE); + } + // 3c (subsystem) + else + { + parentRefItem = ssItem; + } + if (parentRefItem != null) + { + if (debug) + logDebugMsg("......We are showing reference to parent"); + // 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 + { + 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 + { + 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"); + // .... 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!"); + } + else + { + if (debug) + logDebugMsg(".........Trying to set selection to " + filterItem.getData()); + 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 + */ + 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 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 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) + { + //Vector matches = new Vector(); + ISystemRemoteElementAdapter adapter = getRemoteAdapter(remoteObject); + if (adapter == null) + return null; + Item match = 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); + match = recursiveFindFirstRemoteItemReference(parentItem, remoteObjectName, remoteObject, subsystem); + if (debugRemote) + System.out.println("Returning " + match + " from findFirstRemoteItemReference(1,2)"); + } + + //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 vector to populate with hits + */ + protected Vector findAllRemoteItemReferences(Object element, Object elementObject, Vector matches) + { + String searchString = null; + ISubSystem subsystem = null; + if (element instanceof String) + searchString = (String)element; + else + { + if (elementObject == null) + elementObject = element; + ISystemRemoteElementAdapter adapter = getRemoteAdapter(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(); + for (int idx=0; idx + * 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 vector to populate with hits + */ + protected Vector findAllRemoteItemReferences(String searchString, Object elementObject, ISubSystem subsystem, Vector matches) + { + Tree tree = getTree(); + Item[] roots = tree.getItems(); + if (roots == null) + return matches; + if (matches == null) + matches = new Vector(); + for (int idx=0; idx + * 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 vector to populate with hits + * @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; + Item match = null; + if (debugRemote) + { + System.out.println("Inside internalFindFirstRemoteItemReference for searchString: "+searchString+", subsystem null? " + (subsystem==null) + ", nbr roots = " + roots.length); + } + for (int idx=0; (match==null) && (idx + * 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... + 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(); + while (elements.hasNext()) + { + Object element= elements.next(); + ISystemViewElementAdapter adapter = getAdapter(element); + if (adapter == null) + continue; + + 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 = (getRemoteAdapter(element) != null); + + if (selectionIsRemoteObject && !selectionFlagsUpdated) + { + ISubSystem srcSubSystem = adapter.getSubSystem(element); + if (srcSubSystem.isConnected() || + element instanceof ISystemFilterReference || + element instanceof ISubSystem) + { + SystemRemoteElementResourceSet set = getSetFor(srcSubSystem, adapter); + set.addResource(element); + } + } + } + selectionFlagsUpdated = true; + //System.out.println("Inside scan selections: selectionShowOpenViewActions = " + selectionShowOpenViewActions); + } + + /** + * 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"); + } + 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"); + } + return selectionEnableDeleteAction; + } + + /** + * Required method from ISystemDeleteTarget + */ + public boolean doDelete(IProgressMonitor monitor) + { + ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry(); + 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 = getAdapter(element); + if (getRemoteAdapter(element) != null) continue; + ok = adapter.doDelete(getShell(), element, monitor); + if (ok) + { + anyOk = true; + deletedVector.addElement(element); + } + } + // now we have things divided into sets + // delete 1 set at a time + for (int s = 0; s < _setList.size() && ok; s++) + { + SystemRemoteElementResourceSet set = (SystemRemoteElementResourceSet)_setList.get(s); + ISubSystem srcSubSystem = set.getSubSystem(); + ISystemViewElementAdapter srcAdapter = set.getAdapter(); + + if (srcSubSystem != null) + { + 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) + { + exc.printStackTrace(); + String msg = exc.getMessage(); + if ((msg == null) || (exc instanceof ClassCastException)) + msg = exc.getClass().getName(); + SystemMessageDialog.displayErrorMessage(getShell(), SystemPlugin.getPluginMessage( + ISystemMessages.MSG_EXCEPTION_DELETING).makeSubstitution(element,msg)); + ok = false; + } + //System.out.println("in doDelete. Any ok? " + anyOk + ", selectionIsRemoteObject? " + selectionIsRemoteObject); + if (anyOk) + { + if (selectionIsRemoteObject) + //sr.fireEvent( + // new com.ibm.etools.systems.model.impl.SystemResourceChangeEvent( + // deleted,ISystemResourceChangeEvent.EVENT_DELETE_REMOTE_MANY,null)); + sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED, deletedVector, null, null, null, this); + else + { + Object[] deleted = new Object[deletedVector.size()]; + for (int idx=0; idx 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 + * 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 && (idx0) && (currParent != prevParent)) + same = false; + else + { + prevParent = currParent; + } + } + return same; + } + + protected boolean selectionHasAncestryRelationship() + { + if (selectionFlagsUpdated) return selectionHasAncestorRelation; + Tree tree = getTree(); + TreeItem[] items = tree.getSelection(); + + for (int idx=0; idx 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. + *

    + * 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 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) && (idx0)) + { + 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 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; idx0)) + { + 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 && (idx0)) + { + 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 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 && (idx0)) + { + // for every selected tree item, see if needs expanding... + for (int idx=0; !expandable && (idx 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[] transfers = new Transfer[] + { PluginTransfer.getInstance(), + /*ResourceTransfer.getInstance(),*/ + FileTransfer.getInstance(), + EditorInputTransfer.getInstance() + }; + addDragSupport(ops | DND.DROP_DEFAULT, transfers, new SystemViewDataDragAdapter((ISelectionProvider)this)); + addDropSupport(ops | DND.DROP_DEFAULT, transfers, new SystemViewDataDropAdapter(this)); + } + + // ---------------------------------- + // Support for EXPAND TO-> ACTIONS... + // ---------------------------------- + /** + * 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(); + ISystemRemoteElementAdapter remoteAdapter = getRemoteAdapter(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.getAdapter() == adapter && set.getSubSystem() == subSystem) + { + return set; + } + } + + // no existing set - create one + SystemRemoteElementResourceSet newSet = new SystemRemoteElementResourceSet(subSystem, adapter); + _setList.add(newSet); + return newSet; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForConnections.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForConnections.java new file mode 100644 index 00000000000..0ffd2cad9c2 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForConnections.java @@ -0,0 +1,106 @@ +/******************************************************************************** + * 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.model.IHost; + +/** + * 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 getAdapter(connection).getChildren(connection); // 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. + *

    Not applicable for us. + */ + public Object[] getConnectionChildren(IHost selectedConnection) + { + //return sr.getSubSystems(selectedConnection); + return getAdapter(selectedConnection).getChildren(selectedConnection); // 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. + *

    Not applicable for us. + */ + public boolean hasConnectionChildren(IHost selectedConnection) + { + return true; + } + /** + * Return true to show right-click popup actions on objects in the tree. + * We return true. + */ + public boolean showActions() + { + return true; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForFilterPools.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForFilterPools.java new file mode 100644 index 00000000000..3e048628857 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForFilterPools.java @@ -0,0 +1,128 @@ +/******************************************************************************** + * 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.subsystems.ISubSystem; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.model.IHost; + + +/** + * 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. + *

    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. + *

    Not applicable for us. + */ + public boolean hasConnectionChildren(IHost selectedConnection) + { + return false; + } + + /** + * Return true to show right-click popup actions on objects in the tree. + * We return true. + */ + public boolean showActions() + { + return true; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForFilterStrings.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForFilterStrings.java new file mode 100644 index 00000000000..bf0f622a226 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForFilterStrings.java @@ -0,0 +1,201 @@ +/******************************************************************************** + * 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.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.filters.ISystemFilterString; +import org.eclipse.rse.filters.ISystemFilterStringReference; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemMessageObject; +import org.eclipse.rse.model.SystemMessageObject; +import org.eclipse.rse.ui.ISystemMessages; + + +/** + * 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 implements ISystemMessages +{ + + + 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(),getShell()); + if ((children == null) || (children.length==0)) + { + children = new SystemMessageObject[1]; + children[0] = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_EMPTY), + ISystemMessageObject.MSGTYPE_EMPTY, element); + } + } + catch (InterruptedException exc) + { + children = new SystemMessageObject[1]; + children[0] = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_CANCELLED), + ISystemMessageObject.MSGTYPE_CANCEL, element); + System.out.println("Canceled."); + } + catch (Exception exc) + { + children = new SystemMessageObject[1]; + children[0] = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_FAILED), + ISystemMessageObject.MSGTYPE_ERROR, element); + System.out.println("Exception resolving filter strings: " + exc.getClass().getName() + ", " + exc.getMessage()); + 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. + *

    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. + *

    Not applicable for us. + */ + public boolean hasConnectionChildren(IHost selectedConnection) + { + return false; + } + + /** + * Return true to show right-click popup actions on objects in the tree. + * We return true. + */ + public boolean showActions() + { + return true; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForFilters.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForFilters.java new file mode 100644 index 00000000000..612534fe8ae --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForFilters.java @@ -0,0 +1,258 @@ +/******************************************************************************** + * 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.Viewer; +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +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.core.subsystems.util.ISubsystemConfigurationAdapter; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemMessageObject; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.ISystemResourceChangeListener; +import org.eclipse.rse.model.SystemMessageObject; +import org.eclipse.rse.model.SystemResourceChangeEvent; +import org.eclipse.rse.ui.ISystemMessages; + + + +/** + * 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 implements ISystemMessages +{ + + + 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.getParentSubSystemFactory(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, getShell()); + if (newFilter == null) + { + children[0] = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_CANCELLED), + ISystemMessageObject.MSGTYPE_CANCEL,element); + } + else // filter successfully created! + { + // return "filter created successfully" message object for this node + children[0] = new SystemMessageObject(SystemPlugin.getPluginMessage(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 != null) && (inputProvider.getViewer()!=null)) + { + ISystemRegistry sr = SystemPlugin.getTheSystemRegistry(); + SystemResourceChangeEvent event = new SystemResourceChangeEvent(sfr, ISystemResourceChangeEvents.EVENT_SELECT_EXPAND, null); + Viewer v = inputProvider.getViewer(); + if (v instanceof ISystemResourceChangeListener) + { + //sr.fireEvent((ISystemResourceChangeListener)v, event); // only expand in the current viewer, not all viewers! + sr.postEvent((ISystemResourceChangeListener)v, event); // only expand in the current viewer, not all viewers! + } + } + } + } catch (Exception exc) { + children[0] = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_FAILED), + ISystemMessageObject.MSGTYPE_ERROR, element); + SystemBasePlugin.logError("Exception prompting for filter ",exc); + } + //SystemPlugin.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 + { + Object[] allChildren = ss.resolveFilterStrings(filterStrings,getShell()); + int nbrNestedFilters = (nestedFilterReferences==null) ? 0: nestedFilterReferences.length; + children = new Object[nbrNestedFilters + allChildren.length]; + int idx = 0; + for (idx=0; idx 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. + *

    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. + *

    Not applicable for us. + */ + public boolean hasConnectionChildren(IHost selectedConnection) + { + return false; + } + + /** + * Return true to show right-click popup actions on objects in the tree. + * We return true. + */ + public boolean showActions() + { + return true; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForSubSystems.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForSubSystems.java new file mode 100644 index 00000000000..0e26638d7c0 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForSubSystems.java @@ -0,0 +1,107 @@ +/******************************************************************************** + * 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.subsystems.ISubSystem; +import org.eclipse.rse.model.IHost; + + +/** + * 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. + *

    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. + *

    Not applicable for us. + */ + public boolean hasConnectionChildren(IHost selectedConnection) + { + return false; + } + + /** + * Return true to show right-click popup actions on objects in the tree. + * We return true. + */ + public boolean showActions() + { + return true; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAdapterFactory.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAdapterFactory.java new file mode 100644 index 00000000000..6379ac107c6 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAdapterFactory.java @@ -0,0 +1,353 @@ +/******************************************************************************** + * 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.core.runtime.IAdapterFactory; +import org.eclipse.core.runtime.IAdapterManager; +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.filters.ISystemFilterString; +import org.eclipse.rse.internal.model.SystemNewConnectionPromptObject; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemMessageObject; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.model.ISystemPromptableObject; +import org.eclipse.rse.ui.view.team.SystemTeamViewCategoryAdapter; +import org.eclipse.rse.ui.view.team.SystemTeamViewCategoryNode; +import org.eclipse.rse.ui.view.team.SystemTeamViewProfileAdapter; +import org.eclipse.rse.ui.view.team.SystemTeamViewSubSystemFactoryAdapter; +import org.eclipse.rse.ui.view.team.SystemTeamViewSubSystemFactoryNode; +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; + private SystemTeamViewSubSystemFactoryAdapter subsysFactoryAdapter; + + 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. + */ + 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, SystemTeamViewSubSystemFactoryNode.class); + + // FIXME - UDAs no longer in core + //manager.registerAdapters(this, SystemTeamViewCompileTypeNode.class); + //manager.registerAdapters(this, SystemTeamViewCompileCommandNode.class); + //manager.registerAdapters(this, SystemUDActionElement.class); + } + /** + * @see 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 = getCategoryAdapter(); + else if (adaptableObject instanceof SystemTeamViewSubSystemFactoryNode) + adapter = getSubSystemFactoryAdapter(); + + /** 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()); + } + return adapter; + } + + /** + * Because we use singletons for our adapters, it is possible to speed up + * access to them by simply returning them from here. + *

    + * This method returns the RSE adapter for root inputs to the RSE + * @return SystemViewRootInputAdapter + */ + public SystemViewRootInputAdapter getRootInputAdapter() + { + return rootAdapter; + } + + /** + * Because we use singletons for our adapters, it is possible to speed up + * access to them by simply returning them from here. + *

    + * This method returns the RSE adapter for connection objects + * @return SystemViewConnectionAdapter + */ + public SystemViewConnectionAdapter getConnectionAdapter() + { + return connectionAdapter; + } + + /** + * Because we use singletons for our adapters, it is possible to speed up + * access to them by simply returning them from here. + *

    + * This method returns the RSE adapter for profile objects + * @return SystemViewProfileAdapter + */ + public SystemTeamViewProfileAdapter getProfileAdapter() + { + return profileAdapter; + } + + /** + * Because we use singletons for our adapters, it is possible to speed up + * access to them by simply returning them from here. + *

    + * This method returns the RSE adapter for filters + * @return SystemViewFilterAdapter + */ + public SystemViewFilterAdapter getFilterAdapter() + { + return filterAdapter; + } + + /** + * Because we use singletons for our adapters, it is possible to speed up + * access to them by simply returning them from here. + *

    + * This method returns the RSE adapter for filter pools + * @return SystemViewFilterPoolAdapter + */ + public SystemViewFilterPoolAdapter getFilterPoolAdapter() + { + return filterPoolAdapter; + } + + /** + * Because we use singletons for our adapters, it is possible to speed up + * access to them by simply returning them from here. + *

    + * This method returns the RSE adapter for filter pool references, which + * are what we actually see in the RSE. + * @return SystemViewFilterPoolReferenceAdapter + */ + public SystemViewFilterPoolReferenceAdapter getFilterPoolReferenceAdapter() + { + return filterPoolReferenceAdapter; + } + + /** + * Because we use singletons for our adapters, it is possible to speed up + * access to them by simply returning them from here. + *

    + * This method returns the RSE adapter for filter references, which are + * what we actually see in the RSE + * @return SystemViewFilterReferenceAdapter + */ + public SystemViewFilterReferenceAdapter getFilterReferenceAdapter() + { + return filterReferenceAdapter; + } + + /** + * Because we use singletons for our adapters, it is possible to speed up + * access to them by simply returning them from here. + *

    + * This method returns the RSE adapter for messages shown in the RSE as child objects + * @return SystemViewMessageAdapter + */ + public SystemViewMessageAdapter getMsgAdapter() + { + return msgAdapter; + } + + /** + * Because we use singletons for our adapters, it is possible to speed up + * access to them by simply returning them from here. + *

    + * This method returns the RSE adapter for promptable objects the run an action when expanded + * @return SystemViewPromptableAdapter + */ + public SystemViewPromptableAdapter getPromptAdapter() + { + return promptAdapter; + } + + /** + * Because we use singletons for our adapters, it is possible to speed up + * access to them by simply returning them from here. + *

    + * This method returns the RSE adapter for subsystems + * @return SystemViewSubSystemAdapter + */ + public SystemViewSubSystemAdapter getSubsystemAdapter() + { + return subsystemAdapter; + } + + /** + * Return adapter for category nodes in team view + */ + public SystemTeamViewCategoryAdapter getCategoryAdapter() + { + if (categoryAdapter == null) + categoryAdapter = new SystemTeamViewCategoryAdapter(); + return categoryAdapter; + } + /** + * Return adapter for subsystem factory nodes in team view + */ + public SystemTeamViewSubSystemFactoryAdapter getSubSystemFactoryAdapter() + { + if (subsysFactoryAdapter == null) + subsysFactoryAdapter = new SystemTeamViewSubSystemFactoryAdapter(); + return subsysFactoryAdapter; + } + +// FIXME user actions and compile commands no longer coupled with core +// /** +// * Return adapter for user actions nodes in team view +// */ +// public SystemTeamViewUserActionAdapter getUserActionAdapter() +// { +// if (userActionAdapter == null) +// userActionAdapter = new SystemTeamViewUserActionAdapter(); +// return userActionAdapter; +// } +// +// /** +// * Return adapter for compile type nodes in team view +// */ +// public SystemTeamViewCompileTypeAdapter getCompileTypeAdapter() +// { +// if (compileTypeAdapter == null) +// compileTypeAdapter = new SystemTeamViewCompileTypeAdapter(); +// return compileTypeAdapter; +// } +// /** +// * Return adapter for compile command nodes in team view +// */ +// public SystemTeamViewCompileCommandAdapter getCompileCommandAdapter() +// { +// if (compileCmdAdapter == null) +// compileCmdAdapter = new SystemTeamViewCompileCommandAdapter(); +// return compileCmdAdapter; +// } + + /** + * Because we use singletons for our adapters, it is possible to speed up + * access to them by simply returning them from here. + *

    + * This method returns the RSE adapter for filter strings + * @return SystemViewFilterStringAdapter + */ + public SystemViewFilterStringAdapter getFilterStringAdapter() + { + return filterStringAdapter; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewCompositeActionGroup.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewCompositeActionGroup.java new file mode 100644 index 00000000000..2ae276ac08a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewCompositeActionGroup.java @@ -0,0 +1,104 @@ +/******************************************************************************** + * 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.action.IMenuManager; +import org.eclipse.jface.util.Assert; +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(); + } + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewConnectionAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewConnectionAdapter.java new file mode 100644 index 00000000000..22a1edbdc1a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewConnectionAdapter.java @@ -0,0 +1,646 @@ +/******************************************************************************** + * 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 java.util.Vector; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.ISystemTypes; +import org.eclipse.rse.core.ISystemUserIdConstants; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.SystemPreferencesManager; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemMenuManager; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.actions.SystemClearAllPasswordsAction; +import org.eclipse.rse.ui.actions.SystemConnectAllSubSystemsAction; +import org.eclipse.rse.ui.actions.SystemCopyConnectionAction; +import org.eclipse.rse.ui.actions.SystemDisconnectAllSubSystemsAction; +import org.eclipse.rse.ui.actions.SystemMoveConnectionAction; +import org.eclipse.rse.ui.actions.SystemMoveDownConnectionAction; +import org.eclipse.rse.ui.actions.SystemMoveUpConnectionAction; +import org.eclipse.rse.ui.actions.SystemNewConnectionFromExistingConnectionAction; +import org.eclipse.rse.ui.actions.SystemWorkOfflineAction; +import org.eclipse.rse.ui.validators.ISystemValidator; +import org.eclipse.rse.ui.validators.ValidatorSpecialChar; +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 + implements ISystemViewElementAdapter, ISystemUserIdConstants +{ + private SystemNewConnectionFromExistingConnectionAction 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; + + // 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 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(); + //updateAction.setValue(null); // reset + menu.add(menuGroup, anotherConnectionAction); + menu.add(menuGroup, copyAction); + menu.add(menuGroup, moveAction); + menu.add(menuGroup, upAction); + menu.add(menuGroup, downAction); + + // MJB: RE defect 40854 + addConnectOrDisconnectAction(menu, menuGroup, selection); + + menu.add(menuGroup, clearPasswordAction); + + // yantzi: artemis 6.0, offline support, only add work offline action for system types that support offline mode + if (SystemPlugin.getDefault().getSystemTypeEnableOffline(((IHost)selection.getFirstElement()).getSystemType())) + { + menu.add(menuGroup, offlineAction); + } + } + + private void addConnectOrDisconnectAction(SystemMenuManager menu, String menuGroup, IStructuredSelection selection) + { + IHost sysCon = (IHost) selection.getFirstElement(); + ISystemRegistry sysReg = SystemPlugin.getTheSystemRegistry(); + boolean anyConnected = sysReg.isAnySubSystemConnected(sysCon); + boolean allConnected = sysReg.areAllSubSystemsConnected(sysCon); + if (!allConnected) menu.add(menuGroup, connectAction); + if (anyConnected) menu.add(menuGroup, disconnectAction); + } + + private void createActions() + { + anotherConnectionAction = new SystemNewConnectionFromExistingConnectionAction(null); + //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); + + 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 conn = (IHost)element; + String systype = conn.getSystemType(); + /* history is over! phil + if (systype.equals("OS/400")) // historical + { + systype = ISystemTypes.SYSTEMTYPE_ISERIES; + conn.setSystemType(systype); + try { + conn.getConnectionPool().save(conn); + } catch (Exception exc) {} + } + */ + boolean anyConnected = SystemPlugin.getTheSystemRegistry().isAnySubSystemConnected(conn); + ImageDescriptor imageD = SystemPlugin.getDefault().getSystemTypeImage(systype, anyConnected); + return imageD; + } + + /** + * Return the label for this object + */ + public String getText(Object element) + { + IHost conn = (IHost)element; + boolean qualifyNames = SystemPlugin.getTheSystemRegistry().getQualifiedHostNames(); + if (!qualifyNames) + return conn.getAliasName(); + else + return conn.getSystemProfileName() + "." + conn.getAliasName(); + } + + /** + * Return the name of this object, which may be different than the display text ({#link #getText(Object)}. + *

    + * Called by common rename and delete actions. + */ + public String getName(Object element) + { + IHost conn = (IHost)element; + return conn.getAliasName(); + } + + /** + * Return the absolute name, versus just display name, of this object + */ + public String getAbsoluteName(Object element) + { + IHost conn = (IHost)element; + return conn.getSystemProfileName() + "." + conn.getAliasName(); + } + + /** + * 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() + " - " + + translatedHostname + ": " + conn.getHostName(); + String text = conn.getDescription(); + if ((text==null) || (text.length()==0)) + return statusText; + else + return statusText + " - " + translatedDescription + ": " + text; + } + + /** + * Return the parent of this object + */ + public Object getParent(Object element) + { + return SystemPlugin.getTheSystemRegistry(); + } + + /** + * Return the children of this object + */ + public Object[] getChildren(Object element) + { + 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 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(P_SYSTEMTYPE)) + return conn.getSystemType(); + else if (name.equals(P_HOSTNAME)) + return conn.getHostName(); + else if (name.equals(P_DEFAULTUSERID)) + { + setDefaultUserIdPropertyData(userIdData, conn); + //System.out.println("Testing getPropertyValue: " + userIdData); + return userIdData; + } + else if (name.equals(P_DESCRIPTION)) + return conn.getDescription(); + else if (name.equals(P_PROFILE)) + return conn.getSystemProfile().getName(); + else if (name.equals(P_IS_CONNECTED)) + { + if (conn.isOffline()) + { + return SystemResources.RESID_OFFLINE_LABEL; + } + else + { + boolean anyConnected = SystemPlugin.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 = SystemPreferencesManager.getPreferencesManager().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 true if the value of the specified property has changed + * from its original default value; false otherwise. + */ + public boolean isPropertySet(Object propertyObject) + { + String property = (String)propertyObject; + boolean changed = false; + if (property.equals(P_DEFAULTUSERID)) + changed = changed_userId; + else if (property.equals(P_HOSTNAME)) + changed = changed_hostName; + else if (property.equals(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 = SystemPlugin.getDefault().getSystemRegistry(); + + if (property.equals(P_DEFAULTUSERID)) + { + //sr.updateConnection(null, conn, conn.getSystemType(), conn.getAliasName(), + // conn.getHostName(), conn.getDescription(), original_userId, USERID_LOCATION_CONNECTION); + updateDefaultUserId(conn, original_userIdData); + } + else if (property.equals(P_HOSTNAME)) + { + sr.updateHost(null, conn, conn.getSystemType(), conn.getAliasName(), + original_hostName, conn.getDescription(), conn.getDefaultUserId(), USERID_LOCATION_NOTSET); + } + else if (property.equals(P_DESCRIPTION)) + { + sr.updateHost(null, conn, conn.getSystemType(), conn.getAliasName(), + conn.getHostName(), original_description, conn.getDefaultUserId(), USERID_LOCATION_NOTSET); + } + } + /** + * Change the default user Id value + */ + private void updateDefaultUserId(IHost conn, SystemInheritablePropertyData data) + { + int whereToUpdate = USERID_LOCATION_CONNECTION; + //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 = SystemPlugin.getDefault().getSystemRegistry(); + sr.updateHost(null, 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 = SystemPlugin.getDefault().getSystemRegistry(); + + if (name.equals(P_DEFAULTUSERID)) + { + //System.out.println("Testing setPropertyValue: " + value); + //sr.updateConnection(null, conn, conn.getSystemType(), conn.getAliasName(), + // conn.getHostName(), conn.getDescription(), (String)value, USERID_LOCATION_CONNECTION); + updateDefaultUserId(conn, (SystemInheritablePropertyData)value); + changed_userId = true; + } + else if (name.equals(P_HOSTNAME)) + { + // DKM - don't update unless it really changed + // defect 57739 + if (!((String)value).equalsIgnoreCase(conn.getHostName())) + { + sr.updateHost(null, conn, conn.getSystemType(), conn.getAliasName(), + (String)value, conn.getDescription(), conn.getDefaultUserId(), USERID_LOCATION_NOTSET); + changed_hostName = true; + } + } + else if (name.equals(P_DESCRIPTION)) + { + // DKM - don't update unless it really changed + // defect 57739 + if (!((String)value).equalsIgnoreCase(conn.getDescription())) + { + sr.updateHost(null, conn, conn.getSystemType(), conn.getAliasName(), + conn.getHostName(), (String)value, conn.getDefaultUserId(), 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 sysCon = (IHost) element; + if (sysCon.getSystemType().equals(ISystemTypes.SYSTEMTYPE_LOCAL)) return existsMoreThanOneLocalConnection(); + ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry(); + return !sr.isAnySubSystemConnected((IHost)element); + } + return true; + } + + protected boolean existsMoreThanOneLocalConnection() + { + IHost[] localCons = SystemPlugin.getDefault().getSystemRegistry().getHostsBySystemType(ISystemTypes.SYSTEMTYPE_LOCAL); + return localCons.length > 1; + } + + /** + * Perform the delete action. + */ + public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) + { + boolean ok = true; + IHost conn = (IHost)element; + ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry(); + 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) throws Exception + { + boolean ok = true; + IHost conn = (IHost)element; + ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry(); + 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. + *

    + * 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. + *

    + * Returns profile.connectionName, upperCased + */ + public String getCanonicalNewName(Object element, String newName) + { + IHost conn = (IHost)element; + return (conn.getSystemProfileName() + "." + newName).toUpperCase(); + } + + + // 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(); + } + /** + * 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; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewConnectionSelectionInputProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewConnectionSelectionInputProvider.java new file mode 100644 index 00000000000..ac55c942ebb --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewConnectionSelectionInputProvider.java @@ -0,0 +1,151 @@ +/******************************************************************************** + * 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.SystemPlugin; +import org.eclipse.rse.internal.model.SystemNewConnectionPromptObject; +import org.eclipse.rse.model.IHost; + + +/** + * This input provider for the System View is used when we want to merely present a + * list of existing connections for the user to select from, and optionally include + * the New Connection prompting connection.
    + * Used in the {@link org.eclipse.rse.ui.widgets.SystemSelectConnectionForm} class. + */ +public class SystemViewConnectionSelectionInputProvider extends SystemAbstractAPIProvider +{ + private boolean showNew = true; + private SystemNewConnectionPromptObject newConnPrompt; + private Object[] newConnPromptArray; + private String[] systemTypes; + + /** + * Constructor + */ + public SystemViewConnectionSelectionInputProvider() + { + super(); + } + + /** + * Specify if the New Connection prompt is to be shown. + * Default is true. + */ + public void setShowNewConnectionPrompt(boolean show) + { + this.showNew = show; + } + /** + * Query whether the New Connection prompt is to be shown or not. + */ + public boolean getShowNewConnectionPrompt() + { + return showNew; + } + /** + * Set the system types to restrict by + */ + public void setSystemTypes(String[] systemTypes) + { + this.systemTypes = systemTypes; + } + /** + * Return the system types we are restricted by + */ + public String[] getSystemTypes() + { + return systemTypes; + } + + // REQUIRED METHODS... + + /** + * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#getSystemViewRoots() + */ + public Object[] getSystemViewRoots() + { + //System.out.println("Inside getSystemViewRoots. showNew = "+showNew); + IHost[] conns = null; + if (systemTypes == null) + conns = SystemPlugin.getTheSystemRegistry().getHosts(); + else + conns = SystemPlugin.getTheSystemRegistry().getHostsBySystemTypes(systemTypes); + if (showNew) + { + if ((conns == null) || (conns.length == 0)) + { + return getNewConnectionPromptObjectAsArray(); + } + else + { + Object[] allChildren = new Object[conns.length+1]; + allChildren[0] = getNewConnectionPromptObject(); + for (int idx=0; idx 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(); + /** FIXME - IREmoteFile is systems.core independent now + if (dragObject instanceof IRemoteFile) + { + IRemoteFile file = (IRemoteFile) dragObject; + + String connectionType = file.getParentRemoteFileSubSystem().getHost().getSystemType(); + if (connectionType.equals("Local")) + { + fileNames[i] = file.getAbsolutePath(); + 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 = SystemPlugin.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 = 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.detail = DND.DROP_NONE; + } + } + } + } + + protected IEditorRegistry getEditorRegistry() + { + return SystemPlugin.getDefault().getWorkbench().getEditorRegistry(); + } + + protected IEditorDescriptor getDefaultTextEditor() + { + IEditorRegistry registry = getEditorRegistry(); + return registry.findEditor("org.eclipse.ui.DefaultTextEditor"); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewDataDropAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewDataDropAdapter.java new file mode 100644 index 00000000000..386d83dd6c6 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewDataDropAdapter.java @@ -0,0 +1,346 @@ +/******************************************************************************** + * 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 java.util.ArrayList; +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.StructuredViewer; +import org.eclipse.jface.viewers.ViewerDropAdapter; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.internal.model.SystemScratchpad; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.model.ISystemRegistry; +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.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.part.PluginTransferData; + + +/** + * Drop adapter for dropping objects in the Systems views. + * + */ +public class SystemViewDataDropAdapter extends ViewerDropAdapter implements ISystemMessages +{ + + + 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 = "|"; + + 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; + } + + 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); + + + 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; + 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 String[]) + { + String[] resources = (String[]) data; + for (int i = 0; i < resources.length; i++) + { + String resource = (String)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(null); + } + 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 = SystemPlugin.getTheSystemRegistry(); + // first extract subsystem id + int connectionDelim = str.indexOf(":"); + if (connectionDelim == -1) // not subsystem, therefore likely to be a connection + { + int profileDelim = str.indexOf("."); + 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); + 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 = SystemPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_FILE_NOTFOUND); + msg.makeSubstitution(srcKey, subSystem.getHostAliasName()); + return msg; + } + } + else + { + SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_CONNECTION_NOTFOUND); + msg.makeSubstitution(subSystemId); + return msg; + } + } + } + + protected IRunnableContext getRunnableContext(Shell shell) + { + IRunnableContext irc = SystemPlugin.getTheSystemRegistry().getRunnableContext(); + if (irc != null) + { + return irc; + } + else + { + /* + // for other cases, use statusbar + IWorkbenchWindow win = SystemPlugin.getActiveWorkbenchWindow(); + if (win != null) + { + Shell winShell = SystemPlugin.getActiveWorkbenchShell(); + if (winShell != null && !winShell.isDisposed() && winShell.isVisible()) + { + SystemPlugin.logInfo("Using active workbench window as runnable context"); + shell = winShell; + return win; + } + else + { + win = null; + } + } + */ + + irc = new ProgressMonitorDialog(shell); + SystemPlugin.getTheSystemRegistry().setRunnableContext(shell, irc); + return irc; + } + } + + public void dragOver(DropTargetEvent event) + { + super.dragOver(event); + event.feedback &= ~DND.FEEDBACK_EXPAND; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewDummyObject.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewDummyObject.java new file mode 100644 index 00000000000..897d0f59cd4 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewDummyObject.java @@ -0,0 +1,47 @@ +/******************************************************************************** + * 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.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 singleton; + + /** + * Constructor for SystemViewDummyObject. + */ + public SystemViewDummyObject() + { + super(); + } + + /** + * Return the singleton of this + */ + public static SystemViewDummyObject getSingleton() + { + if (singleton == null) + singleton = new SystemViewDummyObject(); + return singleton; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterAdapter.java new file mode 100644 index 00000000000..0a3a9c8a3b0 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterAdapter.java @@ -0,0 +1,560 @@ +/******************************************************************************** + * 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 java.util.Vector; + +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.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +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.core.subsystems.util.ISubsystemConfigurationAdapter; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterString; +import org.eclipse.rse.filters.SystemFilterSimple; +import org.eclipse.rse.model.ISystemMessageObject; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.ISystemResourceChangeListener; +import org.eclipse.rse.model.SystemChildrenContentsType; +import org.eclipse.rse.model.SystemMessageObject; +import org.eclipse.rse.model.SystemResourceChangeEvent; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemMenuManager; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.validators.ISystemValidator; +import org.eclipse.rse.ui.validators.ValidatorFilterName; +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 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 implements ISystemViewElementAdapter, ISystemMessages +{ + //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.getParentSubSystemFactory(filter); + ssFactory.setConnection(null); + ISubsystemConfigurationAdapter adapter = (ISubsystemConfigurationAdapter)ssFactory.getAdapter(ISubsystemConfigurationAdapter.class); + IAction[] actions = adapter.getFilterActions(ssFactory, filter, shell); + if (actions != null) + { + for (int idx=0; idx + * Called by common rename and delete actions. + */ + public String getName(Object element) + { + return getFilter(element).getName(); + } + /** + * Return the absolute name, versus just display name, of this object + */ + public String getAbsoluteName(Object element) + { + ISystemFilter filter = getFilter(element); + return filter.getSystemFilterPoolManager().getName() + "." + filter.getParentFilterPool().getName() + "." + filter.getName(); + } + /** + * 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.getParentSubSystemFactory(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 ((SystemFilterSimple)filter).getParent(); + return filter.getParentFilterContainer(); + } + + /** + * Return the children of this filter. + * This is a combination of nested filters and resolved filter objects. + */ + public Object[] getChildren(Object element) + { + ISystemFilter filter = getFilter(element); + // transient filters... + if (filter.isTransient()) + { + if (filter.isPromptable()) + return checkForNull(processPromptingFilter(filter), true); + + Object[] children = null; + SystemFilterSimple simpleFilter = (SystemFilterSimple)filter; + String[] filterStrings = simpleFilter.getFilterStrings(); + // 50167pc: The following was a problem, as the parent in a SimpleFilterSimpleImpl is not + // to be trusted, since we tend to use the same instance for each connection in the list. + ISubSystem ss = (ISubSystem)simpleFilter.getParent(); + String preSelectName = null; + try + { + Shell shell = getShell(); + // 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; + } + preSelectName = ip.getPreSelectFilterChild(); + } + + // get children from cache if the children have been cached + if (ss.getSubSystemConfiguration().supportsFilterCaching() && !simpleFilter.isStale() && + simpleFilter.hasContents(SystemChildrenContentsType.getInstance())) { + children = simpleFilter.getContents(SystemChildrenContentsType.getInstance()); + } + // otherwise, get children and then cache + else { + children = checkForNull(ss.resolveFilterStrings(filterStrings,shell), true); + + if (ss.getSubSystemConfiguration().supportsFilterCaching()) { + simpleFilter.setContents(SystemChildrenContentsType.getInstance(), children); + } + } + + if ((children !=null) && (preSelectName != null)) + { + Object match = null; + for (int idx=0; (match==null) && (idx 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(P_PARENT_FILTERPOOL,SystemViewResources.RESID_PROPERTY_FILTERPARENTPOOL_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPARENTPOOL_TOOLTIP); + // parent filter + propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(P_PARENT_FILTER,SystemViewResources.RESID_PROPERTY_FILTERPARENTFILTER_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPARENTFILTER_TOOLTIP); + // number filter strings + propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(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 property 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"; + } + 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) 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 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; + Vector 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(); + } + /* + if (filter != null) + filterNames.removeElement(filter.getName()); // remove current filter's name + */ + ISystemValidator nameValidator = new ValidatorFilterName(filterNames); + return nameValidator; + } + + /** + * Parent override. + *

    + * 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. + *

    + * 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(); + } + 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(); + } + + /** + * Overide of parent method.
    + * From IActionFilter so the popupMenus extension point can use <filter>, <enablement> + * or <visibility>. We add support is for the following: + *

      + *
    1. name="filterType". The value is tested against the non-translated filter type. Note all subsystems + * support different types of filters. + *
    2. name="showChangeFilterStringsPropertyPage". The value is tested against the call to the subsystem factory method showChangeFilterStringsPropertyPage(SystemFilter). + * Compares against "true" (default) or "false". + *
    + */ + public boolean testAttribute(Object target, String name, String value) + { + if (name.equalsIgnoreCase("filterType")) + { + ISystemFilter filter = getFilter(target); + String type = filter.getType(); + if ((type == null) || (type.length() == 0)) + return false; + else + return value.equals(type); + } + else if (name.equalsIgnoreCase("showChangeFilterStringPropertyPage")) + { + ISystemFilter filter = getFilter(target); + ISubSystemConfiguration ssf = SubSystemHelpers.getParentSubSystemFactory(filter); + if (value.equals("true")) + return ssf.showChangeFilterStringsPropertyPage(filter); + else + return !ssf.showChangeFilterStringsPropertyPage(filter); + } + else + return super.testAttribute(target, name, value); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterPoolAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterPoolAdapter.java new file mode 100644 index 00000000000..7b417b972d2 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterPoolAdapter.java @@ -0,0 +1,286 @@ +/******************************************************************************** + * 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 java.util.Vector; + +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.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.core.subsystems.SubSystemHelpers; +import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemMenuManager; +import org.eclipse.rse.ui.validators.ISystemValidator; +import org.eclipse.rse.ui.validators.ValidatorFilterPoolName; +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 SubSystemFactory objects + */ +public class SystemViewFilterPoolAdapter extends AbstractSystemViewAdapter implements ISystemViewElementAdapter +{ + 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.getParentSubSystemFactory(pool); + ISubsystemConfigurationAdapter adapter = (ISubsystemConfigurationAdapter)ssFactory.getAdapter(ISubsystemConfigurationAdapter.class); + IAction[] actions = adapter.getFilterPoolActions(ssFactory, pool, shell); + if (actions != null) + { + for (int idx=0; idx + * Called by common rename and delete actions. + */ + public String getName(Object element) + { + return ((ISystemFilterPool)element).getName(); + } + /** + * Return the absolute name, versus just display name, of this object + */ + public String getAbsoluteName(Object element) + { + ISystemFilterPool filterPool = (ISystemFilterPool)element; + return filterPool.getSystemFilterPoolManager().getName() + "." + filterPool.getName(); + } + /** + * 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.getParentSubSystemFactory(fp); + return ssParentFactory.getSubSystems(false)[0]; + } + + /** + * Return the children of this object. + * For filter pools, this is a list of filters. + */ + public Object[] getChildren(Object element) + { + ISystemFilterPool fp = (ISystemFilterPool)element; + return fp.getSystemFilters(); + } + + /** + * Return true if this object has children. That is, has filters. + */ + public boolean hasChildren(Object 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(P_PARENT_FILTERPOOL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPOOL_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPOOL_TOOLTIP); + + // parent filter pool's profile + propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(P_PROFILE, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPROFILE_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPROFILE_TOOLTIP); + + // Related connection + propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(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) 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(); + Vector v = mgr.getSystemFilterPoolNamesVector(); + /* + if (fp != null) // might be called by the New wizard vs rename action + v.removeElement(fp.getName()); + */ + ISystemValidator nameValidator = new ValidatorFilterPoolName(v); + //System.out.println("Inside getNameValidator for SystemViewFilterPoolAdapter"); + return nameValidator; + } + + /** + * Parent override. + *

    + * 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. + *

    + * Returns mgrName.poolName, upperCased + */ + public String getCanonicalNewName(Object element, String newName) + { + String mgrName = ((ISystemFilterPool)element).getSystemFilterPoolManager().getName(); + return (mgrName + "." + newName).toUpperCase(); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterPoolReferenceAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterPoolReferenceAdapter.java new file mode 100644 index 00000000000..a58a8239ceb --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterPoolReferenceAdapter.java @@ -0,0 +1,366 @@ +/******************************************************************************** + * 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 java.util.Vector; + +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.SystemPlugin; +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.core.subsystems.util.ISubsystemConfigurationAdapter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemMenuManager; +import org.eclipse.rse.ui.validators.ISystemValidator; +import org.eclipse.rse.ui.validators.ValidatorFilterPoolName; +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 implements ISystemViewElementAdapter +{ + 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 = getSubSystemFactory(pool); + ISubsystemConfigurationAdapter adapter = (ISubsystemConfigurationAdapter)ssFactory.getAdapter(ISubsystemConfigurationAdapter.class); + + IAction[] actions = adapter.getFilterPoolActions(ssFactory, pool, shell); + if (actions != null) + { + for (int idx=0; idxOverridden from parent.
    + * Returns the subsystem that contains this object. + */ + public ISubSystem getSubSystem(Object element) + { + return ((ISubSystem)getFilterPoolReference(element).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.getProvider() != null) + { + ISubsystemConfigurationAdapter adapter = (ISubsystemConfigurationAdapter)pool.getProvider().getAdapter(ISubsystemConfigurationAdapter.class); + poolImage = adapter.getSystemFilterPoolImage(pool); + } + if (poolImage == null) + poolImage = SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTERPOOL_ID); + return poolImage; + } + + private ISystemFilterPoolReference getFilterPoolReference(Object element) + { + return (ISystemFilterPoolReference)element; // get referenced object + } + + private ISystemFilterPool getFilterPool(Object element) + { + return getFilterPoolReference(element).getReferencedFilterPool(); // get master object + } + + + /** + * Return the label for this object. Uses getName() on the filter pool object. + */ + public String getText(Object element) + { + boolean qualifyNames = SystemPlugin.getTheSystemRegistry().getQualifiedHostNames(); + if (!qualifyNames) + return getFilterPool(element).getName(); + else + return SubSystemHelpers.getParentSystemProfile(getFilterPool(element))+"." + getFilterPool(element).getName(); + } + /** + * Return the name of this object, which may be different than the display text ({#link #getText(Object)}. + *

    + * Called by common rename and delete actions. + */ + public String getName(Object element) + { + return getFilterPool(element).getName(); + } + /** + * Return the absolute name, versus just display name, of this object + */ + public String getAbsoluteName(Object element) + { + ISystemFilterPoolReference filterPoolRef = (ISystemFilterPoolReference)element; + return filterPoolRef.getReferencedFilterPool().getSystemFilterPoolManager().getName() + "." + filterPoolRef.getName(); + } + /** + * 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 = getFilterPoolReference(element); + return SubSystemHelpers.getParentSubSystem(fpr); + } + + /** + * Return the children of this object. + * For filter pools, this is a list of filters. + */ + public Object[] getChildren(Object element) + { + ISystemFilterPoolReference fpRef = getFilterPoolReference(element); + ISubSystem ss = getSubSystem(element); + return fpRef.getSystemFilterReferences(ss); + } + + /** + * Return true if this object has children + */ + public boolean hasChildren(Object element) + { + ISystemFilterPoolReference fpRef = getFilterPoolReference(element); + return (fpRef.getReferencedFilterPool().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(P_PARENT_FILTERPOOL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPOOL_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPOOL_TOOLTIP); + + // parent filter pool's profile + propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(P_PROFILE, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPROFILE_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPROFILE_TOOLTIP); + + // Related connection + propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(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 + { + ISystemFilterPoolReference fpr = getFilterPoolReference(element); + ISystemFilterPool fp = getFilterPool(element); + ISystemFilterPoolManager fpMgr = fp.getSystemFilterPoolManager(); + fpMgr.deleteSystemFilterPool(fp); + //SubSystemFactory ssParentFactory = getSubSystemFactory(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) throws Exception + { + ISystemFilterPool fp = getFilterPool(element); + ISystemFilterPoolManager fpMgr = fp.getSystemFilterPoolManager(); + fpMgr.renameSystemFilterPool(fp,name); + //SubSystemFactory ssParentFactory = getSubSystemFactory(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 + fp = (ISystemFilterPool)element; + ISystemFilterPoolManager mgr = fp.getSystemFilterPoolManager(); + Vector v = mgr.getSystemFilterPoolNamesVector(); + /* + if (fp != null) // might be called by the New wizard vs rename action + v.removeElement(fp.getName()); + */ + ISystemValidator nameValidator = new ValidatorFilterPoolName(v); + return nameValidator; + } + /** + * Parent override. + *

    + * 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. + *

    + * Returns mgrName.poolName, upperCased + */ + public String getCanonicalNewName(Object element, String newName) + { + String mgrName = ((ISystemFilterPoolReference)element).getReferencedFilterPoolManagerName(); + return (mgrName + "." + 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. + * 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 Systems Explorer perspective. + */ + public String getInputMementoHandle(Object element) + { + Object parent = getParent(element); + return getAdapter(parent).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; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterReferenceAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterReferenceAdapter.java new file mode 100644 index 00000000000..529ba8e286b --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterReferenceAdapter.java @@ -0,0 +1,960 @@ +/******************************************************************************** + * 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 java.util.Vector; + +import org.eclipse.core.resources.IResource; +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.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.SystemPreferencesManager; +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.core.subsystems.util.ISubsystemConfigurationAdapter; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterContainerReference; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemMessageObject; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.ISystemResourceChangeListener; +import org.eclipse.rse.model.ISystemResourceSet; +import org.eclipse.rse.model.SystemChildrenContentsType; +import org.eclipse.rse.model.SystemMessageObject; +import org.eclipse.rse.model.SystemRemoteResourceSet; +import org.eclipse.rse.model.SystemResourceChangeEvent; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemMenuManager; +import org.eclipse.rse.ui.validators.ISystemValidator; +import org.eclipse.rse.ui.validators.ValidatorFilterName; +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 + implements ISystemViewElementAdapter, ISystemMessages +{ + //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 = getSubSystemFactory(filter); + ISubSystem currentSubSystem = (ISubSystem) getFilterReference(selection.getFirstElement()).getSubSystem(); + IHost currentConnection = currentSubSystem.getHost(); + ssFactory.setConnection(currentConnection); + ssFactory.setCurrentSelection(selection.toArray()); + ISubsystemConfigurationAdapter adapter = (ISubsystemConfigurationAdapter)ssFactory.getAdapter(ISubsystemConfigurationAdapter.class); + + IAction[] actions = adapter.getFilterActions(ssFactory, filter, shell); + if (actions != null) + { + for (int idx = 0; idx < actions.length; idx++) + { + IAction action = actions[idx]; + menu.add(menuGroup, action); + } + } + actions = adapter.getFilterReferenceActions(ssFactory, getFilterReference(selection.getFirstElement()), shell); + if (actions != null) + { + for (int idx = 0; idx < actions.length; idx++) + { + IAction action = actions[idx]; + menu.add(menuGroup, action); + } + } + } + + private ISubSystemConfiguration getSubSystemFactory(ISystemFilter filter) + { + return SubSystemHelpers.getParentSubSystemFactory(filter); + } + /** + * Overridden from parent.
    + * 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 SystemPlugin.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); + filterImage = adapter.getSystemFilterImage(filter); + } + if (filterImage == null) + filterImage = SystemPlugin.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)}. + *

    + * Called by common rename and delete actions. + */ + public String getName(Object element) + { + return getFilter(element).getName(); + } + /** + * Return the absolute name, versus just display name, of this object + */ + public String getAbsoluteName(Object element) + { + ISystemFilter filter = getFilter(element); + return filter.getSystemFilterPoolManager().getName() + "." + filter.getParentFilterPool().getName() + "." + filter.getName(); + } + + /** + * Return the type label for this object + */ + public String getType(Object element) + { + ISystemFilter filter = getFilter(element); + ISubSystemConfiguration ssParentFactory = getSubSystemFactory(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.getPreferencesManager().getShowFilterPools(); + if (showFPs) + return parentContainer; + else + return (ISubSystem) fr.getProvider(); + //return fr.getParent(); + } + + /** + * Return the children of this object. + * For filters, this is one or more of: + *

      + *
    • filters if nested filters supported + *
    • filter strings if user has elected to show filter strings in his preferences + *
    • resolved objects for each filter string if user has elected NOT to show filter strings in his preferences + *
    + */ + public Object[] getChildren(IProgressMonitor monitor, Object element) + { + return internalGetChildren(monitor, element); + } + + /** + * Return the children of this object. + * For filters, this is one or more of: + *
      + *
    • filters if nested filters supported + *
    • filter strings if user has elected to show filter strings in his preferences + *
    • resolved objects for each filter string if user has elected NOT to show filter strings in his preferences + *
    + */ + public Object[] getChildren(Object element) + { + return internalGetChildren(null, element); + } + + /* + * 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(IProgressMonitor monitor, Object element) + { + Object[] children = null; + ISystemFilterReference fRef = getFilterReference(element); + ISystemFilter referencedFilter = fRef.getReferencedFilter(); + boolean promptable = referencedFilter.isPromptable(); + + ISubSystem ss = fRef.getSubSystem(); + ISubSystemConfiguration ssf = SubSystemHelpers.getParentSubSystemFactory(referencedFilter); + + // PROMPTING FILTER?... + if (promptable) + { + children = new SystemMessageObject[1]; + try + { + ISubsystemConfigurationAdapter adapter = (ISubsystemConfigurationAdapter)ssf.getAdapter(ISubsystemConfigurationAdapter.class); + + ISystemFilter newFilter = adapter.createFilterByPrompting(ssf, fRef, getShell()); + if (newFilter == null) + { + children[0] = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_CANCELLED), ISystemMessageObject.MSGTYPE_CANCEL, element); + } + else // filter successfully created! + { + // return "filter created successfully" message object for this node + children[0] = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_FILTERCREATED), ISystemMessageObject.MSGTYPE_OBJECTCREATED, element); + // select the new filter reference... + ISystemFilterReference sfr = fRef.getParentSystemFilterReferencePool().getExistingSystemFilterReference(ss, newFilter); + ISystemViewInputProvider inputProvider = getInput(); + if ((sfr != null) && (inputProvider != null) && (inputProvider.getViewer() != null)) + { + ISystemRegistry sr = SystemPlugin.getTheSystemRegistry(); + SystemResourceChangeEvent event = new SystemResourceChangeEvent(sfr, ISystemResourceChangeEvents.EVENT_SELECT_EXPAND, null); + Viewer v = inputProvider.getViewer(); + if (v instanceof ISystemResourceChangeListener) + { + //sr.fireEvent((ISystemResourceChangeListener)v, event); // only expand in the current viewer, not all viewers! + sr.postEvent((ISystemResourceChangeListener) v, event); // only expand in the current viewer, not all viewers! + } + } + } + } + catch (Exception exc) + { + children[0] = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_FAILED), ISystemMessageObject.MSGTYPE_ERROR, element); + SystemBasePlugin.logError("Exception prompting for filter ", exc); + } + //SystemPlugin.logDebugMessage(this.getClass().getName(),"returning children"); + return children; + } + + // 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 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; + } + } + + + if (!referencedFilter.isTransient() && + ssf.supportsFilterCaching() && + !fRef.isStale() && + fRef.hasContents(SystemChildrenContentsType.getInstance())) + { + children = fRef.getContents(SystemChildrenContentsType.getInstance()); + } + else + { + Object[] allChildren = null; + + if (monitor == null) + { + Shell shell = getShell(); + allChildren = ss.resolveFilterStrings(filterStrings, shell); + } + else + { + allChildren = ss.resolveFilterStrings(monitor, filterStrings); + } + + if (allChildren == null) + { + System.out.println("filter children == null!"); + } + else + { + int nbrNestedFilters = (nestedFilterReferences == null) ? 0 : 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(SystemPlugin.getPluginMessage(MSG_EXPAND_CANCELLED), ISystemMessageObject.MSGTYPE_CANCEL, element); + SystemBasePlugin.logDebugMessage(this.getClass().getName(), "Filter resolving canceled by user."); + } + catch (Exception exc) + { + children = new SystemMessageObject[1]; + children[0] = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_FAILED), ISystemMessageObject.MSGTYPE_ERROR, element); + SystemBasePlugin.logError("Exception resolving filters' strings ", exc); + } // message already issued + + if ((children == null) || (children.length == 0)) + { + children = new SystemMessageObject[1]; + children[0] = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_EMPTY), ISystemMessageObject.MSGTYPE_EMPTY, element); + } + return children; + } + } + } + + /** + * Return true if this object has children. + * That is, if the referenced filter has nested filters or filter strings. + */ + public boolean hasChildren(Object element) + { + ISystemFilterReference fRef = getFilterReference(element); + ISystemFilter referencedFilter = fRef.getReferencedFilter(); + + ISubSystemConfiguration factory = getSubSystemFactory(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. + *

    + * 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; + } + + /** + * Overide of parent method.
    + * From IActionFilter so the popupMenus extension point can use <filter>, <enablement> + * or <visibility>. We add support is for the following: + *

      + *
    1. name="filterType". The value is tested against the non-translated filter type. Note all subsystems + * support different types of filters. + *
    2. name="showChangeFilterStringsPropertyPage". The value is tested against the call to the subsystem factory method showChangeFilterStringsPropertyPage(SystemFilter). + * Compares against "true" (default) or "false". + *
    + */ + public boolean testAttribute(Object target, String name, String value) + { + if (name.equalsIgnoreCase("filterType")) + { + 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")) + { + ISystemFilterReference ref = getFilterReference(target); + ISubSystemConfiguration ssf = SubSystemHelpers.getParentSubSystemFactory(ref.getReferencedFilter()); + if (value.equals("true")) + 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(P_PARENT_FILTERPOOL, SystemViewResources.RESID_PROPERTY_FILTERPARENTPOOL_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPARENTPOOL_TOOLTIP); + // parent filter + propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(P_PARENT_FILTER, SystemViewResources.RESID_PROPERTY_FILTERPARENTFILTER_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPARENTFILTER_TOOLTIP); + // number filter strings + propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(P_FILTERSTRINGS_COUNT, SystemViewResources.RESID_PROPERTY_FILTERSTRINGS_COUNT_LABEL, SystemViewResources.RESID_PROPERTY_FILTERSTRINGS_COUNT_TOOLTIP); + // Related connection + propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(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) 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 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; + Vector 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(); + } + /* + if (filter != null) + { + filterNames.removeElement(filter.getName()); // remove current filter's name + System.out.println("Existing names for " + filter.getName()); + for (int idx=0; idx + * 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. + *

    + * 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(); + } + + /** + * Don't show "Open in new perspective" if this is promptable + */ + public boolean showOpenViewActions(Object element) + { + ISystemFilter filter = getFilter(element); + return !filter.isPromptable(); + } + + + /** + * Don't show generic "Show in Table" if the factory asks not to + */ + public boolean showGenericShowInTableAction(Object element) + { + ISystemFilter filter = getFilter(element); + ISubSystemConfiguration ssParentFactory = getSubSystemFactory(filter); + return ssParentFactory.showGenericShowInTableOnFilter(); + } + + /** + * 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 = getSubSystemFactory(filter); + return ssParentFactory.showRefreshOnFilter(); + } + + // ------------------------------------------------------------ + // 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() + "="; + ISystemFilter parentFilter = referencedFilter.getParentFilter(); + while (parentFilter != null) + { + handle += parentFilter.getName() + ";"; + 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 Systems Explorer perspective. + */ + public String getInputMementoHandle(Object element) + { + Object parent = ((ISystemFilterReference) element).getParent(); //getParent(element); // will be filter (nested) or filter pool + ISystemViewElementAdapter parentAdapter = getAdapter(parent); + boolean showFPs = SystemPreferencesManager.getPreferencesManager().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 = getAdapter(parent); // 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. + *

    + * 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(); + /** TODO - this was originally for iseries..but + * with new model, another approach should be used (maybe via factory api) + if ((ssf != null) && (ssf instanceof IRemoteCmdSubSystemFactory)) + return true; + else + **/ + return false; + } + + + // ------------------------------------------ + // 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 (getSubSystemFactory(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 = getSubSystemFactory(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 (getSubSystemFactory(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. + */ + public boolean supportsDeferredQueries() + { + return true; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterStringAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterStringAdapter.java new file mode 100644 index 00000000000..47bf8ef9919 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterStringAdapter.java @@ -0,0 +1,285 @@ +/******************************************************************************** + * 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 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.SystemPlugin; +import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterString; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemMenuManager; +import org.eclipse.rse.ui.SystemResources; +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 implements ISystemViewElementAdapter, ISystemMessages +{ + //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; + /* + SubSystemFactory ssFactory = SubSystemHelpers.getParentSubSystemFactory(filterString); + ssFactory.setConnection(null); + IAction[] actions = ssFactory.getFilterActions(filter, shell); + if (actions != null) + { + for (int idx=0; idx + * Called by common rename and delete actions. + */ + public String getName(Object element) + { + return getFilterString(element).getString(); + } + /** + * Return the absolute name, versus just display name, of this 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(); + } + /** + * 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; + //SubSystemFactory ssParentFactory = SubSystemHelpers.getParentSubSystemFactory(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(Object element) + { + return null; + } + + + /** + * Return true if this object has children. We return false; + */ + public boolean hasChildren(Object element) + { + return false; + } + + /** + * Return our unique property descriptors + */ + protected IPropertyDescriptor[] internalGetPropertyDescriptors() + { + if (propertyDescriptorArray == null) + { + propertyDescriptorArray = new PropertyDescriptor[3]; + SystemPlugin plugin = SystemPlugin.getDefault(); + int idx = 0; + // parent filter pool + propertyDescriptorArray[idx] = createSimplePropertyDescriptor(P_PARENT_FILTERPOOL,SystemViewResources.RESID_PROPERTY_FILTERPARENTPOOL_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPARENTPOOL_TOOLTIP); + // parent filter + propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(P_PARENT_FILTER,SystemViewResources.RESID_PROPERTY_FILTERPARENTFILTER_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPARENTFILTER_TOOLTIP); + // filter string + propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(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(); + Vector strings = filter.getSystemFiltersVector(); + String[] filterStrings = new String[strings.size()-1]; + for (int idx=0; idx + * 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. + *

    + * 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 createToolBar(Shell shell) + { + toolbar = new ToolBar(this, SWT.FLAT | SWT.WRAP); + toolbarMgr = new ToolBarManager(toolbar); + } + + protected void populateToolBar(Shell shell) + { + SystemNewConnectionAction newConnAction = new SystemNewConnectionAction(shell, false, tree); // false implies not from popup menu + toolbarMgr.add(newConnAction); + SystemCascadingPulldownMenuAction submenuAction = new SystemCascadingPulldownMenuAction(shell, tree); + toolbarMgr.add(submenuAction); + toolbarMgr.update(false); + } + + protected void createButtonBar(Composite parentComposite, int nbrButtons) + { + // Button composite + Composite composite_buttons = SystemWidgetHelpers.createTightComposite(parentComposite, nbrButtons); + getListButton = SystemWidgetHelpers.createPushButton(composite_buttons, null, SystemResources.ACTION_VIEWFORM_GETLIST_LABEL, SystemResources.ACTION_VIEWFORM_GETLIST_TOOLTIP); + refreshButton = SystemWidgetHelpers.createPushButton(composite_buttons, null, SystemResources.ACTION_VIEWFORM_REFRESH_LABEL, SystemResources.ACTION_VIEWFORM_REFRESH_TOOLTIP); + } + + + protected void addOurSelectionListener() + { + // Add the button listener + SelectionListener selectionListener = new SelectionListener() + { + public void widgetDefaultSelected(SelectionEvent event) + { + }; + public void widgetSelected(SelectionEvent event) + { + Object src = event.getSource(); + if (src==getListButton) + processGetListButton(); + else if (src==refreshButton) + processRefreshButton(); + }; + }; + if (getListButton != null) + getListButton.addSelectionListener(selectionListener); + if (refreshButton != null) + refreshButton.addSelectionListener(selectionListener); + + } + protected void addOurMouseListener() + { + MouseListener mouseListener = new MouseAdapter() + { + public void mouseDown(MouseEvent e) + { + //requestActivation(); + } + }; + toolbar.addMouseListener(mouseListener); + } + + /** + * Process the refresh button. + */ + protected void processRefreshButton() + { + refreshButton.setEnabled(false); + getListButton.setEnabled(false); + requestInProgress = true; + fireRequestStartEvent(); + + refresh(); + + fireRequestStopEvent(); + requestInProgress = false; + enableButtonBarButtons(true); + } + + /** + * Process the getList button. + */ + protected void processGetListButton() + { + refreshButton.setEnabled(false); + getListButton.setEnabled(false); + requestInProgress = true; + fireRequestStartEvent(); + + tree.setInputProvider(inputProvider); + + fireRequestStopEvent(); + requestInProgress = false; + enableButtonBarButtons(true); + } + + /** + * Enable/Disable refresh and getList buttons. + * Note that these are mutually exclusive + */ + protected void enableButtonBarButtons(boolean enableRefresh) + { + if (refreshButton != null) + refreshButton.setEnabled(enableRefresh); + if (getListButton != null) + getListButton.setEnabled(!enableRefresh); + } + + /** + * Fire long running request listener event + */ + protected void fireRequestStartEvent() + { + if (requestListeners != null) + { + SystemLongRunningRequestEvent event = new SystemLongRunningRequestEvent(); + for (int idx=0; idx + * This has a general flavour, which is used in most cases, and also has + * a specialized flavour 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 filterstring. + */ +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 DeferredTreeContentManager manager; + /** + * The cache of images that have been dispensed by this provider. + * Maps ImageDescriptor->Image. + */ + private Map imageTable = new Hashtable(40); + + /** + * 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); + } + } + } + // 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 getAdapter(Object o) + { + ISystemViewElementAdapter adapter = null; + if (o == null) + { + SystemBasePlugin.logWarning("ERROR: null passed to getAdapter in SystemViewLabelAndContentProvider"); + } + + { + if (!(o instanceof IAdaptable)) + adapter = (ISystemViewElementAdapter)Platform.getAdapterManager().getAdapter(o,ISystemViewElementAdapter.class); + else + adapter = (ISystemViewElementAdapter)((IAdaptable)o).getAdapter(ISystemViewElementAdapter.class); + if (adapter == null) + SystemBasePlugin.logWarning("ADAPTER IS NULL FOR ELEMENT OF TYPE: " + o.getClass().getName()); + } + if ((adapter!=null) && (viewer != null)) + { + Shell shell = null; + if (viewer instanceof ISystemResourceChangeListener) + shell = ((ISystemResourceChangeListener)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"); + 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 = SystemPlugin.getDefault().getPreferenceStore(); + return store.getBoolean(ISystemPreferencesConstants.USE_DEFERRED_QUERIES); + } + + + /** + * @see ITreeContentProvider + */ + public Object[] getChildren(Object element) + { + ISystemViewElementAdapter adapter = getAdapter(element); + if (supportsDeferredQueries()) + { + if (manager != null && adapter.supportsDeferredQueries()) + { + ISubSystem ss = adapter.getSubSystem(element); + if (ss != null) + { + if (ss.isConnected()) + { + + Object[] children = manager.getChildren(element); + 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 + } + + children = adapter.getChildren(element); + + 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 = getAdapter(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) + { + //return getChildren(element).hasNext(); + ISystemViewElementAdapter adapter = getAdapter(element); + if (adapter != null) + { + return adapter.hasChildren(element); + } + if (manager != null) { + if (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 DeferredTreeContentManager(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 = getAdapter(element); + //System.out.println("Inside getImage. element = " + element + ", adapter = " + adapter); + if (adapter == null) + return null; + /* + boolean isOpen = false; + if (viewer instanceof AbstractTreeViewer) + { + AbstractTreeViewer atv = (AbstractTreeViewer)viewer; + isOpen = true; //atv.getExpandedState(element); + //System.out.println("In getImage for " + adapter.getName(element) + ": isOpen = " + isOpen); + } + ImageDescriptor descriptor = adapter.getImageDescriptor(element, isOpen); + */ + ImageDescriptor descriptor = adapter.getImageDescriptor(element); + //System.out.println("...descriptor = " + descriptor); + + 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 = (Image) imageTable.get(descriptor); + if (image == null) + { + image = descriptor.createImage(); + imageTable.put(descriptor, image); + } + //System.out.println("...image = " + image); + return image; + } + /** + * Returns the label text for the given object. + */ + public String getText(Object element) + { + ISystemViewElementAdapter adapter = getAdapter(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/ui/view/SystemViewMenuListener.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewMenuListener.java new file mode 100644 index 00000000000..371466cd5fc --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewMenuListener.java @@ -0,0 +1,152 @@ +/******************************************************************************** + * 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.view; +import org.eclipse.jface.action.ActionContributionItem; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.rse.ui.Mnemonics; +import org.eclipse.rse.ui.actions.SystemSubMenuManager; +import org.eclipse.rse.ui.messages.ISystemMessageLine; +import org.eclipse.swt.events.ArmEvent; +import org.eclipse.swt.events.ArmListener; +import org.eclipse.swt.events.MenuEvent; +import org.eclipse.swt.events.MenuListener; +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 IMenuListener, MenuListener, ArmListener +{ + + + 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(); + if (!armListeners) + m.setMnemonics((Menu)event.getSource()); + else + m.setMnemonicsAndArmListener((Menu)event.getSource(), this); + menuMnemonicsAdded = true; + if (doOnce) + ((Menu)event.getSource()).removeMenuListener(this); + } + } + // -------------------- + // 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); + } + } + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewMessageAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewMessageAdapter.java new file mode 100644 index 00000000000..366e0866610 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewMessageAdapter.java @@ -0,0 +1,197 @@ +/******************************************************************************** + * 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.resource.ImageDescriptor; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.model.ISystemMessageObject; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemMenuManager; +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. + *

    + * The objects must all implement com.ibm.etools.systems.model.ISystemExpandablePromptableObject + * to use this adapter. + */ +public class SystemViewMessageAdapter + extends AbstractSystemViewAdapter implements ISystemViewElementAdapter +{ + + /** + * 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 SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_ERROR_ID); + else if (type==ISystemMessageObject.MSGTYPE_CANCEL) + return SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_INFO_TREE_ID); + // DY: icon vetoed by UCD + // return SystemPlugin.getDefault().getImageDescriptor(ISystemConstants.ICON_SYSTEM_CANCEL_ID); + else if (type==ISystemMessageObject.MSGTYPE_EMPTY) + return SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_EMPTY_ID); + else if (type==ISystemMessageObject.MSGTYPE_OBJECTCREATED) + return SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_OK_ID); + else + return SystemPlugin.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(); + } + /** + * Return the absolute name, versus just display name, of this object. + * Just uses getText(element); + */ + 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(Object element) + { + return null; + } + + /** + * Return true if this object has children. Always false for us. + */ + public boolean hasChildren(Object 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"; + } + + /** + * 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. + *

    + * WE RETURN FALSE. + */ + public boolean saveExpansionState(Object element) + { + return false; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewNewConnectionPromptAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewNewConnectionPromptAdapter.java new file mode 100644 index 00000000000..b4aaeb96b35 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewNewConnectionPromptAdapter.java @@ -0,0 +1,38 @@ +/******************************************************************************** + * 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.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.actions.SystemRunAction; +import org.eclipse.swt.widgets.Shell; + + +/** + * Adapter class for new connection prompt objects. + */ +public class SystemViewNewConnectionPromptAdapter extends SystemViewPromptableAdapter { + + /** + * @see org.eclipse.rse.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, + SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWCONNECTION_ID), shell)); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPart.java new file mode 100644 index 00000000000..5352665831c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPart.java @@ -0,0 +1,1903 @@ +/******************************************************************************** + * 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 java.util.ArrayList; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.List; +import java.util.Vector; + +import org.eclipse.core.resources.IFile; +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.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.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.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.SystemElapsedTimer; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.SystemPreferencesManager; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.filters.ISystemFilterStringReference; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemPreferenceChangeEvent; +import org.eclipse.rse.model.ISystemPreferenceChangeEvents; +import org.eclipse.rse.model.ISystemPreferenceChangeListener; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.SystemResourceChangeEvent; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.ISystemPreferencesConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.SystemWidgetHelpers; +import org.eclipse.rse.ui.actions.SystemCascadingPreferencesAction; +import org.eclipse.rse.ui.actions.SystemCollapseAllAction; +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.SystemPreferenceQualifyConnectionNamesAction; +import org.eclipse.rse.ui.actions.SystemPreferenceRestoreStateAction; +import org.eclipse.rse.ui.actions.SystemPreferenceShowFilterPoolsAction; +import org.eclipse.rse.ui.actions.SystemRefreshAction; +import org.eclipse.rse.ui.actions.SystemRefreshAllAction; +import org.eclipse.rse.ui.actions.SystemStartCommunicationsDaemonAction; +import org.eclipse.rse.ui.actions.SystemWorkWithProfilesAction; +import org.eclipse.rse.ui.messages.ISystemMessageLine; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.widgets.Composite; +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.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorReference; +import org.eclipse.ui.IElementFactory; +import org.eclipse.ui.IFileEditorInput; +import org.eclipse.ui.IMemento; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.IPersistableElement; +import org.eclipse.ui.IViewSite; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.part.CellEditorActionHandler; +import org.eclipse.ui.part.FileEditorInput; +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. + * ViewPart is from com.ibm.itp.ui.support.parts + */ +public class SystemViewPart + extends ViewPart + implements ISetSelectionTarget, ISystemShellProvider, ISystemMessageLine, IElementFactory, IPersistableElement, IAdapterFactory, ISystemPreferenceChangeListener, ISelectionChangedListener, IRSEViewPart +{ + + public class ToggleLinkingAction extends Action + { + public ToggleLinkingAction(SystemViewPart viewPart, String label) + { + super(label); + setChecked(isLinkingEnabled); + } + + public void run() + { + toggleLinkingEnabled(); + setChecked(isLinkingEnabled); + } + } + + protected SystemView systemView; + protected ISystemViewInputProvider input = null; + protected String message, errorMessage; + protected SystemMessage sysErrorMessage; + protected IStatusLineManager statusLine = null; + protected boolean inputIsRoot = true; + protected boolean doTimings = false; + protected boolean isLinkingEnabled = false; + + protected SystemElapsedTimer timer; + protected FrameList frameList; + protected SystemViewPartGotoActionGroup gotoActionGroup; + protected ToggleLinkingAction toggleLinkingAction; + + // 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; + + // Persistance tags. + static final String TAG_RELEASE = "release"; + static final String TAG_SELECTION = "selection"; + static final String TAG_EXPANDED_TO = "expandedTo"; + static final String TAG_EXPANDED = "expanded"; + static final String TAG_ELEMENT = "element"; + static final String TAG_PATH = "path"; + static final String TAG_FILTER = "filter"; + static final String TAG_INPUT = "svInput"; + static final String TAG_VERTICAL_POSITION = "verticalPosition"; + static final String TAG_HORIZONTAL_POSITION = "horizontalPosition"; + static final String TAG_SHOWFILTERPOOLS = "showFilterPools"; + static final String TAG_SHOWFILTERSTRINGS = "showFilterStrings"; + static final String TAG_LINKWITHEDITOR = "linkWithEditor"; + + public static final String MEMENTO_DELIM = "///"; + + // constants + public static final String ID = "org.eclipse.rse.ui.view.systemView"; // matches id in plugin.xml, view tag + + /** + * SystemViewPart constructor. + */ + public SystemViewPart() + { + super(); + //SystemPlugin.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 void toggleLinkingEnabled() + { + isLinkingEnabled = !isLinkingEnabled; + if (isLinkingEnabled) + { + 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 + * @since 2.0 + */ + protected void editorActivated(IEditorPart editor) + { + if (!isLinkingEnabled) + return; + + IEditorInput input = editor.getEditorInput(); + if (input instanceof IFileEditorInput) + { + IFileEditorInput fileInput = (IFileEditorInput) input; + IFile file = fileInput.getFile(); + /* FIXME - can't couple this view to files ui + SystemIFileProperties properties = new SystemIFileProperties(file); + Object rmtEditable = properties.getRemoteFileObject(); + Object remoteObj = null; + if (rmtEditable != null && rmtEditable instanceof ISystemEditableRemoteObject) + { + ISystemEditableRemoteObject editable = (ISystemEditableRemoteObject) rmtEditable; + remoteObj = editable.getRemoteObject(); + + } + else + { + String subsystemId = properties.getRemoteFileSubSystem(); + String path = properties.getRemoteFilePath(); + if (subsystemId != null && path != null) + { + ISubSystem subSystem = SystemPlugin.getTheSystemRegistry().getSubSystem(subsystemId); + if (subSystem != null) + { + if (subSystem.isConnected()) + { + try + { + remoteObj = subSystem.getObjectWithAbsoluteName(path); + } + catch (Exception e) + { + return; + } + } + } + } + } + + + if (remoteObj != null) + { + // DKM - causes editor to loose focus + //systemView.refreshRemoteObject(path, remoteObj, true); + + SystemResourceChangeEvent event = new SystemResourceChangeEvent(remoteObj, ISystemResourceChangeEvents.EVENT_SELECT_REMOTE, null); + systemView.systemResourceChanged(event); + } + */ + } + } + /** + * 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()); + if (inputObj != null) + { + setTitleToolTip(getFrameToolTipText(input)); + String viewName = getConfigurationElement().getAttribute("name"); //$NON-NLS-1$ + if (inputObj instanceof IHost) + { + IHost conn = (IHost) inputObj; + setPartName(viewName + " : " + conn.getAliasName()); + } + else if (inputObj instanceof ISubSystem) + { + ISubSystem ss = (ISubSystem) inputObj; + setPartName(viewName + " : " + ss.getName()); + } + else if (inputObj instanceof ISystemFilterPoolReference) + { + ISystemFilterPoolReference sfpr = (ISystemFilterPoolReference) inputObj; + setPartName(viewName + " : " + sfpr.getName()); + } + else if (inputObj instanceof ISystemFilterReference) + { + ISystemFilterReference sfr = (ISystemFilterReference) inputObj; + setPartName(viewName + " : " + sfr.getName()); + } + else if (inputObj instanceof ISystemFilterStringReference) + { + ISystemFilterStringReference sfsr = (ISystemFilterStringReference) inputObj; + setPartName(viewName + " : " + sfsr.getString()); + } + 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) + { + SystemPlugin.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) + { + //SystemPlugin.logInfo("INSIDE CREATEPARTCONTROL FOR SYSTEMVIEWPART."); + if (input == null) + //input = SystemPlugin.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()); + //SystemCommonSelectAllAction selAllAction = new SystemCommonSelectAllAction(getShell(), systemView, systemView); + actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), systemView.getSelectAllAction()); + // added by Phil in 3.0 ... + //actionBars.setGlobalActionHandler(IWorkbenchActionConstants.PROPERTIES, systemView.getPropertyDialogAction(); hmm, different one for local vs remote objects + actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), systemView.getRefreshAction()); + + statusLine = actionBars.getStatusLineManager(); + } + + // register global edit actions + ISystemRegistry registry = SystemPlugin.getTheSystemRegistry(); + + Clipboard clipboard = registry.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()); + + //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, SystemPlugin.HELPPREFIX + "sysv0000"); + + // ---------------------- + // Restore previous state + // ---------------------- + if ((fMemento != null) && (input instanceof ISystemRegistry)) + restoreState(fMemento); + //fMemento = null; + + // Register for preference change events + 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 == SystemPlugin.getTheSystemRegistry()) && (SystemPlugin.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!! + TreeItem firstItem = systemView.getTree().getItems()[0]; + systemView.setSelection(new StructuredSelection(firstItem.getData())); + systemView.setExpandedState(firstItem.getData(), true); + } + } + + /** + * Creates the frame source and frame list, and connects them. + * + * @since 2.0 + */ + 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 + * @since 2.0 + */ + 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)); + SystemPlugin.getDefault().getWorkbench().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) + { + Object obj = selection.getFirstElement(); + if (obj instanceof IAdaptable) + { + try + { + ISystemRemoteElementAdapter adapter = (ISystemRemoteElementAdapter)((IAdaptable)obj).getAdapter(ISystemRemoteElementAdapter.class); + if (adapter != null) + { + + if (adapter.canEdit(obj)) + { + IWorkbenchPage page = getSite().getPage(); + IEditorReference[] editorRefs = page.getEditorReferences(); + for (int i = 0; i < editorRefs.length; i++) + { + IEditorReference editorRef = editorRefs[i]; + + IEditorPart editor = editorRef.getEditor(false); + if (editor != null) + { + IEditorInput input = editor.getEditorInput(); + if (input instanceof FileEditorInput) + { + IFile file = ((FileEditorInput)input).getFile(); + /** FIXME - can't couple this view to files ui + if (file.getProject().getName().equals(SystemRemoteEditManager.REMOTE_EDIT_PROJECT_NAME)) + { + SystemIFileProperties properties = new SystemIFileProperties(file); + String path = properties.getRemoteFilePath(); + if (path != null && path.equals(adapter.getAbsoluteName(obj))) + { + page.bringToTop(editor); + return; + } + } + */ + } + } + } + } + } + } + catch (Exception e) + { + e.printStackTrace(); + } + } + } + + + /** + * Fills the local tool bar with actions. + */ + protected void fillLocalToolBar(boolean showConnectionActions) + { + IActionBars actionBars = getViewSite().getActionBars(); + SystemRefreshAction refreshAction = new SystemRefreshAction(getShell()); + refreshAction.setSelectionProvider(systemView); + actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), refreshAction); + + IToolBarManager toolBarMgr = actionBars.getToolBarManager(); + if (showConnectionActions) + { + SystemNewConnectionAction newConnAction = new SystemNewConnectionAction(getShell(), false, systemView); // false implies not from popup menu + toolBarMgr.add(newConnAction); + } + + refreshAction.setSelectionProvider(systemView); + toolBarMgr.add(refreshAction); + + toolBarMgr.add(new Separator("Navigate")); + SystemViewPartGotoActionGroup gotoActions = new SystemViewPartGotoActionGroup(this); + gotoActions.fillActionBars(actionBars); + + // defect 41203 + toolBarMgr.add(new Separator()); + + // DKM - changing hover image to the elcl16 one since the navigator no long has clcl16 icons + SystemCollapseAllAction collapseAllAction = new SystemCollapseAllAction(getShell()); + collapseAllAction.setSelectionProvider(systemView); + // PSC ... better to encapsulate this in the SystemCollapseAllAction class + //collapseAllAction.setImageDescriptor(getNavigatorImageDescriptor("elcl16/collapseall.gif")); //$NON-NLS-1$ + //collapseAllAction.setHoverImageDescriptor(getNavigatorImageDescriptor("elcl16/collapseall.gif")); //$NON-NLS-1$ + + toolBarMgr.add(collapseAllAction); + + toggleLinkingAction = new ToggleLinkingAction(this, org.eclipse.ui.internal.views.navigator.ResourceNavigatorMessages.ToggleLinkingAction_text); + + toggleLinkingAction.setToolTipText(org.eclipse.ui.internal.views.navigator.ResourceNavigatorMessages.ToggleLinkingAction_toolTip); + toggleLinkingAction.setImageDescriptor(getNavigatorImageDescriptor(ISystemIconConstants.ICON_IDE_LINKTOEDITOR_ID)); + toggleLinkingAction.setHoverImageDescriptor(getNavigatorImageDescriptor(ISystemIconConstants.ICON_IDE_LINKTOEDITOR_ID)); + toolBarMgr.add(toggleLinkingAction); + + + + IMenuManager menuMgr = actionBars.getMenuManager(); + populateSystemViewPulldownMenu(menuMgr, getShell(), showConnectionActions, this, systemView); + } + /** + * 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); + SystemWorkWithProfilesAction wwProfilesAction = new SystemWorkWithProfilesAction(shell); + menuMgr.add(newConnectionAction); + 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 query our remoteSystemsViewPreferencesActions for extenders who wish to appear in the + // preferences cascading menu... + SystemCascadingPreferencesAction preferencesAction = new SystemCascadingPreferencesAction(shell); + menuMgr.add(preferencesAction.getSubMenu()); + + menuMgr.add(new Separator()); + menuMgr.add(new SystemStartCommunicationsDaemonAction(shell)); + + if (viewPart != null) + { + /* + SystemCascadingTeamAction teamAction = new SystemCascadingTeamAction(shell, viewPart); + menuMgr.add(new Separator()); + menuMgr.add(teamAction.getSubMenu()); + */ + } + 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); + SystemPlugin.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 = SystemPlugin.getTheSystemRegistry(); + if (inputObj != null) + { + platformManager = Platform.getAdapterManager(); + if (inputObj instanceof IHost) + { + IHost conn = (IHost) inputObj; + inputProvider = new SystemViewAPIProviderForConnections(conn); + setPartName(getTitle() + " : " + conn.getAliasName()); + } + else if (inputObj instanceof ISubSystem) + { + ISubSystem ss = (ISubSystem) inputObj; + inputProvider = new SystemViewAPIProviderForSubSystems(ss); + setPartName(getTitle() + " : " + ss.getName()); + } + else if (inputObj instanceof ISystemFilterPoolReference) + { + ISystemFilterPoolReference sfpr = (ISystemFilterPoolReference) inputObj; + inputProvider = new SystemViewAPIProviderForFilterPools(sfpr); + setPartName(getTitle() + " : " + sfpr.getName()); + } + else if (inputObj instanceof ISystemFilterReference) + { + ISystemFilterReference sfr = (ISystemFilterReference) inputObj; + inputProvider = new SystemViewAPIProviderForFilters(sfr); + setPartName(getTitle() + " : " + sfr.getName()); + } + else if (inputObj instanceof ISystemFilterStringReference) + { + ISystemFilterStringReference sfsr = (ISystemFilterStringReference) inputObj; + inputProvider = new SystemViewAPIProviderForFilterStrings(sfsr); + setPartName(getTitle() + " : " + sfsr.getString()); + } + 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; + } + //SystemPlugin.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.getPreferencesManager().getQualifyConnectionNames()); + else if ((event.getType() == ISystemPreferenceChangeEvents.EVENT_SHOWFILTERPOOLS) && (showFilterPoolsAction != null)) + showFilterPoolsAction.setChecked(SystemPreferencesManager.getPreferencesManager().getShowFilterPools()); + else if ((event.getType() == ISystemPreferenceChangeEvents.EVENT_RESTORESTATE) && (restoreStateAction != null)) + restoreStateAction.setChecked(SystemPreferencesManager.getPreferencesManager().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 null is returned. + */ + public String getErrorMessage() + { + return errorMessage; + } + /** + * Get the currently displayed message. + * @return The message. If no message is displayed null 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 null 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. + *

    + * 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 SystemPlugin.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.getPreferencesManager().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"); + } + else + { + memento.putString(TAG_LINKWITHEDITOR, "f"); + } + + // We record the current release for future in case anything significant changes from release to release + memento.putString(TAG_RELEASE, SystemResources.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.getPreferencesManager().getShowFilterPools() ? "t" : "f"); + //memento.putString(TAG_SHOWFILTERSTRINGS, SystemPreferencesManager.getPreferencesManager().getShowFilterStrings() ? "t" : "f"); + + String inputMemento = memento.getString("factoryID"); // see IWorkbenchWindow ... this is only clue I can figure out! + 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.getAdapter(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.getAdapter(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.getAdapter(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(SystemPlugin.getTheSystemRegistry()); + restoreAction.schedule(); + + /* DKM - Moved to RestoreStateRunnable + * - resolves invalid shell problem at startup + * * + //System.out.println("SYSTEMVIEWPART: restoreState"); + if (!SystemPreferencesManager.getPreferencesManager().getRememberState()) + return; + + if (doTimings) + timer = new SystemElapsedTimer(); + + // 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 0) + { + Vector v = new Vector(); + for (int idx=0; idx 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 = token.substring(0, index); + 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 (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 (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 (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 != 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 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; + } + } + + 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"); + _memento = memento; + + } + + public IStatus runInUIThread(IProgressMonitor monitor) + { + IMemento memento = _memento; + //System.out.println("SYSTEMVIEWPART: restoreState"); + if (!SystemPreferencesManager.getPreferencesManager().getRememberState()) + return Status.CANCEL_STATUS; + + if (doTimings) + timer = new SystemElapsedTimer(); + + // restore the show filter pools and show filter strings settings as they were when this was saved + boolean showFilterPools = false; + boolean showFilterStrings = false; + String linkWithEditor = memento.getString(TAG_LINKWITHEDITOR); + if (linkWithEditor != null) + { + if (linkWithEditor.equals("t")) + { + isLinkingEnabled = true; + toggleLinkingAction.setChecked(true); + } + else + isLinkingEnabled = false; + } + else + { + isLinkingEnabled = 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); + + // 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) + List cacheSubSystemList = new ArrayList(); + ISubSystem cacheSubSystem; + boolean restoreFromCache = SystemPlugin.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 + { + remoteElements.add(element); + //System.out.println("Added to remote expansion list: " + element); + } + else if (element instanceof ISystemFilterReference) + { + elements.add(element); + + 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()); + // expand remote... + if (remoteElements.size() > 0) + { + for (int idx = 0; idx < remoteElements.size(); idx++) + { + RemoteObject ro = (RemoteObject) remoteElements.elementAt(idx); + if (doTimings) + timer.setStartTime(); + //event = new SystemResourceChangeEvent(ro.name,ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE, + // SystemViewDummyObject.getSingleton()); // This tells SystemView to expand this remote object, but don't select a child + //systemView.systemResourceChanged(event); + + // yantzi: artemis 6.0: notify subsystems that this is a restore from memento so they + // can optionally use the cache if desired + if (ro.subsystem != null && ro.subsystem.supportsCaching()) + { + ro.subsystem.getCacheManager().setRestoreFromMemento(true); + } + + systemView.refreshRemoteObject(ro.name, SystemViewDummyObject.getSingleton(), true); + + // yantzi: artemis 6.0: reset restore from memento flag + if (ro.subsystem != null && ro.subsystem.supportsCaching()) + { + ro.subsystem.getCacheManager().setRestoreFromMemento(false); + } + + if (doTimings) + { + timer.setEndTime(); + System.out.println("Time to restore " + ro.name + ": " + timer); + } + } + } + + // 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); + } + } + } + + // 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); + } + if (doTimings) + timer.setStartTime(); + SystemResourceChangeEvent event = new SystemResourceChangeEvent(v, ISystemResourceChangeEvents.EVENT_SELECT_REMOTE, null); + systemView.systemResourceChanged(event); + if (doTimings) + { + timer.setEndTime(); + System.out.println("Time to select " + v.size() + " elements: " + timer); + } + } + } + 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) + { + } + } + 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"); + else + showFilterPools = SystemPreferencesManager.getPreferencesManager().getShowFilterPools(); + + savedValue = memento.getString(TAG_SHOWFILTERSTRINGS); + if (savedValue != null) + showFilterStrings = savedValue.equals("t"); + //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 "com.ibm.etools.systems.systemview.elementfactory"; + } + + /* + * 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.getAdapter(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.getPreferencesManager().getRememberState()) + return null; + else + return this; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPartFrameSource.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPartFrameSource.java new file mode 100644 index 00000000000..99695de6583 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPartFrameSource.java @@ -0,0 +1,55 @@ +/******************************************************************************** + * 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.ui.views.framelist.TreeFrame; +import org.eclipse.ui.views.framelist.TreeViewerFrameSource; + +/** + * Enables frameset for the Remote Systems 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(); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPartGotoActionGroup.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPartGotoActionGroup.java new file mode 100644 index 00000000000..c32fa6eafe7 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPartGotoActionGroup.java @@ -0,0 +1,109 @@ +/******************************************************************************** + * 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.action.IMenuManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.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 Systems 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() + { + IStructuredSelection selection = + (IStructuredSelection) getContext().getSelection(); + //goIntoAction.setEnabled(selection.size() == 1); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPromptableAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPromptableAdapter.java new file mode 100644 index 00000000000..d0d62860bd3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPromptableAdapter.java @@ -0,0 +1,198 @@ +/******************************************************************************** + * 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.resource.ImageDescriptor; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.model.ISystemPromptableObject; +import org.eclipse.rse.ui.SystemMenuManager; +import org.eclipse.rse.ui.actions.SystemRunAction; +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 implements ISystemViewElementAdapter +{ + 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(); + } + /** + * Return the absolute name, versus just display name, of this object. + * Just uses getText(element); + */ + 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(Object element) + { + ISystemPromptableObject promptable = (ISystemPromptableObject)element; + if (!promptable.hasChildren()) + return promptable.run(getShell()); + else + 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(Object element) + { + 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"; + } + + /** + * 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. + *

    + * WE RETURN FALSE. + */ + public boolean saveExpansionState(Object element) + { + return false; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewResources.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewResources.java new file mode 100644 index 00000000000..d2873ddfc11 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewResources.java @@ -0,0 +1,250 @@ +/******************************************************************************** + * 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.osgi.util.NLS; + + +/** + * Constants used throughout the SystemView plugin + */ +public class SystemViewResources extends NLS { + private static String BUNDLE_NAME = "org.eclipse.rse.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; + + public static String RESID_PROPERTY_NBRCHILDRENRETRIEVED_LABEL; + public static String RESID_PROPERTY_NBRCHILDRENRETRIEVED_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_ALIASNAME_LABEL; + public static String RESID_PROPERTY_ALIASNAME_TOOLTIP; + + 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_FILTERTYPE_LABEL; + public static String RESID_PROPERTY_FILTERTYPE_VALUE; + public static String RESID_PROPERTY_FILTERTYPE_TOOLTIP; + + public static String RESID_PROPERTY_FILTERSTRING_LABEL; + public static String RESID_PROPERTY_FILTERSTRING_VALUE; + public static String RESID_PROPERTY_FILTERSTRING_TOOLTIP; + + public static String RESID_PROPERTY_FILTERSTRINGS_LABEL; + public static String RESID_PROPERTY_FILTERSTRINGS_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; + + public static String RESID_PROPERTY_FILTERS_LABEL; + public static String RESID_PROPERTY_FILTERS_DESCRIPTION; + + // Property sheet values: Files + 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_ARCHIVE_EXPANDEDSIZE_LABEL; + + public static String RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_VALUE; + public static String RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_DESCRIPTION; + + public static String RESID_PROPERTY_ARCHIVE_COMMENT_LABEL; + public static String RESID_PROPERTY_ARCHIVE_COMMENT_DESCRIPTION; + + + public static String RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_LABEL; + public static String RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_VALUE; + public static String RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_DESCRIPTION; + + public static String RESID_PROPERTY_VIRTUALFILE_COMMENT_LABEL; + public static String RESID_PROPERTY_VIRTUALFILE_COMMENT_DESCRIPTION; + + public static String RESID_PROPERTY_VIRTUALFILE_COMPRESSIONRATIO_LABEL; + public static String RESID_PROPERTY_VIRTUALFILE_COMPRESSIONRATIO_DESCRIPTION; + + public static String RESID_PROPERTY_VIRTUALFILE_COMPRESSIONMETHOD_LABEL; + public static String RESID_PROPERTY_VIRTUALFILE_COMPRESSIONMETHOD_DESCRIPTION; + + public static String RESID_PROPERTY_FILE_SIZE_VALUE; + + public static String RESID_PROPERTY_FILE_PATH_LABEL; + public static String RESID_PROPERTY_FILE_PATH_TOOLTIP; + + public static String RESID_PROPERTY_FILE_LASTMODIFIED_LABEL; + public static String RESID_PROPERTY_FILE_LASTMODIFIED_TOOLTIP; + + public static String RESID_PROPERTY_FILE_SIZE_LABEL; + public static String RESID_PROPERTY_FILE_SIZE_TOOLTIP; + + public static String RESID_PROPERTY_FILE_CANONICAL_PATH_LABEL; + public static String RESID_PROPERTY_FILE_CANONICAL_PATH_TOOLTIP; + + public static String RESID_PROPERTY_FILE_CLASSIFICATION_LABEL; + public static String RESID_PROPERTY_FILE_CLASSIFICATION_TOOLTIP; + + public static String RESID_PROPERTY_FILE_READONLY_LABEL; + public static String RESID_PROPERTY_FILE_READONLY_TOOLTIP; + + public static String RESID_PROPERTY_FILE_READABLE_LABEL; + public static String RESID_PROPERTY_FILE_READABLE_TOOLTIP; + + public static String RESID_PROPERTY_FILE_WRITABLE_LABEL; + public static String RESID_PROPERTY_FILE_WRITABLE_TOOLTIP; + + public static String RESID_PROPERTY_FILE_HIDDEN_LABEL; + public static String RESID_PROPERTY_FILE_HIDDEN_TOOLTIP; + + // search result properties + public static String RESID_PROPERTY_SEARCH_LINE_LABEL; + public static String RESID_PROPERTY_SEARCH_LINE_TOOLTIP; + //public static String RESID_PROPERTY_SEARCH_CHAR_END_LABEL; + //public static String RESID_PROPERTY_SEARCH_CHAR_END_TOOLTIP; + + + + // shell status properties + public static String RESID_PROPERTY_SHELL_STATUS_LABEL; + public static String RESID_PROPERTY_SHELL_STATUS_TOOLTIP; + public static String RESID_PROPERTY_SHELL_CONTEXT_LABEL; + public static String RESID_PROPERTY_SHELL_CONTEXT_TOOLTIP; + + public static String RESID_PROPERTY_SHELL_STATUS_ACTIVE_VALUE; + public static String RESID_PROPERTY_SHELL_STATUS_INACTIVE_VALUE; + + // error properties + public static String RESID_PROPERTY_ERROR_FILENAME_LABEL; + public static String RESID_PROPERTY_ERROR_FILENAME_TOOLTIP; + + public static String RESID_PROPERTY_ERROR_LINENO_LABEL; + public static String RESID_PROPERTY_ERROR_LINENO_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_USERACTION_TYPE_VALUE; + public static String RESID_PROPERTY_TEAM_COMPILETYPE_TYPE_VALUE; + public static String RESID_PROPERTY_TEAM_COMPILECMD_TYPE_VALUE; + + // Property sheet values: User actions + public static String RESID_PROPERTY_ORIGIN_IBM_VALUE; + public static String RESID_PROPERTY_ORIGIN_IBMUSER_VALUE; + public static String RESID_PROPERTY_ORIGIN_USER_VALUE; + public static String RESID_PROPERTY_ORIGIN_ISV_VALUE; + public static String RESID_PROPERTY_ORIGIN_ISVUSER_VALUE; + public static String RESID_PROPERTY_USERACTION_VENDOR_LABEL; + public static String RESID_PROPERTY_USERACTION_VENDOR_TOOLTIP; + public static String RESID_PROPERTY_USERACTION_DOMAIN_LABEL; + public static String RESID_PROPERTY_USERACTION_DOMAIN_TOOLTIP; + public static String RESID_PROPERTY_USERACTION_DOMAIN_ALL_VALUE; + + // Property sheet values: Compile types + public static String RESID_PROPERTY_COMPILETYPE_TYPES_LABEL; + public static String RESID_PROPERTY_COMPILETYPE_TYPES_DESCRIPTION; + + // Miscellaneous / common + public static String RESID_PROPERTY_ORIGIN_LABEL; + public static String RESID_PROPERTY_ORIGIN_TOOLTIP; + public static String RESID_PROPERTY_COMMAND_LABEL; + public static String RESID_PROPERTY_COMMAND_TOOLTIP; + public static String RESID_PROPERTY_COMMENT_LABEL; + public static String RESID_PROPERTY_COMMENT_TOOLTIP; + + public static String RESID_SCRATCHPAD; + public static String RESID_REMOTE_SCRATCHPAD; + + static { + // load message values from bundle file + NLS.initializeMessages(BUNDLE_NAME, SystemViewResources.class); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewResources.properties b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewResources.properties new file mode 100644 index 00000000000..8ad70fec708 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewResources.properties @@ -0,0 +1,212 @@ +################################################################################ +# 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. +################################################################################ + +# NLS_MESSAGEFORMAT_NONE + +#COMMON PROPERTIES +RESID_PROPERTY_NBRCHILDREN_LABEL=Number of children +RESID_PROPERTY_NBRCHILDREN_TOOLTIP=Number of children currently under this parent +RESID_PROPERTY_NBRCHILDRENRETRIEVED_LABEL=Last retrieved +RESID_PROPERTY_NBRCHILDRENRETRIEVED_TOOLTIP=Number of children last retrieved + + +#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_ALIASNAME_LABEL=Connection name +RESID_PROPERTY_ALIASNAME_TOOLTIP=Unique name for this connection + +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_FILTERTYPE_LABEL=Filter +RESID_PROPERTY_FILTERTYPE_VALUE=Remote system filter +RESID_PROPERTY_FILTERTYPE_TOOLTIP=Remote system filter + +RESID_PROPERTY_FILTERSTRING_LABEL=Filter string +RESID_PROPERTY_FILTERSTRING_VALUE=Remote system filter string +RESID_PROPERTY_FILTERSTRING_TOOLTIP=Filter string used to get this resource + +RESID_PROPERTY_FILTERSTRINGS_LABEL=Filter strings +RESID_PROPERTY_FILTERSTRINGS_TOOLTIP=Filter strings used to retrieve list of remote system objects + +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 + +RESID_PROPERTY_FILTERS_LABEL=Filter Strings +RESID_PROPERTY_FILTERS_DESCRIPTION=List of file system filters for this named filter + + + +#FILE PROPERTIES +RESID_PROPERTY_FILE_TYPE_FILE_VALUE=File +RESID_PROPERTY_FILE_TYPE_FOLDER_VALUE=Folder +RESID_PROPERTY_FILE_TYPE_ROOT_VALUE=Root +RESID_PROPERTY_FILE_LASTMODIFIED_LABEL=Last modified +RESID_PROPERTY_FILE_LASTMODIFIED_TOOLTIP=When last changed +RESID_PROPERTY_FILE_SIZE_LABEL=Size +RESID_PROPERTY_FILE_SIZE_VALUE=&1 bytes +RESID_PROPERTY_FILE_SIZE_TOOLTIP=Number of bytes in this file +RESID_PROPERTY_FILE_PATH_LABEL=Location +RESID_PROPERTY_FILE_PATH_TOOLTIP=Path containing this file or folder +RESID_PROPERTY_FILE_READABLE_LABEL=Readable +RESID_PROPERTY_FILE_READABLE_TOOLTIP=Is this file readable +RESID_PROPERTY_FILE_WRITABLE_LABEL=Writable +RESID_PROPERTY_FILE_WRITABLE_TOOLTIP=Is this file writable +RESID_PROPERTY_FILE_READONLY_LABEL=Read-only +RESID_PROPERTY_FILE_READONLY_TOOLTIP=Is this file read-only +RESID_PROPERTY_FILE_HIDDEN_LABEL=Hidden +RESID_PROPERTY_FILE_HIDDEN_TOOLTIP=Is this file hidden +RESID_PROPERTY_FILE_CANONICAL_PATH_LABEL=Canonical Path +RESID_PROPERTY_FILE_CANONICAL_PATH_TOOLTIP=Canonical path of this file or folder +RESID_PROPERTY_FILE_CLASSIFICATION_LABEL=Classification +RESID_PROPERTY_FILE_CLASSIFICATION_TOOLTIP=Classification path of this file + + + +#SEARCH RESULT PROPERTIES +RESID_PROPERTY_SEARCH_LINE_LABEL=Line +RESID_PROPERTY_SEARCH_LINE_TOOLTIP=Line in file of match + +#ARCHIVE PROPERTIES +RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_LABEL=Expanded Size +RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_VALUE=&1 bytes +RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_DESCRIPTION=Number of bytes in this archive when it is decompressed/expanded +RESID_PROPERTY_ARCHIVE_COMMENT_LABEL=Comment +RESID_PROPERTY_ARCHIVE_COMMENT_DESCRIPTION=The user-defined comment for this archive + + + +#VIRTUAL FILE PROPERTIES +RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_LABEL=Compressed Size +RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_VALUE=&1 bytes +RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_DESCRIPTION=Number of bytes in the file after compression +RESID_PROPERTY_VIRTUALFILE_COMPRESSIONRATIO_LABEL=Compression ratio +RESID_PROPERTY_VIRTUALFILE_COMPRESSIONRATIO_DESCRIPTION=Compressed size divided by expanded size expressed as a percentage +RESID_PROPERTY_VIRTUALFILE_COMPRESSIONMETHOD_LABEL=Compression method +RESID_PROPERTY_VIRTUALFILE_COMPRESSIONMETHOD_DESCRIPTION=The algorithm used to compress the file +RESID_PROPERTY_VIRTUALFILE_COMMENT_LABEL=Comment +RESID_PROPERTY_VIRTUALFILE_COMMENT_DESCRIPTION=The user-defined comment for this virtual file + +#SHELL PROPERTIES +RESID_PROPERTY_SHELL_STATUS_LABEL=Status +RESID_PROPERTY_SHELL_STATUS_TOOLTIP=Status of the shell +RESID_PROPERTY_SHELL_CONTEXT_LABEL=Context +RESID_PROPERTY_SHELL_CONTEXT_TOOLTIP=Current context within the shell +RESID_PROPERTY_SHELL_STATUS_ACTIVE_VALUE=Running +RESID_PROPERTY_SHELL_STATUS_INACTIVE_VALUE=Finished + +#MESSAGE PROPERTIES +RESID_PROPERTY_MESSAGE_TYPE_VALUE=Message + +#ERROR PROPERTIES +RESID_PROPERTY_ERROR_FILENAME_LABEL=File +RESID_PROPERTY_ERROR_FILENAME_TOOLTIP=File Containing Error +RESID_PROPERTY_ERROR_LINENO_LABEL=Line +RESID_PROPERTY_ERROR_LINENO_TOOLTIP=Line number + +#TEAM VIEW PROPERTIES +RESID_PROPERTY_TEAM_CATEGORY_TYPE_VALUE=Category +RESID_PROPERTY_TEAM_SSFACTORY_TYPE_VALUE=SubSystem factory +RESID_PROPERTY_TEAM_USERACTION_TYPE_VALUE=User action +RESID_PROPERTY_TEAM_COMPILETYPE_TYPE_VALUE=Compilable source type +RESID_PROPERTY_TEAM_COMPILECMD_TYPE_VALUE=Compile command + +#USER ACTION PROPERTIES +RESID_PROPERTY_ORIGIN_IBM_VALUE=IBM supplied +RESID_PROPERTY_ORIGIN_IBMUSER_VALUE=IBM supplied, user edited +RESID_PROPERTY_ORIGIN_ISV_VALUE=ISV supplied +RESID_PROPERTY_ORIGIN_ISVUSER_VALUE=ISV supplied, user edited +RESID_PROPERTY_ORIGIN_USER_VALUE=User defined +RESID_PROPERTY_USERACTION_DOMAIN_ALL_VALUE=All +RESID_PROPERTY_USERACTION_VENDOR_LABEL=Vendor +RESID_PROPERTY_USERACTION_VENDOR_TOOLTIP=Vendor that supplied this command +RESID_PROPERTY_USERACTION_DOMAIN_LABEL=Domain +RESID_PROPERTY_USERACTION_DOMAIN_TOOLTIP=Object domain this applies to + + +#COMPILE TYPE PROPERTIES +RESID_PROPERTY_COMPILETYPE_TYPES_LABEL=File type +RESID_PROPERTY_COMPILETYPE_TYPES_DESCRIPTION=File type this refers to + +#MISCELLANEOUS PROPERTIES +RESID_PROPERTY_ORIGIN_LABEL=Origin +RESID_PROPERTY_ORIGIN_TOOLTIP=Where this originated from +RESID_PROPERTY_COMMAND_LABEL=Command +RESID_PROPERTY_COMMAND_TOOLTIP=The command that will be executed +RESID_PROPERTY_COMMENT_LABEL=Comment +RESID_PROPERTY_COMMENT_TOOLTIP=A description + +RESID_SCRATCHPAD=Scratchpad +RESID_REMOTE_SCRATCHPAD=Remote Scratchpad \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewRootInputAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewRootInputAdapter.java new file mode 100644 index 00000000000..0ba04367946 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewRootInputAdapter.java @@ -0,0 +1,226 @@ +/******************************************************************************** + * 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.resource.ImageDescriptor; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPreferencesManager; +import org.eclipse.rse.internal.model.SystemNewConnectionPromptObject; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.ui.SystemMenuManager; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.validators.ISystemValidator; +import org.eclipse.swt.widgets.Shell; + + + +/** + * Adapter for the root-providing object of the SystemView tree viewer. + */ +public class SystemViewRootInputAdapter extends AbstractSystemViewAdapter implements ISystemViewElementAdapter +{ + private SystemPreferencesManager spg; + 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; + } + /** + * Return the absolute name, versus just display name, of this object. + * Just uses getText(element); + */ + 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(Object element) + { + 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; idxfalse. + * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#supportsUserDefinedActions(java.lang.Object) + */ + public boolean supportsUserDefinedActions(Object object) { + return false; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewSubSystemAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewSubSystemAdapter.java new file mode 100644 index 00000000000..f090fc9fa1b --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewSubSystemAdapter.java @@ -0,0 +1,728 @@ +/******************************************************************************** + * 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.core.runtime.IProgressMonitor; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.ISystemUserIdConstants; +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +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.util.ISubsystemConfigurationAdapter; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.ui.SystemMenuManager; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.validators.ISystemValidator; +import org.eclipse.rse.ui.validators.ValidatorPortInput; +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 + implements ISystemViewElementAdapter, ISystemPropertyConstants, ISystemUserIdConstants +{ + 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) + { + if (selection.size() != 1) + return; // does not make sense adding unique actions per multi-selection + Object element = selection.getFirstElement(); + ISubSystem ss = (ISubSystem)element; + ISubSystemConfiguration ssFactory = SystemPlugin.getDefault().getSystemRegistry().getSubSystemConfiguration(ss); + ISubsystemConfigurationAdapter adapter = (ISubsystemConfigurationAdapter)ssFactory.getAdapter(ISubsystemConfigurationAdapter.class); + + IAction[] actions = adapter.getSubSystemActions(ssFactory, ss,shell); + if (actions != null) + { + for (int idx=0; idx + * Called by common rename and delete actions. + */ + public String getName(Object element) + { + return ((ISubSystem)element).getName(); + } + /** + * Return the absolute name, versus just display name, of this object. + * Returns profileName.connectionName.subsystemName; + */ + public String getAbsoluteName(Object element) + { + ISubSystem ss = (ISubSystem)element; + return ss.getSystemProfileName() + "." + ss.getHostAliasName() + "." + ss.getName(); + } + /** + * 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 SystemPlugin.getDefault().getSystemRegistry().getHost(ss.getSystemProfile(),ss.getHostAliasName()); + } + + /** + * Return the children of this object + */ + public Object[] getChildren(Object element) + { + //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(Object 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 + SystemPlugin plugin = SystemPlugin.getDefault(); + + // 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.setValidator(new ValidatorPortInput()); + propertyDescriptorArray[++idx] = propertyPortDescriptor; + //propertyDescriptorArray[++idx] = getPortDescriptor(); + + // connected + propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(P_IS_CONNECTED, SystemViewResources.RESID_PROPERTY_CONNECTED_LABEL, SystemViewResources.RESID_PROPERTY_CONNECTED_TOOLTIP); + + // vrm + propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(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(); + SystemPlugin sp = SystemPlugin.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(); + boolean connectedIdIsNull = (connectedId == null); // caused crash! Happens on Local subsystems. Phil. + if (data.getIsLocal() && !connectedIdIsNull && !connectedId.equals(localUserId)) + { + data.setLocalValue(connectedId); + data.setIsLocal(true); + } + else if (!connectedIdIsNull && !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 + SubSystemFactory ssFactory = subsys.getParentSubSystemFactory(); + boolean notApplicable = (!ssFactory.isPortEditable() && (iPort <= 0)); + if (!notApplicable) + { + data.setInheritedValue("0"); + data.setInheritedDisplayString(SystemResources.RESID_PORT_DYNAMICSELECT)); + 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(P_USERID)) + return setUserIdPropertyData(userIdData, ss); + else if (name.equals(P_PORT)) + return getPortString(ss); + else if (name.equals(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(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()); + SystemBasePlugin.logError("SystemViewSubSystemAdapter: Error! system is null for subsystem "+ss.getClass().getName(), null); + } + 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; + if (userIdDescriptor != null) + userIdDescriptor.setValidator((ICellEditorValidator)ssFactory.getUserIdValidator()); + //getPortDescriptor().setValidator((ICellEditorValidator)ssFactory.getPortValidator()); + if (propertyPortDescriptor != null) + { + propertyPortDescriptor.setValidator((ICellEditorValidator)ssFactory.getPortValidator()); + } + int iPort = 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 true if the value of the specified property has changed + * from its original default value; false otherwise. + */ + public boolean isPropertySet(Object propertyObject) + { + String property = (String)propertyObject; + boolean changed = false; + if (property.equals(P_USERID)) + changed = changed_userId; + else if (property.equals(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((Shell)null, 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); + SubSystemFactory ssFactory = subsys.getParentSubSystemFactory(); + 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 = (String)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((Shell)null, subsys, false, subsys.getLocalUserId(), true, portInt); + } + + + /** + * Called when user selects the reset button in property sheet. + */ + public void resetPropertyValue(Object propertyObject) + { + String property = (String)propertyObject; + ISubSystem ss = (ISubSystem)propertySourceInput; + ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration(); + if (property.equals(P_USERID)) + { + updateUserId(ss, original_userIdData); + changed_userId = false; + } + else if (property.equals(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; + ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration(); + //System.out.println("inside setPropVal: " + property + ", value: " + value); + if (name.equals(P_USERID)) + { + updateUserId(ss, (SystemInheritablePropertyData)value); + changed_userId = true; + } + else if (name.equals(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: + *

      + *
    1. 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()} method. + *
    + * + * 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")) + { + ISubSystem ss = (ISubSystem)target; + boolean supports = ss.getSubSystemConfiguration().supportsServerLaunchProperties(ss.getHost()); + return supports ? value.equals("true") : value.equals("false"); + } + else if (name.equalsIgnoreCase("envVarPP")) + { + /** FIXME can't access specific subsystems from core anymore + boolean supports = false; + if (ss instanceof IRemoteFileSubSystem) + supports = ((IRemoteFileSubSystemFactory)ss.getParentSubSystemFactory()).supportsEnvironmentVariablesPropertyPage(); + else + supports = ((IRemoteCmdSubSystemFactory)ss.getParentSubSystemFactory()).supportsEnvironmentVariablesPropertyPage(); + */ + boolean supports = false; + return supports ? value.equals("true") : value.equals("false"); + } + else if (name.equalsIgnoreCase("isConnectionError")) + { + ISubSystem ss = (ISubSystem) target; + boolean error = ss.isConnectionError(); + return error ? value.equals("true") : value.equals("false"); + } + } + 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 = SystemPlugin.getDefault().getSystemRegistry(); + 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) + { + 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(); + } + /** + * Return what to save to disk to identify this element when it is the input object to a secondary + * Remote Systems Explorer perspective. + */ + public String getInputMementoHandle(Object element) + { + Object parent = getParent(element); + return getAdapter(parent).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; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/BrowseAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/BrowseAction.java new file mode 100644 index 00000000000..c773e65d3cf --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/BrowseAction.java @@ -0,0 +1,54 @@ +/******************************************************************************** + * 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.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() + { + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/ClearAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/ClearAction.java new file mode 100644 index 00000000000..a58cf969d1e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/ClearAction.java @@ -0,0 +1,52 @@ +/******************************************************************************** + * 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.view.monitor; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; + + + +public class ClearAction extends BrowseAction +{ + + public ClearAction(SystemMonitorViewPart view) + { + super(view, SystemResources.ACTION_CLEAR_ALL_LABEL, + SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_CLEAR_ALL_ID)); + + + // 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(); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/ClearSelectedAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/ClearSelectedAction.java new file mode 100644 index 00000000000..015de1ec92d --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/ClearSelectedAction.java @@ -0,0 +1,58 @@ +/******************************************************************************** + * 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.view.monitor; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; + + + + + +public class ClearSelectedAction extends BrowseAction +{ + public ClearSelectedAction(SystemMonitorViewPart view) + { + super(view, SystemResources.ACTION_CLEAR_SELECTED_LABEL, + SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_CLEAR_SELECTED_ID)); + + // 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()); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/MonitorViewPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/MonitorViewPage.java new file mode 100644 index 00000000000..99c241f075e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/MonitorViewPage.java @@ -0,0 +1,568 @@ +/******************************************************************************** + * 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.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.SystemPlugin; +import org.eclipse.rse.model.ISystemContainer; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.SystemResourceChangeEvent; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.ISystemThemeConstants; +import org.eclipse.rse.ui.SystemResources; +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.SystemTableTreeView; +import org.eclipse.rse.ui.view.SystemTableTreeViewProvider; +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.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Scale; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.Tree; +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, ISystemThemeConstants, IPropertyChangeListener, ISelectionChangedListener, Listener, +FocusListener +{ + private static SystemMessage _queryMessage = SystemPlugin.getPluginMessage(ISystemMessages.MSG_QUERY_PROGRESS); + + class PollingThread extends Thread + { + private boolean _querying = false; + private ISystemViewElementAdapter _adapter; + private Object _inputObject; + private SystemTableTreeView _viewer; + + public PollingThread() + { + _viewer = getViewer(); + _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); + } + + 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(monitor, _inputObject); + if (children != null) + { + SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider)_viewer.getContentProvider(); + provider.setCache(children); + + } + + _querying = false; + return Status.OK_STATUS; + } + }; + + job.schedule(); + } + } + + protected void doRedraw() + { + Display display = Display.getDefault(); + if (display != null) + { + display.asyncExec( + new Runnable() + { + public void run() + { + ISystemRegistry registry = SystemPlugin.getTheSystemRegistry(); + registry.fireEvent(new SystemResourceChangeEvent(_inputObject, ISystemResourceChangeEvents.EVENT_REFRESH, _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() + { + SystemTableTreeView view = _viewer; + view.getTree().selectAll(); + view.setSelection(view.getSelection()); + } + } + + + private SystemTableTreeView _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); + + + + ISystemRegistry registry = SystemPlugin.getTheSystemRegistry(); + + // global actions + Clipboard clipboard = registry.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() + { + _viewPart.getSite().setSelectionProvider(_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) + { + return true; + } + return false; + } + + + public void setEnabled(boolean flag) + { + if (!flag) + { + Tree tree = _viewer.getTree(); + + Display display = _viewer.getShell().getDisplay(); + Color bgcolour = _tabFolderPage.getBackground(); + + tree.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; + Label label = 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"); + + 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"); + + + + 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)); + } + + 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.setWorkbenchPart(_viewPart); + + _viewer.addDoubleClickListener(new IDoubleClickListener() + { + public void doubleClick(DoubleClickEvent event) + { + handleDoubleClick(event); + } + }); + + + SystemWidgetHelpers.setHelp(_viewer.getControl(), SystemPlugin.HELPPREFIX + "ucmd0000"); + + //TableLayout layout = new TableLayout(); + //tree.setLayout(layout); + //tree.setLayout(new GridLayout()) + tree.setHeaderVisible(false); + tree.setLinesVisible(false); + + GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); + tree.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); + boolean alreadyHandled = false; + if (adapter != null) + { + alreadyHandled = adapter.handleDoubleClick(element); + } + } + + public void dispose() + { + _viewer.dispose(); + _tabFolderPage.dispose(); + } + + + + + 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 SystemTableTreeView getViewer() + { + return _viewer; + } + + + + public void updateActionStates() + { + Object input = _viewer.getInput(); + } + + 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/ui/view/monitor/MonitorViewWorkbook.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/MonitorViewWorkbook.java new file mode 100644 index 00000000000..928ebcf9196 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/MonitorViewWorkbook.java @@ -0,0 +1,277 @@ +/******************************************************************************** + * 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.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.SystemTableTreeView; +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. + * ViewPart is from com.ibm.itp.ui.support.parts + */ +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 SystemTableTreeView 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((IAdaptable) 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); + + SystemTableTreeView viewer = monitorViewPage.getViewer(); + _viewPart.getSite().setSelectionProvider(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(); + } + } + } + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/SystemMonitorUI.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/SystemMonitorUI.java new file mode 100644 index 00000000000..6f174a60fb1 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/SystemMonitorUI.java @@ -0,0 +1,78 @@ +/******************************************************************************** + * 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.view.monitor; + +import org.eclipse.rse.core.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"; + + 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 commands view", e); + } + + 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/ui/view/monitor/SystemMonitorViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/SystemMonitorViewPart.java new file mode 100644 index 00000000000..eaf3cd3fff0 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/SystemMonitorViewPart.java @@ -0,0 +1,1034 @@ +/******************************************************************************** + * 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.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.SelectionChangedEvent; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.window.Window; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.model.ISystemContainer; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.ISystemRemoteChangeEvent; +import org.eclipse.rse.model.ISystemRemoteChangeEvents; +import org.eclipse.rse.model.ISystemRemoteChangeListener; +import org.eclipse.rse.model.ISystemResourceChangeEvent; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.ISystemResourceChangeListener; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemPropertyResources; +import org.eclipse.rse.ui.SystemResources; +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.IRSEViewPart; +import org.eclipse.rse.ui.view.ISystemViewElementAdapter; +import org.eclipse.rse.ui.view.SystemTableTreeView; +import org.eclipse.rse.ui.view.SystemTableViewColumnManager; +import org.eclipse.rse.ui.view.SystemTableViewProvider; +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. + * ViewPart is from com.ibm.itp.ui.support.parts + */ +public class SystemMonitorViewPart + extends ViewPart + implements + ISelectionListener, + SelectionListener, + ISelectionChangedListener, + ISystemResourceChangeListener, + ISystemRemoteChangeListener, + ISystemMessageLine, + IRSEViewPart +{ + + + 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("*"); + _cbName.setToolTipText(SystemResources.RESID_TABLE_POSITIONTO_ENTRY_TOOLTIP); + + this.getShell().setText(SystemResources.RESID_TABLE_POSITIONTO_LABEL); + setHelp(); + return c; + } + + private void setHelp() + { + setHelp(SystemPlugin.HELPPREFIX + "gnpt0000"); + } + } + + 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("*"); + _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("*"); + } + + setHelp(); + return c; + } + + private void setHelp() + { + setHelp(SystemPlugin.HELPPREFIX + "gnss0000"); + } + } + + 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, + //SystemPlugin.getDefault().getImageDescriptor(ICON_SYSTEM_REFRESH_ID)); + SystemPlugin.getDefault().getImageDescriptorFromIDE(ISystemIconConstants.ICON_IDE_REFRESH_ID)); + setTitleToolTip(SystemResources.ACTION_REFRESH_TOOLTIP); + } + + public void run() + { + Object inputObject = getViewer().getInput(); + if (inputObject instanceof ISystemContainer) + { + ((ISystemContainer)inputObject).markStale(true); + } + ((SystemTableViewProvider) getViewer().getContentProvider()).flushCache(); + getViewer().refresh(); + + // refresh layout too + //_viewer.computeLayout(true); + + } + } + private class SelectColumnsAction extends BrowseAction + { + + class SelectColumnsDialog extends SystemPromptDialog + { + private ISystemViewElementAdapter _adapter; + private SystemTableViewColumnManager _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, SystemTableViewColumnManager columnManager) + { + super(shell, SystemResources.RESID_TABLE_SELECT_COLUMNS_LABEL); + _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); + + Label label = 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(SystemPlugin.HELPPREFIX + "gntc0000"); + } + } + + public SelectColumnsAction() + { + super(SystemMonitorViewPart.this, SystemResources.ACTION_SELECTCOLUMNS_LABEL, null); + setToolTipText(SystemResources.ACTION_SELECTCOLUMNS_TOOLTIP); + setImageDescriptor(SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTER_ID)); + } + + public void checkEnabledState() + { + + if (getViewer() != null && getViewer().getInput() != null) + { + setEnabled(true); + } + else + { + setEnabled(false); + } + } + public void run() + { + SystemTableTreeView viewer = getViewer(); + SystemTableViewColumnManager 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; + + // constants + public static final String ID = "org.eclipse.rse.ui.view.monitorView"; + // matches id in plugin.xml, view tag + + public void setFocus() + { + _folder.showCurrentPage(); + } + + public Shell getShell() + { + return _folder.getShell(); + } + + public SystemTableTreeView 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, SystemPlugin.HELPPREFIX + "ucmd0000"); + + ISystemRegistry registry = SystemPlugin.getTheSystemRegistry(); + registry.addSystemResourceChangeListener(this); + registry.addSystemRemoteChangeListener(this); + + + RestoreStateRunnable restore = new RestoreStateRunnable(); + Display.getCurrent().asyncExec(restore); + + fillLocalToolBar(); + + } + + public void selectionChanged(IWorkbenchPart part, ISelection sel) + { + } + + public void dispose() + { + ISelectionService selectionService = getSite().getWorkbenchWindow().getSelectionService(); + selectionService.removeSelectionListener(this); + _folder.dispose(); + + ISystemRegistry registry = SystemPlugin.getTheSystemRegistry(); + registry.removeSystemResourceChangeListener(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(); + } + } + + 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 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(); + SystemTableTreeView viewer = getViewer(); + if (viewer != null) + { + Object input = viewer.getInput(); + switch (event.getType()) + { + case ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE: + { + _folder.removeDisconnected(); + } + 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.model.ISystemRemoteChangeEvent + */ + public void systemRemoteResourceChanged(ISystemRemoteChangeEvent event) + { + int eventType = event.getEventType(); + Object remoteResourceParent = event.getResourceParent(); + Object remoteResource = event.getResource(); + + Vector remoteResourceNames = null; + if (remoteResource instanceof Vector) + { + remoteResourceNames = (Vector) remoteResource; + remoteResource = remoteResourceNames.elementAt(0); + } + + Object child = event.getResource(); + + SystemTableTreeView 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; + + 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 null is returned. + */ + public String getErrorMessage() + { + return _errorMessage; + } + /** + * Get the currently displayed message. + * @return The message. If no message is displayed null 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 null 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")); + 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/ui/view/monitor/TabFolderLayout.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/TabFolderLayout.java new file mode 100644 index 00000000000..7b3493d154f --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/TabFolderLayout.java @@ -0,0 +1,61 @@ +/******************************************************************************** + * 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.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 + * + * TableViewer comes from com.ibm.jface.viewer + */ +public class SystemScratchpadView +// TODO change TreeViewer to ScratchpadViewer when Eclipse fixes SWT viewer +//extends ScratchpadViewer +extends TreeViewer +implements IMenuListener, ISystemDeleteTarget, ISystemRenameTarget, ISystemSelectAllTarget, 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 SystemRemotePropertiesAction _remotePropertyDialogAction; + 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 IWorkbenchPart _workbenchPart = null; + + private ISystemMessageLine _messageLine; + protected boolean menuListenerAdded = false; + + private static final int LEFT_BUTTON = 1; + private int mouseButtonPressed = LEFT_BUTTON; + + /** + * 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); + + + setContentProvider(_provider); + + setLabelProvider(new DecoratingLabelProvider(_provider, SystemPlugin.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator())); + + //setLabelProvider(_provider); + + _menuManager = new MenuManager("#PopupMenu"); + _menuManager.setRemoveAllWhenShown(true); + _menuManager.addMenuListener(this); + Menu menu = _menuManager.createContextMenu(tableTree); + tableTree.setMenu(menu); + + addSelectionChangedListener(this); + + SystemPlugin.getTheSystemRegistry().addSystemResourceChangeListener(this); + SystemPlugin.getTheSystemRegistry().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 setWorkbenchPart(IWorkbenchPart part) + { + _workbenchPart = part; + } + + + /** + * 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; + + SystemScratchpadViewProvider provider = (SystemScratchpadViewProvider) getContentProvider(); + Object[] children = provider.getChildren(_objectInput); + + + + 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 getAdapter(Object obj) + { + return SystemAdapterHelpers.getAdapter(obj, this); + } + + + + + protected void initDragAndDrop() + { + int ops = DND.DROP_COPY | DND.DROP_MOVE; + Transfer[] transfers = new Transfer[] { PluginTransfer.getInstance(), TextTransfer.getInstance(), EditorInputTransfer.getInstance(), FileTransfer.getInstance()}; + + addDragSupport(ops, transfers, new SystemViewDataDragAdapter((ISelectionProvider) this)); + addDropSupport(ops | DND.DROP_DEFAULT, transfers, 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) + { + ISystemBaseReferencingObject[] references = ((ISystemFilter)child).getReferencingObjects(); + for (int i = 0; i < references.length; i++) + { + ISystemBaseReferencingObject 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: + { + internalRefresh(parent); + } + 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_DELETE_MANY: + { + if (child instanceof ISystemFilterReference) + { + Widget w = findItem(child); + if (w != null) + { + remove(child); + SystemPlugin.getTheSystemRegistry().getSystemScratchPad().removeChild(child); + } + } + } + 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.model.ISystemRemoteChangeEvent + */ + public void systemRemoteResourceChanged(ISystemRemoteChangeEvent event) + { + int eventType = event.getEventType(); + Object remoteResourceParent = event.getResourceParent(); + Object remoteResource = event.getResource(); + boolean originatedHere = (event.getOriginatingViewer() == this); + Vector remoteResourceNames = null; + if (remoteResource instanceof Vector) + { + remoteResourceNames = (Vector) remoteResource; + remoteResource = remoteResourceNames.elementAt(0); + } + String remoteResourceParentName = getRemoteResourceAbsoluteName(remoteResourceParent); + String remoteResourceName = getRemoteResourceAbsoluteName(remoteResource); + if (remoteResourceName == null) + return; + SystemScratchpadViewProvider provider = (SystemScratchpadViewProvider) 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 : + { + internalRefresh(remoteResourceParent); + } + break; + + // -------------------------- + // REMOTE RESOURCE DELETED... + // -------------------------- + case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED : + { + if (remoteResourceParent != null) + { + internalRefresh(remoteResourceParent); + } + else + { + remove(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 : + { + String oldName = event.getOldName(); + Object child = event.getResource(); + + if (provider != null) + { + Widget widget = findItem(child); + if (widget != null) + { + widget.setData(child); + updateItem(widget, child); + 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 + { + ISystemRemoteElementAdapter ra = getRemoteAdapter(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) + { + + IStructuredSelection sel = (IStructuredSelection)event.getSelection(); + Object firstSelection = sel.getFirstElement(); + if (firstSelection == null) + return; + + _selectionFlagsUpdated = false; + ISystemViewElementAdapter adapter = getAdapter(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); + SystemPlugin.getTheSystemRegistry().removeSystemResourceChangeListener(this); + SystemPlugin.getTheSystemRegistry().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; + } + /** + * Rather than pre-defining this common action we wait until it is first needed, + * for performance reasons. + */ + protected SystemRemotePropertiesAction getRemotePropertyDialogAction() + { + if (_remotePropertyDialogAction == null) + { + _remotePropertyDialogAction = new SystemRemotePropertiesAction(getShell()); + } + _remotePropertyDialogAction.setSelection(getSelection()); + return _remotePropertyDialogAction; + } + /** + * 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 Systems 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 Systems 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 = SystemPlugin.getDefault().getSystemRegistry(); + 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 = getAdapter(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(), SystemPlugin.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.fireEvent(new com.ibm.etools.systems.model.impl.SystemResourceChangeEvent(deleted, ISystemResourceChangeEvent.EVENT_DELETE_REMOTE_MANY, null)); + sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED, deletedVector, null, null, null, this); + else + sr.fireEvent(new org.eclipse.rse.model.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 = SystemPlugin.getDefault().getSystemRegistry(); + 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 = getAdapter(element); + Object parentElement = getParentForContent(element); + + remoteAdapter = getRemoteAdapter(element); + if (remoteAdapter != null) + oldFullName = remoteAdapter.getAbsoluteName(element); + // pre-rename + ok = adapter.doRename(getShell(), element, newNames[nameIdx++]); + if (ok) + { + if (remoteAdapter != null) { + sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED, element, parentElement, remoteAdapter.getSubSystem(element), oldFullName, this); + } + else { + sr.fireEvent(new org.eclipse.rse.model.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(), SystemPlugin.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) 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 = getAdapter(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()); + } + + // 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); + + if (!_selectionIsRemoteObject) // is not a remote object + { + PropertyDialogAction pdAction = getPropertyDialogAction(); + if (pdAction.isApplicableForSelection()) + { + + menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); + } + // OPEN IN NEW PERSPECTIVE ACTION... if (fromSystemViewPart && showOpenViewActions()) + { + //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); + + } + } + else // is a remote object + { + //Object firstSelection = selection.getFirstElement(); + //ISystemRemoteElementAdapter remoteAdapter = getRemoteAdapter(firstSelection); + //logMyDebugMessage(this.getClass().getName(), ": there is a remote adapter"); + SystemRemotePropertiesAction pdAction = getRemotePropertyDialogAction(); + if (pdAction.isApplicableForSelection()) + menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); + //else + //logMyDebugMessage(this.getClass().getName(), ": but it is not applicable for selection"); + // -------------------------------------------------------------------------------------------------------------------- + // look for and add any popup menu actions registered via our org.eclipse.rse.core.popupMenus extension point... + // -------------------------------------------------------------------------------------------------------------------- + if (_workbenchPart != null) + { + SystemPopupMenuActionContributorManager.getManager().contributeObjectActions(_workbenchPart, ourMenu, this, null); + } + } + + } + } + + + /** + * Decides whether to even show the refresh menu item. + * Assumes scanSelections() has already been called + */ + protected boolean showRefresh() + { + 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. + *

    + * 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; idxtrue if the container must be a direct ancestor of the child item, + * false otherwise. + * @return true if there is an ancestry relationship, false 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. + *

    + * 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 = getAdapter(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); + } + + } + + + 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(); + if (showDelete() && canDelete()) + { + SystemCommonDeleteAction dltAction = (SystemCommonDeleteAction) getDeleteAction(); + dltAction.setShell(getShell()); + dltAction.setSelection(getSelection()); + dltAction.setViewer(this); + dltAction.run(); + } + } + } + + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/SystemScratchpadViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/SystemScratchpadViewPart.java new file mode 100644 index 00000000000..7617ff58e8a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/SystemScratchpadViewPart.java @@ -0,0 +1,388 @@ +/******************************************************************************** + * 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.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.SelectionChangedEvent; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.ISystemResourceChangeEvent; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.ISystemResourceChangeListener; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.SystemWidgetHelpers; +import org.eclipse.rse.ui.actions.SystemCommonDeleteAction; +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.messages.ISystemMessageLine; +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, ISystemMessageLine, IRSEViewPart +{ + + + private SystemScratchpadView _viewer; + + // common actions + private SystemCopyToClipboardAction _copyAction; + private SystemPasteFromClipboardAction _pasteAction; + private SystemCommonDeleteAction _deleteAction; + private ClearAction _clearAction; + private ClearSelectedAction _clearSelectionAction; + + // 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 + + 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); + _viewer.setWorkbenchPart(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 = SystemPlugin.getTheSystemRegistry(); + Clipboard clipboard = registry.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); + + editorActionHandler.setCopyAction(_copyAction); + editorActionHandler.setPasteAction(_pasteAction); + editorActionHandler.setDeleteAction(_deleteAction); + //editorActionHandler.setSelectAllAction(new SelectAllAction()); + + registry.addSystemResourceChangeListener(this); + + SystemWidgetHelpers.setHelp(_viewer.getControl(), SystemPlugin.HELPPREFIX + "scrp0000"); + + setInput(registry.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); + + SystemPlugin.getTheSystemRegistry().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) + { + if (adapter.hasChildren(element)) + { + setInput((IAdaptable) element); + } + else + { + alreadyHandled = adapter.handleDoubleClick(element); + } + } + } + + public void updateActionStates() + { + if (_clearAction == null) + fillLocalToolBar(); + + _clearAction.checkEnabledState(); + _clearSelectionAction.checkEnabledState(); + } + + public void fillLocalToolBar() + { + //if (_refreshAction == null) + if (_clearAction == null) + { + // refresh action + //_refreshAction = new RefreshAction(); + _clearAction = new ClearAction(_viewer); + _clearSelectionAction = new ClearSelectedAction(_viewer); + + } + + updateActionStates(); + + IActionBars actionBars = getViewSite().getActionBars(); + IToolBarManager toolBarManager = actionBars.getToolBarManager(); + IMenuManager menuMgr = actionBars.getMenuManager(); + + SystemRefreshAction refreshAction = new SystemRefreshAction(getShell()); + actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), refreshAction); + _statusLine = actionBars.getStatusLineManager(); + + addToolBarItems(toolBarManager); + addToolBarMenuItems(menuMgr); + } + + private void addToolBarMenuItems(IMenuManager menuManager) + { + menuManager.removeAll(); + menuManager.add(_clearSelectionAction); + menuManager.add(new Separator()); + menuManager.add(_clearAction); + } + + private void addToolBarItems(IToolBarManager toolBarManager) + { + toolBarManager.removeAll(); + toolBarManager.add(_clearSelectionAction); + toolBarManager.add(new Separator()); + 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 child = event.getSource(); + Object parent = event.getParent(); + Object input = _viewer.getInput(); + + 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 null is returned. + */ + public String getErrorMessage() + { + return _errorMessage; + } + /** + * Get the currently displayed message. + * @return The message. If no message is displayed null 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 null 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/ui/view/scratchpad/SystemScratchpadViewProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/SystemScratchpadViewProvider.java new file mode 100644 index 00000000000..33861297529 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/SystemScratchpadViewProvider.java @@ -0,0 +1,181 @@ +/******************************************************************************** + * 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.scratchpad; + +import java.util.Hashtable; +import java.util.Map; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.util.ListenerList; +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.ISystemViewElementAdapter; +import org.eclipse.swt.graphics.Image; + + +/** + * 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) + { + return getAdapterFor(object).hasChildren(object); + + } + + public Object getElementAt(Object object, int i) + { + + return null; + } + + protected ISystemViewElementAdapter getAdapterFor(Object object) + { + if (object instanceof IAdaptable) + { + IAdaptable adapt = (IAdaptable) object; + if (adapt != null) + { + ISystemViewElementAdapter result = (ISystemViewElementAdapter) adapt.getAdapter(ISystemViewElementAdapter.class); + result.setPropertySourceInput(object); + result.setViewer(_view); + + return result; + } + } + + return null; + } + + public Object[] getElements(Object object) + { + Object[] results = null; + + if (object instanceof IAdaptable) + { + ISystemViewElementAdapter adapter = getAdapterFor(object); + if (adapter != null && adapter.hasChildren(object)) + { + results = adapter.getChildren(object); + } + } + if (results == null) + { + return new Object[0]; + } + + return results; + } + + public String getText(Object object) + { + return getAdapterFor(object).getText(object); + } + + 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 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/ui/view/search/SystemSearchClearHistoryAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchClearHistoryAction.java new file mode 100644 index 00000000000..ec9cd255002 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchClearHistoryAction.java @@ -0,0 +1,51 @@ +/******************************************************************************** + * 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.search; + +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +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, + SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SEARCH_CLEAR_HISTORY_ID), shell); + + this.searchView = searchView; + } + + /** + * @see org.eclipse.jface.action.IAction#run() + */ + public void run() { + searchView.deleteAllPages(); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchCopyToClipboardAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchCopyToClipboardAction.java new file mode 100644 index 00000000000..0089fc6f55c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchCopyToClipboardAction.java @@ -0,0 +1,56 @@ +/******************************************************************************** + * 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.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 com.ibm.etools.systems.files.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); + } + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchHistoryAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchHistoryAction.java new file mode 100644 index 00000000000..e93c7167575 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchHistoryAction.java @@ -0,0 +1,61 @@ +/******************************************************************************** + * 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.view.search; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.resource.ImageDescriptor; + +/** + * 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; + } + + /** + * @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); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchRemoveAllMatchesAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchRemoveAllMatchesAction.java new file mode 100644 index 00000000000..818e147290d --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchRemoveAllMatchesAction.java @@ -0,0 +1,52 @@ +/******************************************************************************** + * 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.search; + +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +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, + SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SEARCH_REMOVE_ALL_MATCHES_ID), + shell); + + this.searchView = searchView; + } + + /** + * @see org.eclipse.jface.action.IAction#run() + */ + public void run() { + searchView.deleteCurrentPage(); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchRemoveSelectedMatchesAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchRemoveSelectedMatchesAction.java new file mode 100644 index 00000000000..bb9808446cc --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchRemoveSelectedMatchesAction.java @@ -0,0 +1,52 @@ +/******************************************************************************** + * 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.search; + +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +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, + SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SEARCH_REMOVE_SELECTED_MATCHES_ID), + shell); + + this.searchView = searchView; + } + + /** + * @see org.eclipse.jface.action.IAction#run() + */ + public void run() { + searchView.deleteSelected(); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchTableView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchTableView.java new file mode 100644 index 00000000000..b47f79ed371 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchTableView.java @@ -0,0 +1,374 @@ +/******************************************************************************** + * 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.search; + +import java.util.Vector; + +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.model.ISystemRemoteChangeEvent; +import org.eclipse.rse.model.ISystemRemoteChangeEvents; +import org.eclipse.rse.model.ISystemResourceChangeEvent; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.services.search.IHostSearchResultConfiguration; +import org.eclipse.rse.services.search.IHostSearchResultSet; +import org.eclipse.rse.ui.messages.ISystemMessageLine; +import org.eclipse.rse.ui.view.ISystemViewElementAdapter; +import org.eclipse.rse.ui.view.SystemDecoratingLabelProvider; +import org.eclipse.rse.ui.view.SystemTableTreeView; +import org.eclipse.rse.ui.view.SystemTableTreeViewProvider; +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; + + setLabelProvider(new SystemDecoratingLabelProvider(_provider, SystemPlugin.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(); + Vector remoteResourceNames = null; + + if (remoteResource instanceof Vector) + { + remoteResourceNames = (Vector) remoteResource; + remoteResource = remoteResourceNames.elementAt(0); + } + else + { + remoteResourceNames = new Vector(); + remoteResourceNames.add(remoteResource); + } + + for (int d = 0; d < remoteResourceNames.size(); d++) + { + Object dchild = remoteResourceNames.get(d); + + ISystemViewElementAdapter dadapt = getAdapter(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 = getAdapter(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); + } + } + } + } + } + } + + } + 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.getParentSubSystemFactory().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 getAdapter(element).getParent(element); + } + + + /** + * Does nothing. + * @see org.eclipse.rse.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/ui/view/search/SystemSearchTableViewProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchTableViewProvider.java new file mode 100644 index 00000000000..992e7f45987 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchTableViewProvider.java @@ -0,0 +1,45 @@ +/******************************************************************************** + * 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.search; + +import org.eclipse.rse.ui.view.SystemTableTreeViewProvider; +import org.eclipse.rse.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; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchUI.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchUI.java new file mode 100644 index 00000000000..d46fcd775bb --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchUI.java @@ -0,0 +1,73 @@ +/******************************************************************************** + * 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.view.search; + +import org.eclipse.rse.core.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"; + + /** + * 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 true if successful, 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); + } + + return searchView; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewContentProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewContentProvider.java new file mode 100644 index 00000000000..a2bb2dbdd0b --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewContentProvider.java @@ -0,0 +1,183 @@ +/******************************************************************************** + * 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.view.search; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.rse.core.SystemAdapterHelpers; +import org.eclipse.rse.ui.view.ISystemViewElementAdapter; +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 = getAdapter(parentElement); + + if (adapter == null) { + return null; + } + else { + return adapter.getChildren(parentElement); + } + } + + 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 = getAdapter(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 = getAdapter(element); + + if (adapter == null) { + return false; + } + else { + return adapter.hasChildren(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 = getAdapter(inputElement); + + if (adapter == null) { + return null; + } + else { + return adapter.getChildren(inputElement); + } + } + + 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 = getAdapter(newInput); + + if (adapter != null) { + viewer.refresh(); + } + } + } + + /** + * Get the adapter for the given object. + * @param the object + * @return the adapter + */ + public ISystemViewElementAdapter getAdapter(Object element) + { + return SystemAdapterHelpers.getAdapter(element); + } + /** + * Set the ViewPart of this provider + * @parm 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/ui/view/search/SystemSearchViewLabelProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewLabelProvider.java new file mode 100644 index 00000000000..a8eee8db1c5 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewLabelProvider.java @@ -0,0 +1,94 @@ +/******************************************************************************** + * 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.view.search; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.rse.core.SystemAdapterHelpers; +import org.eclipse.rse.ui.view.ISystemViewElementAdapter; +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 = getAdapter(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 = getAdapter(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 getAdapter(Object element) + { + return SystemAdapterHelpers.getAdapter(element); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewPart.java new file mode 100644 index 00000000000..7823e0b1c26 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewPart.java @@ -0,0 +1,1282 @@ +/******************************************************************************** + * 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.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.SystemAdapterHelpers; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.ISystemResourceChangeEvent; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.ISystemResourceChangeListener; +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.SystemMenuManager; +import org.eclipse.rse.ui.SystemResources; +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.view.IRSEViewPart; +import org.eclipse.rse.ui.view.ISystemRemoveElementAdapter; +import org.eclipse.rse.ui.view.ISystemViewElementAdapter; +import org.eclipse.rse.ui.view.SystemTableTreeViewProvider; +import org.eclipse.rse.ui.view.SystemView; +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, + 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"; + private static final String MENU_CLEAR_HISTORY_GROUP_NAME = "clearHistoryGroup"; + + 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 = getAdapter(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, SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_STOP_ID)); + setToolTipText(SystemResources.ACTION_CANCEL_SEARCH_TOOLTIP); + } + + 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 + SystemPlugin.getTheSystemRegistry().addSystemResourceChangeListener(this); + + // set help + SystemWidgetHelpers.setHelp(pageBook, SystemPlugin.HELPPREFIX + "srch0000"); + } + + 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); + + // register global edit actions + ISystemRegistry registry = SystemPlugin.getTheSystemRegistry(); + + // clipboard + Clipboard clipboard = registry.getSystemClipboard(); + + Shell shell = registry.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 true if remove selected action should be enabled, false 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 null if there is currently no input. + * @return true if remove all action should be enabled, false otherwise. + */ + private boolean isRemoveAllEnabled(IAdaptable input) { + + if (input == null) { + return false; + } + + ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)getAdapter(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 the search result set + */ + public void addSearchResult(IAdaptable resultSet) { + + // if the correct adapter is not registered, then return + ISystemViewElementAdapter adapter = getAdapter(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"); + 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(), SystemPlugin.HELPPREFIX + "srch0000"); + + // 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, SystemPlugin.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, (IHostSearchResultSet)resultSet, this); + viewer.setWorkbenchPart(this); + + getSite().registerContextMenu(viewer.getContextMenuManager(), viewer); + return viewer; + } + + /** + * @see org.eclipse.ui.IWorkbenchPart#dispose() + */ + public void dispose() { + + // remove as resource change listener + SystemPlugin.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 = getAdapter(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 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 = getAdapter(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 true if the selection has been deleted, false 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 = getAdapter(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 true if all pages have been deleted, false 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(""); + + 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 true if the current page has been deleted, false 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 = getAdapter(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 = 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 the object the object for which I want the adapter. + * @return the adapter for the object. + */ + public ISystemViewElementAdapter getAdapter(Object element) { + return SystemAdapterHelpers.getAdapter(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 = getAdapter(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 = getAdapter(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. + *

    + * 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 && (idx0) && (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 = getAdapter(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 null 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 null is returned. + */ + public String getErrorMessage() + { + return _errorMessage; + } + /** + * Get the currently displayed message. + * @return The message. If no message is displayed null 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 null 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/ui/view/team/SystemResourceAdaptableProfile.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemResourceAdaptableProfile.java new file mode 100644 index 00000000000..9f7d94f740d --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemResourceAdaptableProfile.java @@ -0,0 +1,35 @@ +/******************************************************************************** + * 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.team; + +import org.eclipse.rse.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(); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamView.java new file mode 100644 index 00000000000..27e7fcd7e44 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamView.java @@ -0,0 +1,267 @@ +/******************************************************************************** + * 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.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.SystemPlugin; +import org.eclipse.rse.model.ISystemResourceChangeEvent; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.ISystemResourceChangeListener; +import org.eclipse.rse.ui.SystemWidgetHelpers; +import org.eclipse.rse.ui.view.ISystemSelectAllTarget; +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 +{ + private SystemTeamViewPart teamViewPart; + + /** + * @param parent + */ + public SystemTeamView(Composite parent, SystemTeamViewPart teamViewPart) + { + super(parent); + this.teamViewPart = teamViewPart; + SystemWidgetHelpers.setHelp(getTree(), SystemPlugin.HELPPREFIX+"teamview"); + } + + /** + * @param parent + * @param style + */ + public SystemTeamView(Composite parent, int style, SystemTeamViewPart teamViewPart) + { + super(parent, style); + this.teamViewPart = teamViewPart; + SystemWidgetHelpers.setHelp(getTree(), SystemPlugin.HELPPREFIX+"teamview"); + } + + /** + * @param tree + */ + public SystemTeamView(Tree tree, SystemTeamViewPart teamViewPart) + { + super(tree); + this.teamViewPart = teamViewPart; + SystemWidgetHelpers.setHelp(getTree(), SystemPlugin.HELPPREFIX+"teamview"); + } + + /** + * 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 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; idx0)) + { + for (int idx=0; idx0)) + { + for (int idx=0; idx + * Called by common rename and delete actions. + */ + public String getName(Object element) + { + SystemTeamViewCategoryNode category = (SystemTeamViewCategoryNode)element; + return category.getLabel(); + } + + /** + * Return the absolute name, versus just display name, of this object + */ + public String getAbsoluteName(Object element) + { + SystemTeamViewCategoryNode category = (SystemTeamViewCategoryNode)element; + return category.getProfile() + "." + category.getLabel(); + } + + /** + * 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(); + } + + /** + * 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(Object element) + { + SystemTeamViewCategoryNode category = (SystemTeamViewCategoryNode)element; + ISystemProfile profile = category.getProfile(); + String categoryType = category.getMementoHandle(); + if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_CONNECTIONS)) + { + return profile.getHosts(); + } + else + return createSubSystemFactoryNodes(profile, category); + } + /** + * Create subsystem factory child nodes for expanded category node + */ + private SystemTeamViewSubSystemFactoryNode[] createSubSystemFactoryNodes(ISystemProfile profile, SystemTeamViewCategoryNode category) + { + SystemTeamViewSubSystemFactoryNode[] nodes = null; + + ISystemRegistry sr = SystemPlugin.getTheSystemRegistry(); + ISubSystemConfiguration[] factories = sr.getSubSystemConfigurations(); + if (factories != null) + { + Vector v = new Vector(); + String categoryType = category.getMementoHandle(); + for (int idx=0; idx 0); + } + else if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_USERACTIONS)) + { + createNode = ssf.supportsUserDefinedActions(); // && profile.getUserActions(ssf).length > 0; + } + else if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_COMPILECMDS)) + { + createNode = ssf.supportsCompileActions(); // && profile.getCompileCommandTypes(ssf).length > 0; + } + else if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_TARGETS)) + { + createNode = ssf.supportsTargets(); // && profile.getTargets(ssf).length > 0; + } + if (createNode) + v.addElement(new SystemTeamViewSubSystemFactoryNode(profile, category, factories[idx])); + } + nodes = new SystemTeamViewSubSystemFactoryNode[v.size()]; + for (int idx=0; idx 0); + else + { + ISystemViewElementAdapter adapter = getSystemViewAdapter(element); + if (adapter != null) + children = adapter.hasChildren(element); + else + children = super.hasChildren(element); + } + /* debug info + String name = element.getClass().getName(); + if (element instanceof SystemTeamViewSubSystemFactoryNode) + { + SystemTeamViewSubSystemFactoryNode ssfNode = (SystemTeamViewSubSystemFactoryNode)element; + name = ssfNode.getParentCategory().getLabel() + "." + ssfNode.getSubSystemFactory().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.
    + * 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"); + 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) + // SystemPlugin.logWarning("ADAPTER IS NULL FOR ELEMENT OF TYPE: " + o.getClass().getName()); + if ((adapter!=null) && (viewer != null)) + { + Shell shell = null; + if (viewer instanceof ISystemResourceChangeListener) + shell = ((ISystemResourceChangeListener)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"); + return adapter; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewInputProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewInputProvider.java new file mode 100644 index 00000000000..105b6a32cad --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewInputProvider.java @@ -0,0 +1,169 @@ +/******************************************************************************** + * 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.team; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.rse.core.SystemResourceManager; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.ui.view.ISystemViewInputProvider; +import org.eclipse.swt.widgets.Shell; + + +/** + * 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 Object[] roots = new Object[1]; + private Shell shell; + 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() + { + if (roots[0] == null) + roots[0] = SystemResourceManager.getRemoteSystemsProject(); + 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(com.ibm.etools.systems.model.SystemConnection) + */ + public Object[] getConnectionChildren(IHost selectedConnection) + { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#hasConnectionChildren(com.ibm.etools.systems.model.SystemConnection) + */ + public boolean hasConnectionChildren(IHost selectedConnection) + { + // TODO Auto-generated method stub + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#setShell(org.eclipse.swt.widgets.Shell) + */ + public void setShell(Shell shell) + { + this.shell = shell; + } + + /* (non-Javadoc) + * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#getShell() + */ + public Shell getShell() + { + return shell; + } + + /* (non-Javadoc) + * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#setViewer(org.eclipse.jface.viewers.Viewer) + */ + public void setViewer(Viewer viewer) + { + this.viewer = viewer; + } + + /* (non-Javadoc) + * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#getViewer() + */ + public Viewer getViewer() + { + return viewer; + } + + /* (non-Javadoc) + * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#showActionBar() + */ + public boolean showActionBar() + { + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#showButtonBar() + */ + public boolean showButtonBar() + { + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#showActions() + */ + public boolean showActions() + { + return false; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewLabelProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewLabelProvider.java new file mode 100644 index 00000000000..57e27c3695e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewLabelProvider.java @@ -0,0 +1,212 @@ +/******************************************************************************** + * 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.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.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.model.ISystemResourceChangeListener; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.view.ISystemViewElementAdapter; +import org.eclipse.rse.ui.view.ISystemViewInputProvider; +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."; + + // 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 (SystemPlugin.getTheSystemRegistry().getSystemProfileManager().isSystemProfileActive(profile.getName())) + return SystemPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_PROFILE_ACTIVE_ID); + else + return SystemPlugin.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((IProject)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.
    + */ + 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"); + 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) + // SystemPlugin.logWarning("ADAPTER IS NULL FOR ELEMENT OF TYPE: " + o.getClass().getName()); + if ((adapter!=null) && (viewer != null)) + { + Shell shell = null; + if (viewer instanceof ISystemResourceChangeListener) + shell = ((ISystemResourceChangeListener)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"); + return adapter; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewMakeActiveProfileAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewMakeActiveProfileAction.java new file mode 100644 index 00000000000..004278ce8bb --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewMakeActiveProfileAction.java @@ -0,0 +1,91 @@ +/******************************************************************************** + * 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.team; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.internal.model.SystemProfileManager; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.model.ISystemProfileManager; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +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, + SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MAKEPROFILEACTIVE_ID), + parent); + allowOnMultipleSelection(true); + setContextMenuGroup(ISystemContextMenuConstants.GROUP_CHANGE); + setHelp(SystemPlugin.HELPPREFIX+"ActionMakeActive"); + } + + /** + * 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) + { + Object currsel = getFirstSelection(); + if (!(currsel instanceof ISystemProfile)) + return false; + ISystemProfile profile = (ISystemProfile)currsel; + ISystemProfileManager mgr = SystemProfileManager.getSystemProfileManager(); + boolean allActive = true; + while (profile != null) + { + if (!mgr.isSystemProfileActive(profile.getName())) + allActive = false; + currsel = getNextSelection(); + if ((currsel!=null) && !(currsel instanceof ISystemProfile)) + return false; + profile = (ISystemProfile)currsel; + } + return !allActive; + } + + /** + * 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 = SystemPlugin.getTheSystemRegistry(); + ISystemProfile profile = (ISystemProfile)getFirstSelection(); + while (profile != null) + { + sr.setSystemProfileActive(profile, true); + profile = (ISystemProfile)getNextSelection(); + } + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewMakeInActiveProfileAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewMakeInActiveProfileAction.java new file mode 100644 index 00000000000..163fb19b1ec --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewMakeInActiveProfileAction.java @@ -0,0 +1,93 @@ +/******************************************************************************** + * 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.team; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.internal.model.SystemProfileManager; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.model.ISystemProfileManager; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +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, + SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MAKEPROFILEINACTIVE_ID), + parent); + allowOnMultipleSelection(true); + setContextMenuGroup(ISystemContextMenuConstants.GROUP_CHANGE); + setHelp(SystemPlugin.HELPPREFIX+"ActionMakeInactive"); + } + + /** + * 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) + { + Object currsel = getFirstSelection(); + if (!(currsel instanceof ISystemProfile)) + return false; + ISystemProfile profile = (ISystemProfile)currsel; + ISystemProfileManager mgr = SystemProfileManager.getSystemProfileManager(); + boolean allInActive = true; + while (profile != null) + { + if (mgr.isSystemProfileActive(profile.getName())) + allInActive = false; + currsel = getNextSelection(); + if ((currsel!=null) && !(currsel instanceof ISystemProfile)) + return false; + profile = (ISystemProfile)currsel; + } + return !allInActive; + } + + /** + * 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() + { + // TODO: test if attempting to disable all profiles, and issue an error + // that at least one needs to be active. Or, at least a warning. + ISystemRegistry sr = SystemPlugin.getTheSystemRegistry(); + ISystemProfile profile = (ISystemProfile)getFirstSelection(); + while (profile != null) + { + sr.setSystemProfileActive(profile, false); + profile = (ISystemProfile)getNextSelection(); + } + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewPart.java new file mode 100644 index 00000000000..fc1b1a4e85e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewPart.java @@ -0,0 +1,1560 @@ +/******************************************************************************** + * 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.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.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.IStatusLineManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.util.ListenerList; +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.OpenEvent; +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.window.SameShellProvider; +import org.eclipse.rse.core.SystemAdapterHelpers; +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.SystemResourceManager; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemModelChangeEvent; +import org.eclipse.rse.model.ISystemModelChangeEvents; +import org.eclipse.rse.model.ISystemModelChangeListener; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.model.ISystemProfileManager; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.SystemStartHere; +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.SystemMenuManager; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.actions.ISystemAction; +import org.eclipse.rse.ui.actions.SystemCollapseAllAction; +import org.eclipse.rse.ui.actions.SystemCommonDeleteAction; +import org.eclipse.rse.ui.actions.SystemCommonSelectAllAction; +import org.eclipse.rse.ui.actions.SystemNewProfileAction; +import org.eclipse.rse.ui.actions.SystemSubMenuManager; +import org.eclipse.rse.ui.actions.SystemTeamReloadAction; +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.ISystemMementoConstants; +import org.eclipse.rse.ui.view.ISystemViewElementAdapter; +import org.eclipse.rse.ui.view.SystemViewMenuListener; +import org.eclipse.rse.ui.view.SystemViewPart; +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.IPageListener; +import org.eclipse.ui.IViewSite; +import org.eclipse.ui.IWorkbenchPage; +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, IMenuListener, IRSEViewPart +{ + + private boolean menuListenerAdded; + public static final String ID = "org.eclipse.rse.ui.view.teamView"; + + 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(6); + + private boolean privateProfileStillExists = false; + + // 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; + + protected ISystemViewElementAdapter profileAdapter = SystemPlugin.getDefault().getSystemViewAdapterFactory().getProfileAdapter(); + + // remember-state variables... + private IMemento fMemento; + // state... + static final String TAG_RELEASE= "release"; + static final String TAG_SELECTION= "selection"; + static final String TAG_EXPANDED_TO= "expandedTo"; + static final String TAG_EXPANDED= "expanded"; + static final String TAG_ELEMENT= "element"; + static final String TAG_PATH= "path"; + static final String TAG_INPUT= "svInput"; + static final String TAG_VERTICAL_POSITION= "verticalPosition"; + static final String TAG_HORIZONTAL_POSITION= "horizontalPosition"; + static final String MEMENTO_DELIM = "///"; + + /** + * 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); + getSite().registerContextMenu(menuMgr, treeViewer); + // 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(this); + /* + 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); + + SystemPlugin.getTheSystemRegistry().addSystemModelChangeListener(this); + + treeViewer.setAutoExpandLevel(2); // dang, it doesn't work! + + // ---------------------- + // Restore previous state + // ---------------------- + if (fMemento != null) + restoreState(fMemento); + fMemento= null; + } + + /** + * Called when the context menu is about to open. + * From IMenuListener interface + * 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, (ISystemMessageLine)this); + m.addMenuListener(ml); + } + } + } + //System.out.println("Inside menuAboutToShow: menu null? "+( ((MenuManager)menu).getMenu()==null)); + } + + // ------------------------------------------- + // 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. + *

    + * 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 clicks in viewer. It is responsible for expanding + * and collapsing of folders. + */ + private void handleDoubleClick(DoubleClickEvent event) + { + /* + IStructuredSelection rseSSel = + (IStructuredSelection) event.getSelection(); + Object rseObject = rseSSel.getFirstElement(); + if (treeViewer.isExpandable(rseObject)) + { + treeViewer.setExpandedState( + rseObject, + !treeViewer.getExpandedState(rseObject)); + } + */ + } + + /** + * Handles an open event from the viewer. + * Opens an editor on the selected file. + */ + protected void handleOpen(OpenEvent event) + { + } + + /** + * Handles key events in viewer.
    + * 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.
    + * 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(); + 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.
    + */ + public void selectReveal(ISelection selection) + { + if (!(selection instanceof StructuredSelection)) + return; + StructuredSelection ssel = (StructuredSelection)selection; + java.util.List test = ssel.toList(); + 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); + + privateProfileStillExists = (SystemStartHere.getSystemProfileManager().getDefaultPrivateSystemProfile() != null); + + // Populate with our stuff... + IStructuredSelection selection = getStructuredSelection(); + Object firstSelection = selection.getFirstElement(); + if (firstSelection instanceof IProject) + { + // Scrub unrelated menu items + scrubOtherContributions(menu); + createStandardGroups(menu); + if (selection.size() == 1) + fillProjectContextMenu(ourMenu, selection); + } + else + { + createStandardGroups(menu); + ISystemViewElementAdapter adapter = SystemAdapterHelpers.getAdapter(firstSelection, treeViewer); + if (adapter != null) + { + if ((firstSelection instanceof SystemTeamViewSubSystemFactoryNode) || + // 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); + } + } + } + // 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() ); + try{ + item.setInputs(getShell(), getViewer(), selection); + } catch (Exception e) + { + SystemBasePlugin.logError("Error configuring action " + item.getClass().getName(),e); + System.err.println("Error configuring action " + item.getClass().getName()); + } + } + 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 menu + */ + 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.getAdapter(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); + System.out.println("Error configuring action " + item.getClass().getName()); + } + } + 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) + { + 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 New Profile actoin + */ + 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(SystemPlugin.HELPPREFIX+"actndlpr"); + deleteAction.setDialogHelp(SystemPlugin.HELPPREFIX+"ddltprfl"); + 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) + { + IContributionItem items[] = menuMgr.getItems(); + + if (items != null) + { + //System.out.println("# existing menu items: "+items.length); + for (int idx=0; idx 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.getAdapter(o, treeViewer); + String handle = null; + if (adapter != null) + handle = adapter.getMementoHandleKey(o); + else if (o instanceof IResource) + { + if (o instanceof IProject) + handle = "Project"; + else if (o instanceof IFolder) + handle = "Folder"; + else + handle = "File"; + } + else if (o instanceof ISystemProfile) + handle = "Profile"; + 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.getAdapter(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 = SystemPlugin.getTheSystemRegistry(); + ISystemProfile profile = null; + IProject project = null; + SystemTeamViewCategoryNode category = null; + String elementType = ""; + + //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; idxnull
    is returned. + */ + public String getErrorMessage() + { + return errorMessage; + } + /** + * Get the currently displayed message. + * @return The message. If no message is displayed null 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 null 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/ui/view/team/SystemTeamViewProfileAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewProfileAdapter.java new file mode 100644 index 00000000000..4e5d91ef8bf --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewProfileAdapter.java @@ -0,0 +1,412 @@ +/******************************************************************************** + * 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.team; +import java.util.Hashtable; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.ISystemUserIdConstants; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.SystemResourceManager; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.model.SystemStartHere; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemMenuManager; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.actions.SystemCommonDeleteAction; +import org.eclipse.rse.ui.actions.SystemCommonRenameAction; +import org.eclipse.rse.ui.actions.SystemProfileNameCopyAction; +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.ISystemMementoConstants; +import org.eclipse.rse.ui.view.ISystemPropertyConstants; +import org.eclipse.rse.ui.view.ISystemViewElementAdapter; +import org.eclipse.rse.ui.view.SystemViewResources; +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 + implements ISystemViewElementAdapter, ISystemUserIdConstants +{ + + private boolean actionsCreated = false; + private Hashtable categoriesByProfile = new Hashtable(); + // context menu actions for profiles... + protected SystemTeamViewActiveProfileAction activeProfileAction; + 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(); + + boolean privateProfileStillExists = (SystemStartHere.getSystemProfileManager().getDefaultPrivateSystemProfile() != null); + copyProfileAction.setProfile((ISystemProfile)selection.getFirstElement()); + + if (activeProfileAction != null) + { + activeProfileAction.setEnabled(!privateProfileStillExists); + menu.add(ISystemContextMenuConstants.GROUP_CHANGE,activeProfileAction); + } + else + { + 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() + { + // activate profile action... + // TODO: Delete the activeProfileAction logic when we have another mri rev, and can use the new actions. + if (SystemResources.ACTION_PROFILE_MAKEACTIVE_LABEL.equals("test")) + activeProfileAction = new SystemTeamViewActiveProfileAction(getShell()); + else + { + makeProfileActiveAction = new SystemTeamViewMakeActiveProfileAction(getShell()); + makeProfileInactiveAction = new SystemTeamViewMakeInActiveProfileAction(getShell()); + } + + copyProfileAction = new SystemProfileNameCopyAction(getShell()); + + deleteAction = new SystemCommonDeleteAction(getShell(),getTeamViewPart()); + deleteAction.setHelp(SystemPlugin.HELPPREFIX+"actndlpr"); + deleteAction.setDialogHelp(SystemPlugin.HELPPREFIX+"ddltprfl"); + deleteAction.setPromptLabel(SystemResources.RESID_DELETE_PROFILES_PROMPT); + + renameAction = new SystemCommonRenameAction(getShell(),getTeamViewPart()); + renameAction.setHelp(SystemPlugin.HELPPREFIX+"actnrnpr"); + renameAction.setDialogSingleSelectionHelp(SystemPlugin.HELPPREFIX+"drnsprfl"); + renameAction.setDialogMultiSelectionHelp(SystemPlugin.HELPPREFIX+"drnmprfl"); + renameAction.setSingleSelectPromptLabel(SystemResources.RESID_SIMPLE_RENAME_PROFILE_PROMPT_LABEL, + SystemResources.RESID_SIMPLE_RENAME_PROFILE_PROMPT_TIP); + renameAction.setMultiSelectVerbage(SystemResources.RESID_MULTI_RENAME_PROFILE_VERBAGE); + + 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 (SystemPlugin.getTheSystemRegistry().getSystemProfileManager().isSystemProfileActive(profile.getName())) + return SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_PROFILE_ACTIVE_ID); + else + return SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_PROFILE_ID); + } + /** + * Return the team view part + */ + private SystemTeamViewPart getTeamViewPart() + { + SystemTeamView viewer = (SystemTeamView)getViewer(); + //System.out.println("Team view part set? " + (viewer != null)); + 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)}. + *

    + * Called by common rename and delete actions. + */ + public String getName(Object element) + { + return ((ISystemProfile)element).getName(); + } + + /** + * Return the absolute name, versus just display name, of this 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 = SystemPlugin.getTheSystemRegistry().getSystemProfileManager().isSystemProfileActive(profile.getName()); + return getType(element) + ": " + profile.getName() + ", " + + SystemViewResources.RESID_PROPERTY_PROFILESTATUS_LABEL + ": " + + (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(); + } + + /** + * Return the children of this profile. + */ + public Object[] getChildren(Object element) + { + 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[4]; //5]; + for (int idx=0; idxDelete menu item will be enabled. + */ + public boolean canDelete(Object element) + { + boolean ok = true; + if (!(element instanceof ISystemProfile)) + { + ok = false; + //System.out.println("selection: "+currObj.getClass().getName()); + } + return ok; + } + /** + * Perform the delete action. + */ + public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) throws Exception + { + boolean ok = true; + SystemPlugin.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) throws Exception + { + boolean ok = true; + SystemPlugin.getTheSystemRegistry().renameSystemProfile((ISystemProfile)element, newName); + return ok; + } + /** + * Return a validator for verifying the new name is correct. + */ + public ISystemValidator getNameValidator(Object element) + { + return new ValidatorProfileName(SystemPlugin.getTheSystemRegistry().getSystemProfileManager().getSystemProfileNamesVector()); + } + /** + * Parent override. + *

    + * 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. + *

    + * 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; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewRefreshAllAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewRefreshAllAction.java new file mode 100644 index 00000000000..a8f0704545e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewRefreshAllAction.java @@ -0,0 +1,76 @@ +/******************************************************************************** + * 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.team; +import org.eclipse.core.resources.IResource; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.SystemResourceManager; +import org.eclipse.rse.ui.ISystemContextMenuConstants; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +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, + SystemPlugin.getDefault().getImageDescriptorFromIDE(ISystemIconConstants.ICON_IDE_REFRESH_ID), + parent); + this.teamView = teamView; + allowOnMultipleSelection(true); + setContextMenuGroup(ISystemContextMenuConstants.GROUP_BUILD); + setSelectionSensitive(false); + + setHelp(SystemPlugin.HELPPREFIX+"actn0009"); + } + + /** + * @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 { + SystemResourceManager.getRemoteSystemsProject().refreshLocal(IResource.DEPTH_INFINITE, null); + } catch (Exception exc) {} + + SystemTeamView teamViewer = (SystemTeamView)teamView.getTreeViewer(); + teamViewer.refresh(); + //System.out.println("Running refresh all"); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewResourceAdapterFactory.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewResourceAdapterFactory.java new file mode 100644 index 00000000000..78e1fb21f9a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewResourceAdapterFactory.java @@ -0,0 +1,68 @@ +/******************************************************************************** + * 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.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.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; + adapter = SystemResourceManager.getRemoteSystemsProject(); + } + /* deferred + else if (adaptableObject instanceof SystemProfile) + { + SystemProfile profile = (SystemProfile)adaptableObject; + adapter = SystemResourceManager.getProfileFolder(profile); + }*/ + return adapter; + } + + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewSubSystemFactoryAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewSubSystemFactoryAdapter.java new file mode 100644 index 00000000000..4bc875d8305 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewSubSystemFactoryAdapter.java @@ -0,0 +1,309 @@ +/******************************************************************************** + * 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.team; + +import java.util.Hashtable; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.ISystemUserIdConstants; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.ui.SystemMenuManager; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.filters.actions.SystemFilterWorkWithFilterPoolsAction; +import org.eclipse.rse.ui.view.AbstractSystemViewAdapter; +import org.eclipse.rse.ui.view.ISystemViewElementAdapter; +import org.eclipse.rse.ui.view.SystemViewResources; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.views.properties.PropertyDescriptor; + + +/** + * Adapter for displaying and processing SystemTeamViewSubSystemFactoryNode objects in tree views, such as + * the Team view. + */ +public class SystemTeamViewSubSystemFactoryAdapter + extends AbstractSystemViewAdapter + implements ISystemViewElementAdapter, ISystemUserIdConstants +{ + + 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(); + + SystemTeamViewSubSystemFactoryNode ssfNode = (SystemTeamViewSubSystemFactoryNode)selection.getFirstElement(); + SystemTeamViewCategoryNode category = ssfNode.getParentCategory(); + String categoryType = category.getMementoHandle(); + +// FIXME - user actions and compilecmds no longer coupled to core +// if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_USERACTIONS) && ssfNode.getSubSystemFactory().supportsUserDefinedActions()) +// { +// wwActionsAction.reset(); +// wwActionsAction.setShell(shell); +// menu.add(menuGroup, wwActionsAction); +// } +// else if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_COMPILECMDS) && ssfNode.getSubSystemFactory().supportsCompileActions()) +// { +// wwCmdsAction.reset(); +// wwCmdsAction.setShell(shell); +// menu.add(menuGroup, wwCmdsAction); +// } + if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_FILTERPOOLS) && ssfNode.getSubSystemFactory().supportsFilters()) + { + wwPoolsAction.reset(); + wwPoolsAction.setShell(shell); + wwPoolsAction.setFilterPoolManagerProvider(ssfNode.getSubSystemFactory()); + ISystemFilterPoolManager[] poolMgrs = new ISystemFilterPoolManager[1]; + poolMgrs[0] = ssfNode.getSubSystemFactory().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 ((SystemTeamViewSubSystemFactoryNode)element).getImageDescriptor(); + } + + /** + * Return the label for this object + */ + public String getText(Object element) + { + return ((SystemTeamViewSubSystemFactoryNode)element).getLabel(); + } + + /** + * Return the name of this object, which may be different than the display text ({#link #getText(Object)}. + *

    + * Called by common rename and delete actions. + */ + public String getName(Object element) + { + return ((SystemTeamViewSubSystemFactoryNode)element).getLabel(); + } + + /** + * Return the absolute name, versus just display name, of this object + */ + public String getAbsoluteName(Object element) + { + SystemTeamViewSubSystemFactoryNode factory = (SystemTeamViewSubSystemFactoryNode)element; + return factory.getProfile().getName() + "." + factory.getParentCategory().getLabel() + factory.getLabel(); + } + + /** + * 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) + { + SystemTeamViewSubSystemFactoryNode factory = (SystemTeamViewSubSystemFactoryNode)element; + return SystemResources.RESID_TEAMVIEW_SUBSYSFACTORY_VALUE + ": " + factory.getLabel(); + } + + /** + * Return the parent of this object. We return the RemoteSystemsConnections project + */ + public Object getParent(Object element) + { + SystemTeamViewSubSystemFactoryNode factory = (SystemTeamViewSubSystemFactoryNode)element; + return factory.getParentCategory(); + } + + /** + * Return the children of this profile. + */ + public Object[] getChildren(Object element) + { + SystemTeamViewSubSystemFactoryNode ssfNode = (SystemTeamViewSubSystemFactoryNode)element; + SystemTeamViewCategoryNode category = ssfNode.getParentCategory(); + ISystemProfile profile = ssfNode.getProfile(); + String categoryType = category.getMementoHandle(); + ISubSystemConfiguration ssf = ssfNode.getSubSystemFactory(); + 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 0); + */ + return false; + } + else if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_COMPILECMDS)) + { + /* FIXME + return (profile.getCompileCommandTypes(ssf).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]; + SystemPlugin plugin = SystemPlugin.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 = SystemPlugin.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) + { + SystemTeamViewSubSystemFactoryNode factory = (SystemTeamViewSubSystemFactoryNode)element; + return factory.getMementoHandle(); + } + /** + * Return a short string to uniquely identify the type of resource. + */ + public String getMementoHandleKey(Object element) + { + SystemTeamViewSubSystemFactoryNode factory = (SystemTeamViewSubSystemFactoryNode)element; + return factory.getProfile().getName() + "." + factory.getParentCategory().getLabel() + "." + factory.getLabel(); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewSubSystemFactoryNode.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewSubSystemFactoryNode.java new file mode 100644 index 00000000000..e3b8afa1cc4 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewSubSystemFactoryNode.java @@ -0,0 +1,191 @@ +/******************************************************************************** + * 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.team; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.ui.SystemResources; + + +/** + * 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 SystemTeamViewSubSystemFactoryNode implements IAdaptable +{ + private String mementoHandle; + private ISystemProfile profile; + private ISubSystemConfiguration ssf; + private SystemTeamViewCategoryNode parentCategory; + private String name = null; + + /** + * Constructor + */ + public SystemTeamViewSubSystemFactoryNode(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 SystemTeamViewSubSystemFactoryNode) + { + SystemTeamViewSubSystemFactoryNode other = (SystemTeamViewSubSystemFactoryNode)o; + if ((ssf == other.getSubSystemFactory()) && + (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() + { + return ssf.getImage(); + } + + /** + * Return this node's label + * @return the translated label to show in the tree, for this node + */ + public String getLabel() + { + if (name == null) + { + name = ""; + String[] types = ssf.getSystemTypes(); + if (ssf.getSubSystemFactoryProxy().supportsAllSystemTypes()) + { + name = SystemResources.TERM_ALL; + } + else + { + for (int idx=0; idx 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 = (String) value; + if (name == null || name.trim().equals("")) + { + msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_ENVVAR_NONAME); + } + else + { + if (invalidNameChars != null) + { + if (invalidNameChars.indexOf(' ') != -1) + { + name = ((String) 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 = SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_ENVVAR_INVALIDCHAR); + } + } + } + + // next check for duplicate env var names + String existingName; + int currentSelection = envVarTable.getSelectionIndex(); + for (int i = 0; i < envVars.size() && msg == null; i++) + { + existingName = ((EnvironmentVariable) envVars.get(i)).getName(); + if (currentSelection != i && existingName.equals(name)) + { + msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_ENVVAR_DUPLICATE); + msg.makeSubstitution(existingName); + } + } + } + } + + 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 new file mode 100644 index 00000000000..2b20210a79e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/GridUtil.java @@ -0,0 +1,68 @@ +/******************************************************************************** + * 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/IBMBaseServerLauncherForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/IBMBaseServerLauncherForm.java new file mode 100644 index 00000000000..e5f494b8077 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/IBMBaseServerLauncherForm.java @@ -0,0 +1,114 @@ +/******************************************************************************** + * 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.SystemPlugin; +import org.eclipse.rse.core.internal.subsystems.IBMServerLauncherConstants; +import org.eclipse.rse.core.subsystems.IServerLauncherProperties; +import org.eclipse.rse.core.subsystems.ServerLaunchType; +import org.eclipse.rse.ui.SystemBaseForm; +import org.eclipse.rse.ui.SystemResources; +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 IBM server launcher form. Extend this to provide a specialized server launcher form + */ +public abstract class IBMBaseServerLauncherForm extends SystemBaseForm implements IServerLauncherForm, IBMServerLauncherConstants, ISystemConnectionWizardErrorUpdater +{ + + + + protected String _hostName; + + protected ISystemMessageLine _msgLine; + + /** + * Constructor for EnvironmentVariablesForm. + * @param msgLine + */ + public IBMBaseServerLauncherForm(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, SystemPlugin.HELPPREFIX + "srln0000"); + + // 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/IBMServerLauncherForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/IBMServerLauncherForm.java new file mode 100644 index 00000000000..43299984614 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/IBMServerLauncherForm.java @@ -0,0 +1,561 @@ +/******************************************************************************** + * 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.SystemPlugin; +import org.eclipse.rse.core.subsystems.IIBMServerLauncher; +import org.eclipse.rse.core.subsystems.IServerLauncherProperties; +import org.eclipse.rse.core.subsystems.ServerLaunchType; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +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.rse.ui.validators.ValidatorServerPortInput; +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 IBMServerLauncherForm extends IBMBaseServerLauncherForm +{ + + private Button _radioDaemon, _radioRexec, _radioNone; + private Text _fieldDaemonPort; + private Label _labelDaemonPort; + + private Text _fieldRexecPath, _fieldRexecInvocation, _fieldRexecPort; + private Label _labelRexecPath, _labelRexecInvocation, _labelRexecPort; + + private Composite _daemonControls, _rexecControls; + + private ValidatorServerPortInput _serverPortValidator; + private ValidatorPortInput _daemonPortValidator; + private ValidatorPortInput _rexecPortValidator; + + + private ServerLaunchType _origlaunchType; + private String _origPath; + private String _origInvocation; + private int _origRexecPort; + private int _origDaemonPort; + + /** + * Constructor for EnvironmentVariablesForm. + * @param msgLine + */ + public IBMServerLauncherForm(Shell shell, ISystemMessageLine msgLine) + { + super(shell, msgLine); + _daemonPortValidator = new ValidatorPortInput(); + _serverPortValidator = new ValidatorServerPortInput(); + _rexecPortValidator = new ValidatorPortInput(); + } + + public boolean isDirty() + { + boolean isDirty = _origlaunchType != getLaunchType() || + !_origPath.equals(getServerInstallPath()) || + !_origInvocation.equals(getServerInvocation()) || + _origRexecPort != getREXECPortAsInt() || + _origDaemonPort != getDaemonPortAsInt(); + 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); + } + + + + 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 + ")"; + _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); + + _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); + + // help + SystemWidgetHelpers.setHelp(_radioDaemon, SystemPlugin.HELPPREFIX + "srln0001"); + SystemWidgetHelpers.setHelp(_radioRexec, SystemPlugin.HELPPREFIX + "srln0002"); + SystemWidgetHelpers.setHelp(_radioNone, SystemPlugin.HELPPREFIX + "srln0003"); + SystemWidgetHelpers.setHelp(_fieldRexecPath, SystemPlugin.HELPPREFIX + "srln0004"); + SystemWidgetHelpers.setHelp(_fieldRexecInvocation, SystemPlugin.HELPPREFIX + "srln0005"); + } + + 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()); + + _fieldDaemonPort.setText(String.valueOf(DEFAULT_DAEMON_PORT)); + _fieldRexecPath.setText(DEFAULT_REXEC_PATH); + _fieldRexecInvocation.setText(DEFAULT_REXEC_SCRIPT); + _fieldRexecPort.setText(String.valueOf(DEFAULT_REXEC_PORT)); + } + + /** + * Set the initial values for the widgets, based on the server launcher + */ + public void initValues(IServerLauncherProperties launcher) + { + IIBMServerLauncher isl = (IIBMServerLauncher)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 + + // 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); + + if (!allowDaemon && !allowRexec && !allowNo) { + disable(); + } + + + _origlaunchType = getLaunchType(); + _origPath = getServerInstallPath(); + _origInvocation = getServerInvocation(); + _origRexecPort = getREXECPortAsInt(); + _origDaemonPort = getDaemonPortAsInt(); + } + + /** + * 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(); + msg = _rexecPortValidator.validate(port); + + if (msg == null) + { + String path = getServerInstallPath(); + + if (path == null || path.length() == 0) + { + msg = SystemPlugin.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(); + msg = _daemonPortValidator.validate(port); + + 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(); + + + IIBMServerLauncher isl = (IIBMServerLauncher)launcher; + isl.setServerLaunchType(launchType); + isl.setServerPath(path); + isl.setServerScript(invocation); + isl.setRexecPort(rexecPort); // changed from setPort via d54335. Phil + isl.setDaemonPort(daemonPort); + + 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); + + 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 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 true if daemon launch should be enabled, false 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 true if rexec launch should be enabled, false 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 true if no launch should be enabled, false otherwise. + */ + public void setNoLaunchEnabled(boolean enable) + { + _radioNone.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); + } +} \ 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 new file mode 100644 index 00000000000..40e9d901188 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/IServerLauncherForm.java @@ -0,0 +1,61 @@ +/******************************************************************************** + * 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); + + /** + * Did anythign change? + * @return + */ + 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 new file mode 100644 index 00000000000..402149e8574 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemAddListener.java @@ -0,0 +1,47 @@ +/******************************************************************************** + * 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.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. + *

    + * 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 new file mode 100644 index 00000000000..9b3b82846e2 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemCollapsableSectionListener.java @@ -0,0 +1,31 @@ +/******************************************************************************** + * 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 { + + + /** + * Notify listeners of a section collapsed or expanded. + * + * @return true if the section was collapsed, false if the section was 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 new file mode 100644 index 00000000000..f5b629ed976 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemCombo.java @@ -0,0 +1,96 @@ +/******************************************************************************** + * 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 new file mode 100644 index 00000000000..4a8171caf25 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemEditPaneStates.java @@ -0,0 +1,53 @@ +/******************************************************************************** + * 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 new file mode 100644 index 00000000000..2c7e6a183f8 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritButton.java @@ -0,0 +1,240 @@ +/******************************************************************************** + * 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.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; + +/** + * 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. + *

    + * Pressing the button will trigger a SelectionEvent which the client + * can listen for. Typically the client will use this to change the + * button state. + *

    + * 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. + *

    + * Although this control extends Composite, it does not make sense to + * add children to this control or to set a layout on it. + */ +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; + + /** + * Create a new InheritButton. + * @param parent + */ + public InheritButton(Composite parent) { + super(parent, SWT.NONE); + 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) { + toggle = new Button(parent, SWT.PUSH); + createToggleImages(toggle.getBackground()); + toggle.getAccessible().addAccessibleListener(new AccessibleAdapter() { + public void getHelp(AccessibleEvent e) { // this is the one that should supply the text heard. + e.result = getToolTipText(); + } + public void getName(AccessibleEvent e) { // this is the one that apparently does supply the text heard. + e.result = getToolTipText(); + } + }); + toggle.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + disposeToggleImages(); + } + }); + 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. + *

    + * @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() { + toggle.setImage(isLocal ? rightArrow : leftArrow); + } + + /** + * 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 new file mode 100644 index 00000000000..f7e4c3e8acd --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritControl.java @@ -0,0 +1,217 @@ +/******************************************************************************** + * 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.rse.core.SystemPlugin; +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; + SystemPlugin sp = SystemPlugin.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"); + 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. + *

    + * 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 new file mode 100644 index 00000000000..ca002ff0c4a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritControlLayout.java @@ -0,0 +1,44 @@ +/******************************************************************************** + * 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 new file mode 100644 index 00000000000..aaa0e9cd3c2 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritableEntryField.java @@ -0,0 +1,345 @@ +/******************************************************************************** + * 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.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. + *

    + * To accomplish this, we create a composite containing a toggle button + * followed by an entry field. + *

    + * 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! + *

    + * 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 = ""; + private String localValue = ""; + private boolean isLocal = true; + private boolean allowEditOfInherited = false; + + /** + * 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 style the SWT style for the toggle button widget + * @param style 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 style the SWT style for the toggle button widget + * @param style 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); + 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) { // 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 = ""; + 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 = ""; + 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 ""; + } + + /** + * 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 + *

    + * 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 + *

    + * @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 this composite control and sets the default layout data. + * @param 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(); + data.verticalAlignment = GridData.FILL; + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + composite.setLayoutData(data); + return composite; + } + + /** + * Create our text field and insert it into a GridLayout. + * Assign the listener to the passed in implementer of Listener. + * @param GridLayout composite to put the field into. + */ + 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); + } + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SSLForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SSLForm.java new file mode 100644 index 00000000000..e07f267dbfa --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SSLForm.java @@ -0,0 +1,94 @@ +/******************************************************************************** + * 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.ui.SystemBaseForm; +import org.eclipse.rse.ui.SystemResources; +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; + + /** + * Constructor for SSLForm. + * @param msgLine + */ + public SSLForm(ISystemMessageLine msgLine) { + super(null, msgLine); // null is the shell. + } + + /** + * Determines whether ssl is checked or not + * @return + */ + public boolean isChecked() + { + return _sslCheckBox.getSelection(); + } + + + /** + * Check/uncheck the ssl checkbox + * @param flag + */ + public void setIsChecked(boolean flag) + { + _sslCheckBox.setSelection(flag); + } + + /** + * Enable/disable the ssl checkbox + * @param flag + */ + public void enableCheckBox(boolean flag) + { + _sslCheckBox.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_LABEL, this); + _sslCheckBox.setToolTipText(SystemResources.RESID_SUBSYSTEM_SSL_TIP); + + + return _sslCheckBox; + } + + + + public void handleEvent(Event evt) + { + + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ServerConnectionSecurityForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ServerConnectionSecurityForm.java new file mode 100644 index 00000000000..6f679d3a7e0 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ServerConnectionSecurityForm.java @@ -0,0 +1,87 @@ +/******************************************************************************** + * 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.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.enableCheckBox(false); + } + + public void enable() + { + _sslForm.enableCheckBox(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 persistance model + + } + + + public void setUseSSL(boolean flag) + { + _sslForm.setIsChecked(flag); + } + + public boolean getUseSSL() + { + return _sslForm.isChecked(); + } + + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..4e83703897d --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemCollapsableSection.java @@ -0,0 +1,441 @@ +/******************************************************************************** + * 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."; + + 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); + Point ptLocation = 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"; + } + + 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; + } + + /** + * Set the two tooltips used in expanded state and collapsed state + * @param String - tooltip for the expanded state. e.g. Click line to collapse the section + * @param String - tooltip for the collapsed state. e.g. 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 new file mode 100644 index 00000000000..6a2ff5aad2a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemEditPaneStateMachine.java @@ -0,0 +1,451 @@ +/******************************************************************************** + * 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.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.messages.SystemMessageDialog; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; + + +/** + * @author coulthar + * + * This class attempts to encapsulate 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. + *

    + * There are three modes supported: + *

      + *
    1. New -> user is creating a "new thing". In this state, the apply button label is + * "New", and the reset button is hidden + *
    2. Edit -> user is editing an existing thing. The apply and reset buttons have usual labels + *
    3. Unset -> overall composite is hidden + *
    + * In addition to the modes, there are these states supported + *
      + *
    1. No changes -> the apply and reset buttons are disabled + *
    2. Changes pending -> the apply and reset buttons are enabled + *
    3. Changes made -> the apply and reset buttons are disabled + *
    + * There are constants for these modes and states in {@link org.eclipse.rse.ui.widgets.ISystemEditPaneStates} + *

    + * To use this properly, call the following methods at the appropriate times: + *

      + *
    • {@link #setNewMode()} -> when users selects to create a new thing. + *
    • {@link #setEditMode()} -> when user selects to edit an existing thing. + *
    • {@link #setUnsetMode()} -> when user selects nothing or something not editable + *
    • {@link #setChangesMade()} -> when user changes anything in the pane! + *
    • {@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. + *
    • {@link #applyPressed()} -> when user successfully presses apply + *
    • {@link #resetPressed()} -> when user successfully presses reset + *
    + */ +public class SystemEditPaneStateMachine implements ISystemEditPaneStates + //, SelectionListener +{ + // 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. + *

    + * This constructor sets the initial mode to MODE_UNSET. + *

    + * 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, MODE_NEW); + setMode(MODE_NEW); + setState(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, MODE_EDIT); + setMode(MODE_EDIT); + setState(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, MODE_UNSET); + setMode(MODE_UNSET); + setState(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(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 = SystemPlugin.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(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(STATE_APPLIED); + enableButtons(); + } + /** + * User has successfully pressed Reset (that is, no errors found) + */ + public void resetPressed() + { + setState(STATE_INITIAL); + enableButtons(); + } + + /** + * Are any changes pending? + */ + public boolean areChangesPending() + { + return (state == 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 STATE_INITIAL: + enableApply = false; + enableReset = false; + break; + case STATE_APPLIED: + enableApply = false; + enableReset = false; // true; only true if reset returns to pre-applied values. Not usually the case + break; + case 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 == 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 == 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); + //} + } + } + } + } + + /** + * 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 MODE_UNSET: + setUnsetMode(); + break; + case MODE_NEW: + setNewMode(); + break; + case MODE_EDIT: + setEditMode(); + break; + } + switch(backupState) + { + case STATE_PENDING: + setChangesMade(); + break; + case STATE_INITIAL: + break; + case 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 new file mode 100644 index 00000000000..87c6f0e7718 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHistoryCombo.java @@ -0,0 +1,696 @@ +/******************************************************************************** + * 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.rse.core.SystemPreferencesManager; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.dialogs.SystemWorkWithHistoryDialog; +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; + + +/** + * This re-usable widget is for a combox box that persists its history and + * allows the user to manipulate that history. + *

    + * The composite is layed as follows:

    + *
    
    + *   ______________v...
    + * 
    + * @see #updateHistory() + */ +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.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= 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.getPreferencesManager().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.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 + * 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 + *

    + * 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("\""))) + 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= 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.getPreferencesManager().setWidgetHistory(historyKey, newHistory); + } + } + else + { + newHistory =new String[1]; + newHistory[0] = textValue; + SystemPreferencesManager.getPreferencesManager().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 + * 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.getPreferencesManager().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. + */ + 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); + 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 = historyButton.getToolTipText(); + } + public void getName(AccessibleEvent e) { // this is the one that apparently does supply the text heard. + e.result = historyButton.getToolTipText(); + } + }); + + 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"; + switch (detail) + { + case SWT.TRAVERSE_ARROW_NEXT: s="Arrow Next"; break; + case SWT.TRAVERSE_ARROW_PREVIOUS: s="Arrow Previous"; break; + case SWT.TRAVERSE_ESCAPE: s="Escape"; break; + case SWT.TRAVERSE_RETURN: s="Return"; break; + case SWT.TRAVERSE_TAB_NEXT: + s="Tab Next"; + //historyButton.setFocus(); + historyButton.forceFocus(); + //e.doit=false; + break; + case SWT.TRAVERSE_TAB_PREVIOUS: s="Tab Previous"; break; + } + System.out.println("keyTraversed: "+s); + } + + 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 new file mode 100644 index 00000000000..a61e0816cfb --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHostCombo.java @@ -0,0 +1,1121 @@ +/******************************************************************************** + * 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.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.SystemPlugin; +import org.eclipse.rse.core.SystemPreferencesManager; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemResourceChangeEvent; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.SystemWidgetHelpers; +import org.eclipse.rse.ui.actions.SystemNewConnectionAction; +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. + *

    + * Without the New button, the composite is layed as follows:

    + *
    
    + *   Connection: ______________________v  
    + * 
    + *

    + * With the New button, the composite is layed as follows:

    + *
    
    + *   Connection: ______________v  New...
    + * 
    + *

    + * There are numerous ways to subset the connection list:

    + *
      + *
    • By system type, either by a single type or an array of types. Only connections of these types are listed. + *
    • By subsystem factory. Only connections with subsystems owned by the given subsystem factory are listed. + *
    • 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.model.ISubSystemFactoryCategories}. + *
    + */ +public class SystemHostCombo extends Composite implements ISelectionProvider, ISystemCombo, + org.eclipse.rse.model.ISystemResourceChangeListener, + ISystemResourceChangeEvents, 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 String[] 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 String populateSystemType = null; /* used as criteria when refresh is done */ + private String[] 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, String systemType, IHost defaultConnection, boolean showNewButton) + { + super(parent, style); + restrictSystemTypesTo = new String[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, String[] 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 subsystemFactory. 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 ssFactory, IHost defaultConnection, boolean showNewButton) + { + super(parent, style); + restrictSystemTypesTo = ssFactory.getSystemTypes(); + init(parent, showNewButton); + populateSSFactory = ssFactory; + populateConnectionCombo(connectionCombo, ssFactory, 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 subsystemFactoryId. Only connections with subsystems owned by this factory 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 ssFactoryId, boolean showNewButton) + { + super(parent, style); + restrictSystemTypesTo = SystemPlugin.getTheSystemRegistry().getSubSystemConfiguration(ssFactoryId).getSystemTypes(); + init(parent, showNewButton); + populateSSFactoryId = ssFactoryId; + populateConnectionCombo(connectionCombo, ssFactoryId, 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 subsystemFactoryCategory. Only connections with subsystems owned by factories of this category are returned. + */ + public SystemHostCombo(Composite parent, int style, IHost defaultConnection, boolean showNewButton, String ssFactoryCategory) + { + this(parent, style, defaultConnection, showNewButton, ssFactoryCategory, 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 subsystemFactoryCategory. 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 ssFactoryCategory, boolean showLabel) + { + super(parent, style); + if (showNewButton) // this is expensive, so only need to do this if New is enabled + { + ISubSystemConfigurationProxy[] ssfProxies = SystemPlugin.getTheSystemRegistry().getSubSystemConfigurationProxiesByCategory(ssFactoryCategory); + Vector vTypes = new Vector(); + for (int idx=0; idx + * 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.getPreferencesManager().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 + * 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. + *

    + * 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 readonly connection combobox instance with system connections for the given + * system type. + *

    + * This fills the combination with the names of all the active connections of the given + * system type. + * @param connectionCombo 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, String systemType, IHost defaultConnection, + boolean preSelectIfNoMatch) + { + return populateConnectionCombo(combo, systemType, defaultConnection, preSelectIfNoMatch, false); + } + + /** + * Populates a readonly connection combobox instance with system connections for the given + * system type. + *

    + * This fills the combination with the names of all the active connections of the given + * system type. + * @param connectionCombo 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 + * @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, String systemType, IHost defaultConnection, + boolean preSelectIfNoMatch, boolean appendToCombo) + { + boolean matchFound = false; + IHost[] additionalConnections = null; + if ( (systemType == null) || (systemType.equals("*")) ) + additionalConnections = SystemPlugin.getTheSystemRegistry().getHosts(); + else + additionalConnections = SystemPlugin.getTheSystemRegistry().getHostsBySystemType(systemType); + if (additionalConnections != null) + { + String[] connectionNames = new String[additionalConnections.length]; + int selectionIndex = -1; + for (int idx=0; idx=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; idx0)) + //combo.select(0); + select(0); + } + /** + * Populates a readonly connection combobox instance with system connections which have subsystems + * owned by the given subsystem factory. + *

    + * @param connectionCombo composite to populate + * @param subsystemFactory 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 ssFactory, IHost defaultConnection) + { + connections = SystemPlugin.getTheSystemRegistry().getHostsBySubSystemConfiguration(ssFactory); + return addConnections(combo, connections, defaultConnection); + } + /** + * Populates a readonly connection combobox instance with system connections which have subsystems + * owned by a subsystem factory of the given subsystem factory id. + *

    + * @param connectionCombo composite to populate + * @param defaultConnection the default system connection to preselect. + * @param subsystemFactoryId 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 ssFactoryId, IHost defaultConnection) + { + connections = SystemPlugin.getTheSystemRegistry().getHostsBySubSystemConfigurationId(ssFactoryId); + return addConnections(combo, connections, defaultConnection); + } + + /** + * Populates a readonly connection combobox instance with system connections which have subsystems + * owned by a subsystem factory of the given subsystem factory category. + *

    + * @param connectionCombo composite to populate + * @param defaultConnection the default system connection to preselect. + * @param subsystemFactoryCategory 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 ssFactoryCategory) + { + connections = SystemPlugin.getTheSystemRegistry().getHostsBySubSystemConfigurationCategory(ssFactoryCategory); + return addConnections(combo, connections, defaultConnection); + } + /** + * An attempt to get some abstraction + */ + private boolean addConnections(Combo combo, IHost[] connections, IHost defaultConnection) + { + boolean matchFound = false; + if (connections != null) + { + String[] connectionNames = new String[connections.length]; + int selectionIndex = -1; + for (int idx=0; idx=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 message containing substitution variable. Eg "Connect failed with return code &1" + * @param substitution variable. Eg "%1" + * @param 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(); + 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 EVENT_ADD: + case EVENT_ADD_RELATIVE: + case EVENT_DELETE_MANY: + case EVENT_RENAME: + if ( src instanceof IHost ) + { + // if RENAME, update showQualifiedNames in case it changed + if ( type == EVENT_RENAME ) + showQualifiedNames = SystemPreferencesManager.getPreferencesManager().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; + SystemPlugin.getTheSystemRegistry().addSystemResourceChangeListener(this); + } + else + { + // ---------------------------------------- + // remove register with system registry for events + // ---------------------------------------- + listeningForConnectionEvents = false; + SystemPlugin.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; + SystemPlugin.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; idxHelper method.
    + * 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 new file mode 100644 index 00000000000..8cbb3fd0d89 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemPortPrompt.java @@ -0,0 +1,366 @@ +/******************************************************************************** + * 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.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemPropertyResources; +import org.eclipse.rse.ui.SystemResources; +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, 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; + + /** + * 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; + int iPort = port; + if (!portEditable) // applicable but not editable + labelPort.setText(localPort); + else // editable + { + textPort.setLocalText(localPort); + textPort.setInheritedText("0 "+SystemPropertyResources.RESID_PORT_DYNAMICSELECT); + 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("")) + errorMessage = SystemPlugin.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(); + } + }); + + textPort.getTextField().addVerifyListener(new SystemNumericVerifyListener()); + //textPort.addSelectionListener(this); Removed for defect 44132 + } + } + + /** + * 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 + ")"; + 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 = " "; + 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 + } + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemSelectConnectionForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemSelectConnectionForm.java new file mode 100644 index 00000000000..f6e2fc43e2b --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemSelectConnectionForm.java @@ -0,0 +1,508 @@ +/******************************************************************************** + * 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 java.util.Iterator; +import java.util.Vector; + +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.rse.model.IHost; +import org.eclipse.rse.ui.SystemBaseForm; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.SystemWidgetHelpers; +import org.eclipse.rse.ui.messages.ISystemMessageLine; +import org.eclipse.rse.ui.view.SystemPropertySheetForm; +import org.eclipse.rse.ui.view.SystemViewConnectionSelectionInputProvider; +import org.eclipse.rse.ui.view.SystemViewForm; +import org.eclipse.swt.SWT; +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; + + + +/** + * A reusable form for prompting for a connection. Unlike {@link org.eclipse.rse.ui.widgets.SystemHostCombo}, + * this form uses a list box to show the available connections. + *

    + * This form may be used to populate a dialog or a wizard page. + *

    + * To configure the functionality, call these methods: + *

      + *
    • {@link #setShowNewConnectionPrompt(boolean)} + *
    • {@link #setDefaultConnection(IHost)} + *
    • {@link #setSystemTypes(String[])} + *
    • {@link #setShowPropertySheet(boolean)} + *
    • {@link #enableAddMode(com.ibm.etools.systems.files.ui.ISystemAddFileListener)} + *
    • {@link #setMultipleSelectionMode(boolean)} + *
    + *

    + * To configure the text on the dialog, call these methods: + *

      + *
    • {@link #setMessage(String)} + *
    + *

    + * After running, call these methods to get the output: + *

      + *
    • {@link #getSelectedConnection()} + *
    + */ +public class SystemSelectConnectionForm extends SystemBaseForm + implements ISelectionChangedListener +{ + protected static final int PROMPT_WIDTH = 200; // The maximum width of the dialog's prompt, in pixels. + + // GUI widgets + protected Label verbageLabel, spacer1, spacer2; + protected Text nameEntryValue; + protected SystemViewForm tree; + protected SystemPropertySheetForm ps; + //protected ISystemMessageLine msgLine; + protected Composite outerParent, ps_composite; + // inputs + protected String verbage = null; + protected String[] systemTypes = null; + protected IHost defaultConn; + protected boolean allowNew = true; + protected boolean multipleSelectionMode; + protected boolean showPropertySheet = false; + protected Vector listeners = new Vector(); + + // outputs + protected IHost[] outputConnections = null; + protected IHost outputConnection = null; + // state + //protected ResourceBundle rb; + protected boolean initDone; + protected boolean contentsCreated; + + //protected String errorMessage; + //protected Object caller; + //protected boolean callerInstanceOfWizardPage, callerInstanceOfSystemPromptDialog; + protected int autoExpandDepth = 0; + + protected Object previousSelection = null; + + /** + * Constructor + * @param shell The shell hosting this form + * @param msgLine A GUI widget capable of writing error messages to. + * + * @see #setShowNewConnectionPrompt(boolean) + * @see #setSystemTypes(String[]) + */ + public SystemSelectConnectionForm(Shell shell, ISystemMessageLine msgLine) + { + super(shell, msgLine); + //this.caller = caller; + //callerInstanceOfWizardPage = (caller instanceof WizardPage); + //callerInstanceOfSystemPromptDialog = (caller instanceof SystemPromptDialog); + + // set default GUI + verbage = SystemResources.RESID_SELECTCONNECTION_VERBAGE; + } + + // --------------------------------- + // INPUT OR CONFIGURATION METHODS... + // --------------------------------- + /** + * Set the connection to default the selection to + */ + public void setDefaultConnection(IHost conn) + { + defaultConn = conn; + } + + /** + * Set to true if we are to allow users to create a new connection. Default is true. + */ + public void setShowNewConnectionPrompt(boolean show) + { + allowNew = show; + } + /** + * Restrict to certain system types + * @param systemTypes the system types to restrict what connections are shown and what types of connections + * the user can create + * @see org.eclipse.rse.core.ISystemTypes + */ + public void setSystemTypes(String[] systemTypes) + { + this.systemTypes = systemTypes; + } + /** + * Restrict to one system type + * @param systemType the system type to restrict what connections are shown and what types of connections + * the user can create + * @see org.eclipse.rse.core.ISystemTypes + */ + public void setSystemType(String systemType) + { + systemTypes = new String[1]; + systemTypes[0] = systemType; + } + /** + * Set the message shown as the text at the top of the form. Default is "Select a connection" + */ + public void setMessage(String message) + { + this.verbage = message; + if (verbageLabel != null) + verbageLabel.setText(message); + } + /** + * Show the property sheet on the right hand side, to show the properties of the + * selected connection. + *

    + * Default is false + */ + public void setShowPropertySheet(boolean show) + { + this.showPropertySheet = show; + } + + /** + * Set multiple selection mode. Default is single selection mode + *

    + * If you turn on multiple selection mode, you must use the getSelectedConnections() + * method to retrieve the list of selected connections. + * + * @see #getSelectedConnections() + */ + public void setMultipleSelectionMode(boolean multiple) + { + this.multipleSelectionMode = multiple; + } + + /** + * Add a listener to selection change events in the list + */ + public void addSelectionChangedListener(ISelectionChangedListener l) + { + if (tree != null) + tree.addSelectionChangedListener(l); + else + listeners.addElement(l); + } + /** + * Remove a listener for selection change events in the list + */ + public void removeSelectionChangedListener(ISelectionChangedListener l) + { + if (tree != null) + tree.removeSelectionChangedListener(l); + else + listeners.removeElement(l); + } + + + // --------------------------------- + // OUTPUT METHODS... + // --------------------------------- + /** + * Return all selected connections. + * @see #setMultipleSelectionMode(boolean) + */ + public IHost[] getSelectedConnections() + { + return outputConnections; + } + /** + * Return selected connection + */ + public IHost getSelectedConnection() + { + return outputConnection; + } + + /** + * Return the multiple selection mode current setting + */ + public boolean getMultipleSelectionMode() + { + return multipleSelectionMode; + } + + // ----------------------------------------------------- + // SEMI-PRIVATE METHODS USED BY CALLING DIALOG/WIZARD... + // ----------------------------------------------------- + + /** + * Return control to recieve initial focus + */ + public Control getInitialFocusControl() + { + return tree.getTreeControl(); + } + + /** + * 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(); + spacer1.dispose(); + spacer2.dispose(); + ps_composite.dispose(); + ps = null; spacer1 = spacer2 = null; ps_composite = null; + ((GridLayout)outerParent.getLayout()).numColumns = 1; + } + else // showing? + { + //createPropertySheet((Composite)contents, shell); + ((GridLayout)outerParent.getLayout()).numColumns = 2; + createPropertySheet(outerParent, 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 = tree.getSelection(); + if (s != null) + ps.selectionChanged(s); + } + + showPropertySheet = !showPropertySheet; + return showPropertySheet; + } + + /** + * Create the property sheet viewer + */ + private void createPropertySheet(Composite outerParent, Shell shell) + { + ps_composite = SystemWidgetHelpers.createFlushComposite(outerParent, 1); + ((GridData)ps_composite.getLayoutData()).grabExcessVerticalSpace = true; + ((GridData)ps_composite.getLayoutData()).verticalAlignment = GridData.FILL; + + // SPACER LINES + spacer1 = SystemWidgetHelpers.createLabel(ps_composite, "", 1); + spacer2 = SystemWidgetHelpers.createLabel(ps_composite, "", 1); + // PROPERTY SHEET VIEWER + ps = new SystemPropertySheetForm(shell, ps_composite, SWT.BORDER, getMessageLine()); + } + + public void dispose() + { + if (tree != null) + { + tree.removeSelectionChangedListener(this); + for (int i = 0; i < listeners.size(); i++) + { + tree.removeSelectionChangedListener((ISelectionChangedListener)listeners.get(i)); + } + } + } + /** + * In this method, we populate the given SWT container with widgets and return the container + * to the caller. + * @param parent The parent composite + */ + public Control createContents(Composite parent) + { + contentsCreated = true; + + outerParent = parent; + // OUTER COMPOSITE + //if (showPropertySheet) + { + outerParent = SystemWidgetHelpers.createComposite(parent, showPropertySheet ? 2 : 1); + } + + // INNER COMPOSITE + int gridColumns = 2; + Composite composite_prompts = SystemWidgetHelpers.createFlushComposite(outerParent, gridColumns); + + // PROPERTY SHEET COMPOSITE + if (showPropertySheet) + { + createPropertySheet(outerParent, getShell()); + } + else + { + //((GridLayout)composite_prompts.getLayout()).margin... + } + + // MESSAGE/VERBAGE TEXT AT TOP + verbageLabel = (Label) SystemWidgetHelpers.createVerbage(composite_prompts, verbage, gridColumns, false, PROMPT_WIDTH); + //verbageLabel = SystemWidgetHelpers.createLabel(composite_prompts, verbage, gridColumns); + + // SPACER LINE + SystemWidgetHelpers.createLabel(composite_prompts, "", gridColumns); + + // SELECT OBJECT READONLY TEXT FIELD + Composite nameComposite = composite_prompts; + int nameSpan = gridColumns; + nameEntryValue = SystemWidgetHelpers.createReadonlyTextField(nameComposite); + ((GridData)nameEntryValue.getLayoutData()).horizontalSpan = nameSpan; + + // TREE + SystemViewConnectionSelectionInputProvider inputProvider = new SystemViewConnectionSelectionInputProvider(); + inputProvider.setShowNewConnectionPrompt(allowNew); + inputProvider.setSystemTypes(systemTypes); + tree = new SystemViewForm(getShell(), composite_prompts, SWT.NULL, inputProvider, !multipleSelectionMode, getMessageLine(), gridColumns, 1); + ((GridData)tree.getLayoutData()).widthHint = PROMPT_WIDTH; // normally its 300 + + // initialize fields + if (!initDone) + doInitializeFields(); + + // add selection listeners + tree.addSelectionChangedListener(this); + if (listeners.size() > 0) + for (int idx=0; idx0) && (outputObjects[0] instanceof IHost)) + { + outputConnections = new IHost[outputObjects.length]; + for (int idx=0; idx0)) + { + setNameText(outputConnections[0].getAliasName()); + setPageComplete(true); + } + else + { + setNameText(""); + setPageComplete(false); + } + } + + /** + * 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; + } + + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..ced27126bf8 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ConnectorServiceElement.java @@ -0,0 +1,109 @@ +/******************************************************************************** + * 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.SystemPlugin; +import org.eclipse.rse.core.subsystems.IConnectorService; +import org.eclipse.rse.core.subsystems.IServerLauncherProperties; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.ui.ISystemIconConstants; +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= SystemPlugin.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 new file mode 100644 index 00000000000..d35ad947731 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ConnectorServicesForm.java @@ -0,0 +1,172 @@ +/******************************************************************************** + * 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.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.ui.SystemBaseForm; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.messages.ISystemMessageLine; +import org.eclipse.rse.ui.view.SystemPropertySheetForm; +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 _descriptionVerbage; + + private String _serviceTooltip = SystemResources.RESID_SERVICESFORM_CONNECTORSERVICES_TOOLTIP; + private String _propertiesTooltip = SystemResources.RESID_SERVICESFORM_PROPERTIES_TOOLTIP; + + + public ConnectorServicesForm(ISystemMessageLine msgLine) + { + super(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); + 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); + _descriptionVerbage = new Text(descriptionComposite, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP); + _descriptionVerbage.setText(getCurrentVerbage()); + _descriptionVerbage.setEditable(false); + GridData gridData = new GridData(); + gridData.horizontalAlignment = GridData.FILL; + gridData.grabExcessHorizontalSpace = true; + gridData.widthHint = 150; + gridData.verticalAlignment = GridData.BEGINNING; + _descriptionVerbage.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); + _descriptionVerbage.setText(getCurrentVerbage()); + } + }); + + 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 getCurrentVerbage() + { + if (_serviceViewer == null) + return ""; + else + { + IStructuredSelection serviceSelection = (IStructuredSelection)_serviceViewer.getSelection(); + if (serviceSelection == null || serviceSelection.isEmpty()) + { + return ""; + } + else + return ((ServiceElement)serviceSelection.getFirstElement()).getDescription(); + } + } +} \ No newline at end of file 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 new file mode 100644 index 00000000000..050e91ab45c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/FactoryServiceElement.java @@ -0,0 +1,138 @@ +/******************************************************************************** + * 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.servicesubsystem.IServiceSubSystemConfiguration; +import org.eclipse.rse.core.subsystems.IConnectorService; +import org.eclipse.rse.core.subsystems.IServerLauncherProperties; +import org.eclipse.rse.model.DummyHost; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.services.IService; + + + + +public class FactoryServiceElement extends ServiceElement +{ + + private IServiceSubSystemConfiguration _factory; + private ServiceElement[] _children; + + + public FactoryServiceElement(IHost host, IServiceSubSystemConfiguration factory) + { + super(host, null); + _factory = factory; + } + + public String getName() + { + return _factory.getId(); + } + + public String getDescription() + { + return _factory.getDescription(); + } + + public IServiceSubSystemConfiguration 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(); + _children = new ServiceElement[2]; + _children[0] = new ServiceServiceElement(host, this, getService()); + + IConnectorService connectorService = getConnectorService(); + _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); + } + } + } + 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() + { + 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(); + } + } + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..ac5b00afc5b --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/PropertyElement.java @@ -0,0 +1,114 @@ +/******************************************************************************** + * 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.internal.model.IPropertyType; +import org.eclipse.rse.internal.model.Property; +import org.eclipse.rse.model.IProperty; +import org.eclipse.rse.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()); + } + } +} \ No newline at end of file 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 new file mode 100644 index 00000000000..241fd4b492d --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/PropertySetServiceElement.java @@ -0,0 +1,218 @@ +/******************************************************************************** + * 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.SystemPlugin; +import org.eclipse.rse.internal.model.IPropertyType; +import org.eclipse.rse.internal.model.PropertySet; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.IProperty; +import org.eclipse.rse.model.IPropertySet; +import org.eclipse.rse.ui.ISystemIconConstants; +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 SystemPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_PROPERTIES_ID); + } + + public String getName() + { + 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(); + } + } + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..84b51a96121 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/RSEModelServiceElement.java @@ -0,0 +1,149 @@ +/******************************************************************************** + * 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.model.IHost; +import org.eclipse.rse.model.IPropertySet; +import org.eclipse.rse.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 new file mode 100644 index 00000000000..8e9db9ff33a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/RootServiceElement.java @@ -0,0 +1,106 @@ +/******************************************************************************** + * 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.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(); + } + } + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..f7416a6633c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServerLauncherPropertiesServiceElement.java @@ -0,0 +1,75 @@ +/******************************************************************************** + * 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.SystemPlugin; +import org.eclipse.rse.core.subsystems.IServerLauncherProperties; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.swt.graphics.Image; + + +public class ServerLauncherPropertiesServiceElement extends RSEModelServiceElement +{ + protected IServerLauncherProperties _launcherProperties; + + public ServerLauncherPropertiesServiceElement(IHost host, ServiceElement parent, IServerLauncherProperties launcherProperties) + { + super(host, parent, launcherProperties); + _launcherProperties = launcherProperties; + } + + public String getName() + { + return _launcherProperties.getName(); + } + + public Image getImage() + { + return SystemPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_LAUNCHER_CONFIGURATION_ID); + } + + protected ServiceElement[] internalGetChildren() + { + return null; + } + + + protected boolean internalHasChildren() + { + return false; + } + + public void childChanged(ServiceElement element) + { + _launcherProperties.restoreFromProperties(); + _launcherProperties.commit(); + getParent().childChanged(element); + } + + public void commit() + { + super.commit(); + + } + + public void revert() + { + super.revert(); + } + +} \ No newline at end of file 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 new file mode 100644 index 00000000000..82df13be1d0 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceElement.java @@ -0,0 +1,88 @@ +/******************************************************************************** + * 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.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() + { + 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 new file mode 100644 index 00000000000..30ef7558692 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceServiceElement.java @@ -0,0 +1,103 @@ +/******************************************************************************** + * 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.SystemPlugin; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.services.IService; +import org.eclipse.rse.ui.ISystemIconConstants; +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= SystemPlugin.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 new file mode 100644 index 00000000000..ec4f3ecb8fd --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceTableContentProvider.java @@ -0,0 +1,67 @@ +/******************************************************************************** + * 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.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; + } +} \ No newline at end of file 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 new file mode 100644 index 00000000000..1473520e273 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceTableLabelProvider.java @@ -0,0 +1,91 @@ +/******************************************************************************** + * 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 ""; + } + } + } + return ""; + } + + + + +} \ 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 new file mode 100644 index 00000000000..9f51ac3d974 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServicesForm.java @@ -0,0 +1,313 @@ +/******************************************************************************** + * 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.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.ui.SystemBaseForm; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.messages.ISystemMessageLine; +import org.eclipse.rse.ui.view.SystemPropertySheetForm; +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.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 _descriptionVerbage; + + public ServicesForm(ISystemMessageLine msgLine) + { + super(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); + 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); + _descriptionVerbage = new Text(parent, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP); + _descriptionVerbage.setText(getCurrentVerbage()); + _descriptionVerbage.setEditable(false); + GridData gridData = new GridData(); + gridData.horizontalAlignment = GridData.FILL; + gridData.grabExcessHorizontalSpace = true; + gridData.widthHint = 150; + gridData.verticalAlignment = GridData.BEGINNING; + data.grabExcessVerticalSpace = true; + _descriptionVerbage.setLayoutData(data); + + _factoryViewer.addSelectionChangedListener(new ISelectionChangedListener() + { + public void selectionChanged(SelectionChangedEvent event) + { + ISelection selection = event.getSelection(); + if (selection instanceof StructuredSelection) + { + StructuredSelection ss = (StructuredSelection)selection; + _factoryViewer.setChecked(ss.getFirstElement(), true); + unCheckOthers((ServiceElement) ss.getFirstElement()); + _serviceViewer.setInput(ss.getFirstElement()); + _descriptionVerbage.setText(getCurrentVerbage()); + } + } + }); + + _serviceViewer.addSelectionChangedListener(new ISelectionChangedListener() + { + public void selectionChanged(SelectionChangedEvent event) + { + ISelection selection = event.getSelection(); + _propertiesViewer.selectionChanged(selection); + _descriptionVerbage.setText(getCurrentVerbage()); + } + }); + + 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); + + +/* + TableLayout tableLayout = new TableLayout(); + + TreeColumn factoryColumn = new TreeColumn(tableTree, SWT.LEFT); + factoryColumn.setText("Property"); + tableLayout.addColumnData(new ColumnPixelData(100)); + tableTree.setLayout(tableLayout); + + TreeColumn fileServiceColumn = new TreeColumn(tableTree, SWT.LEFT); + fileServiceColumn.setText("Value"); + tableLayout.addColumnData(new ColumnPixelData(120)); + */ + _serviceViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS); + + // Adjust the table viewer. + //String[] properties = new String[] {"STRING", "STRING"}; + //_serviceViewer.setColumnProperties(properties); + + _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); + _descriptionVerbage.setText(getCurrentVerbage()); + } + + 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 getCurrentVerbage() + { + if (_serviceViewer == null) + return ""; + else + { + IStructuredSelection serviceSelection = (IStructuredSelection)_serviceViewer.getSelection(); + if (serviceSelection == null || serviceSelection.isEmpty()) + { + if (_factoryViewer == null) + return ""; + else + { + IStructuredSelection factorySelection = (IStructuredSelection) _factoryViewer.getSelection(); + if (factorySelection == null || factorySelection.isEmpty()) + return ""; + else + return ((ServiceElement)factorySelection.getFirstElement()).getDescription(); + } + } + else + return ((ServiceElement)serviceSelection.getFirstElement()).getDescription(); + } + } +} \ No newline at end of file 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 new file mode 100644 index 00000000000..d307b853dc4 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemNewConnectionWizardPage.java @@ -0,0 +1,131 @@ +/******************************************************************************** + * 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.wizard.IWizard; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.ui.SystemConnectionForm; +import org.eclipse.rse.ui.SystemResources; +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.core.subsystems.ISubSystemConfiguration#getNewConnectionWizardPages(IWizard) + */ +public abstract class AbstractSystemNewConnectionWizardPage extends AbstractSystemWizardPage + implements ISystemNewConnectionWizardPage +{ + 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: + *

      + *
    • the page name to the parent factory's id + *
    • the page title to the parent factory's name + *
    + */ + public AbstractSystemNewConnectionWizardPage(IWizard wizard, ISubSystemConfiguration parentFactory, String pageDescription) + { + super(wizard, parentFactory.getId(), parentFactory.getName(), pageDescription); + this.parentFactory = parentFactory; + } + /** + * Constructor that defaults: + *
      + *
    • the page name to the parent factory's id + *
    • the page title to the parent factory's name + *
    • the page description to RESID_NEWCONN_SUBSYSTEMPAGE_DESCRIPTION + *
    + */ + 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 getSubSystemFactory() + { + 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 SystemNewConnectionWizard + */ + public SystemNewConnectionWizard getNewConnectionWizard() + { + return (SystemNewConnectionWizard)getWizard(); + } + + /** + * Get the main page of SystemNewConnectionWizard, which contains all user enter connection attributes + */ + public ISystemNewConnectionWizardMainPage getMainPage() + { + SystemNewConnectionWizard ourWizard = getNewConnectionWizard(); + if (ourWizard != null) + return ourWizard.getMainPage(); + else + return null; + } + + /** + * Get the SystemConnectionForm of the main page of SystemNewConnectionWizard, which + * contains all user enter connection attributes + */ + public SystemConnectionForm getMainPageForm() + { + SystemNewConnectionWizard ourWizard = getNewConnectionWizard(); + if (ourWizard != null) + return ourWizard.getMainPageForm(); + 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 new file mode 100644 index 00000000000..195d65455ab --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemWizard.java @@ -0,0 +1,454 @@ +/******************************************************************************** + * 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.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.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.dialogs.SystemWizardDialog; +import org.eclipse.rse.ui.view.ISystemTree; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.widgets.Display; +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}. + *

    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. + *

    + *

    Using this base class for wizards offers the following advantages over just using the + * eclipse Wizard class: + *

    + *
      + *
    • 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. + *
    • The overall wizard title and image can be set via the constructor or setter methods. + *
    • 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. + *
    • 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. + *
    • 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. + *
    • 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. + *
    • Supports setting the viewer that launched this wizard, as wizards often need to know this so they can update the UI upon Finish. + *
    • Supports a {@link #wasCancelled()} method so callers can easily test if the wizard was cancelled/dismissed by the user. + *
    • Supports a {@link #setMinimumPageSize(int, int)} method to set the minimum width and height of the wizard. + *
    • 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. + *
    • Supports a simple {@link #setBusyCursor(boolean)} method to toggle the cursor between busy and normal + *
    + *

    To use this class, :

    + *
      + *
    1. Subclass it. + *
    2. In your constructor, call {@link #setHelp(String)} to set the overall help, if desired. + *
    3. In your constructor, call {@link #setWizardPageTitle(String)} to set the title to use for all pages, if desired. + *
    4. Override {@link #addPages()} to add your {@link org.eclipse.rse.ui.wizards.AbstractSystemWizardPage pages} via calls to addPage(IWizardPage). + *
    5. 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. + *
    + * + * @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; + private Cursor waitCursor; + + /** + * 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". + *

    + * 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. + *

    + * 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. + *

    + * 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. + */ + protected 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. + *

    + * 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. + */ + protected void setPageError(IWizardPage pageInError) + { + IWizardPage currentPage = getContainer().getCurrentPage(); + if (currentPage != pageInError) + { + SystemMessage msg = SystemPlugin.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 + *

    + * 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 + *

    + * Requires setOwningDialog to have been called, else returns -1 + */ + public int publicConvertHeightInCharsToPixels(int chars) + { + if (owningDialog != null) + return owningDialog.publicConvertHeightInCharsToPixels(chars); + else + return -1; + } + /** + * 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; + } + } + + // ---------------------------- + // 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. + *

    + * Return true if no errors, false to cancel the finish operation. + *

    + * 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 new file mode 100644 index 00000000000..98885f90d3d --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemWizardPage.java @@ -0,0 +1,518 @@ +/******************************************************************************** + * 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.wizard.IWizard; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.rse.core.SystemPlugin; +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.SystemWidgetHelpers; +import org.eclipse.rse.ui.messages.ISystemMessageLine; +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.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; + + + +/** + * Abstract class for system wizards pages. Using this class is most effective when used in + * conjunction with {@link org.eclipse.rse.ui.wizards.AbstractSystemWizard}. + *

    Using this base class for wizards offers the following advantages over just using the + * eclipse WizardPage class: + *

      + *
    • Designed to work in conjunction with {@link org.eclipse.rse.ui.wizards.AbstractSystemWizard}, + * propogating settings from the wizard to the individual wizard pages. + *
    • 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. + *
    • Supports a {@link #setHelp(String)} method to set the wizard page's overall contextual help + *
    • Implements {@link org.eclipse.rse.ui.messages.ISystemMessageLine} so supports setting error messages as + * either strings or, preferably, {@link org.eclipse.rse.ui.messages.SystemMessage} objects. + *
    • Supports an {@link #setInputObject(Object) input-object}, as passed from the wizard, which in turn is passed from the action. + *
    • Supports automatic assignment of unique mnemonics for all input-capable controls on the page, to add in accessibility. + *
    • Supports setting a default-focus control, which gets initial focus when the page is shown. + *
    • Supports helper methods to aid in population of the client area: {@link #addSeparatorLine(Composite,int)}, + * {@link #addFillerLine(Composite,int)} and {@link #addGrowableFillerLine(Composite,int)}. + *
    • Supports a simple {@link #setBusyCursor(boolean)} method to toggle the cursor between busy and normal + *
    + * + *

    To use this class, :

    + *
      + *
    1. Subclass it. + *
    2. Decide whether to use the overall wizard default pages title or have a unique title for this page. Use the appropriate constructor. + *
    3. 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. + *
    4. 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}. + *
    5. Override {@link #getInitialFocusControl()} to return the control to gain initial focus on this page, or null if there are no input controls. + *
    6. Override {@link #performFinish()} to perform input validation when Finish is pressed. Return true if validated ok, false if not. + *
    7. 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. + *
    8. Typically you will also supply protected getter methods to get the user-entered data, for use by your wizard class. + *
    + * + *

    For error validation when there are multiple input fields on the page, there are two different approaches you can take:

    + *
      + *
    1. 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.
      + * 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. + *
    2. 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.
      + * 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. + *
    + *

    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 SystemMessageLine msgLine; + private String helpId; + private Composite parentComposite; + private SystemMessage pendingMessage, pendingErrorMessage; + //private Hashtable helpIdPerControl; + private Cursor waitCursor; + + /** + * 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)}. + *

    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. + *

    + * 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(ISystemWizard wizard, + String pageName, String pageDescription) + { + this(wizard, pageName, null, pageDescription); + } + + // ------------------------ + // CONFIGURATION METHODS... + // ------------------------ + + /** + * Configuration method.
    + * For setting the overall help for the wizard page. + *

    + * This id is stored, and then applied to each of the input-capable + * controls in the main composite returned from createContents. + *

    + * Call this first to set the default help, then call {@link #setHelp(Control, String)} per individual + * control if control-unique help is desired. + */ + 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.
    + * For setting control-specific help for a control on the wizard page. + *

    + * 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); + } + + /** + * Configuration method.
    + * For explicitly setting input object. Automatically propogated by the parent wizard. + */ + public void setInputObject(Object inputObject) + { + this.input = inputObject; + } + + // ------------------------ + // GETTER METHODS... + // ------------------------ + /** + * Getter method.
    + * For explicitly getting input object. + */ + public Object getInputObject() + { + return input; + } + /** + * Getter method.
    + * Return the help Id as set in {@link #setHelp(String)} + */ + public String getHelpContextId() + { + return helpId; + } + /** + * Getter method.
    + * 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.
    + * Create the page contents here. + *

    + * 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.
    + * Return the Control to be given initial focus. + *

    + * Child classes must override this, but can return null. + */ + protected abstract Control getInitialFocusControl(); + + /** + * Abstract method.
    + * Perform error checking of the page contents, returning true only if there are no errors. + *

    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 + // ----------------------- + /** + * Parent override.
    + * 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, false); + 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); + } +// dwd configureMessageLine(); + msgLine = new SystemMessageLine(myComposite); + msgLine.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true)); + if (pendingMessage!=null) + setMessage(pendingMessage); + if (pendingErrorMessage!=null) + setErrorMessage(pendingErrorMessage); +// dwd setControl(c); + setControl(myComposite); + } + + /** + * Apply mnemonic to the content composite. + * @param c the composite. + */ + protected void applyMnemonics(Composite c) { + SystemWidgetHelpers.setWizardPageMnemonics(c); + } + + /** + * Parent override.
    + * 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... + // ----------------------------- + + /** + * ISystemMessageLine method.
    + * 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(); + } + + /** + * ISystemMessageLine method.
    + * Clears the currently displayed message. + */ + public void clearMessage() + { + if (msgLine!=null) + msgLine.clearMessage(); + } + + /** + * ISystemMessageLine method.
    + * Get the currently displayed error text. + * @return The error message. If no error message is displayed null is returned. + */ + public SystemMessage getSystemErrorMessage() + { + if (msgLine!=null) + return msgLine.getSystemErrorMessage(); + else + return null; + } + + /** + * ISystemMessageLine method.
    + * 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) + { + if (message != null) + msgLine.setErrorMessage(message); + else + msgLine.clearErrorMessage(); + } + else // not configured yet + pendingErrorMessage = message; + } + /** + * ISystemMessageLine method.
    + * Convenience method to set an error message from an exception + */ + public void setErrorMessage(Throwable exc) + { + if (msgLine != null) + msgLine.setErrorMessage(exc); + else + { + SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_UNEXPECTED); + msg.makeSubstitution(exc); + pendingErrorMessage = msg; + } + } + /** + * ISystemMessageLine method.
    + * 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 (msgLine != null) + msgLine.setErrorMessage(message); +// super.setErrorMessage(message); +// if (msgLine != null) +// ((SystemDialogPageMessageLine)msgLine).internalSetErrorMessage(message); + } + + /** + * ISystemMessageLine method.
    + * 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 // not configured yet + pendingMessage = message; + } + /** + * ISystemMessageLine method.
    + * 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) + { + if (msgLine!=null) + msgLine.setMessage(message); +// super.setMessage(message); +// if (msgLine!=null) +// ((SystemDialogPageMessageLine)msgLine).internalSetMessage(message); + } + + // --------------- + // 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); + 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; + } + } + + /** + * Helper method
    + * 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
    + * 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
    + * 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
    + * Configure the message line + */ +// private void configureMessageLine() +// { +// msgLine = SystemDialogPageMessageLine.createWizardMsgLine(this); +// if (msgLine!=null) +// { +// if (pendingMessage!=null) +// setMessage(pendingMessage); +// if (pendingErrorMessage!=null) +// setErrorMessage(pendingErrorMessage); +// } +// } + + /** + * Internal method
    + * 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/ISubSystemPropertiesWizardPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISubSystemPropertiesWizardPage.java new file mode 100644 index 00000000000..8baf5043f0f --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISubSystemPropertiesWizardPage.java @@ -0,0 +1,24 @@ +/******************************************************************************** + * 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.wizards; + +import org.eclipse.rse.core.subsystems.ISubSystem; + +public interface ISubSystemPropertiesWizardPage +{ + public boolean applyValues(ISubSystem ss); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemNewConnectionWizardMainPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemNewConnectionWizardMainPage.java new file mode 100644 index 00000000000..f447c51c9c9 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemNewConnectionWizardMainPage.java @@ -0,0 +1,84 @@ +/******************************************************************************** + * 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.rse.model.IHost; +import org.eclipse.rse.ui.validators.ISystemValidator; + + + + +/** + * Interface for new Connection (ie Definition) wizard main page classes + */ +public interface ISystemNewConnectionWizardMainPage extends ISystemWizardPage +{ + + public String getSystemType(); + public String getConnectionName(); + public String getHostName(); + public String getConnectionDescription(); + public String getDefaultUserId(); + public int getDefaultUserIdLocation(); + public String getProfileName(); + /** + * Call this to restrict the system type that the user is allowed to choose + */ + public void restrictSystemType(String systemType); + /** + * Call this to restrict the system types that the user is allowed to choose + */ + public void restrictSystemTypes(String[] systemTypes); + + /** + * Call this to specify a validator for the connection name. It will be called per keystroke. + */ + public void setConnectionNameValidators(ISystemValidator[] v); + /** + * Call this to specify a validator for the hostname. It will be called per keystroke. + */ + public void setHostNameValidator(ISystemValidator v); + /** + * Call this to specify a validator for the userId. It will be called per keystroke. + */ + public void setUserIdValidator(ISystemValidator v); + /** + * This method 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); + /** + * Preset the connection name + */ + public void setConnectionName(String name); + /** + * Preset the host name + */ + public void setHostName(String name); + /** + * Set the profile names to show in the combo + */ + public void setProfileNames(String[] names); + /** + * Set the profile name to preselect + */ + public void setProfileNamePreSelection(String name); + /** + * Set the currently selected connection so as to better initialize input fields + */ + public void setCurrentlySelectedConnection(IHost connection); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemNewConnectionWizardPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemNewConnectionWizardPage.java new file mode 100644 index 00000000000..bdc9a0dddee --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemNewConnectionWizardPage.java @@ -0,0 +1,50 @@ +/******************************************************************************** + * 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.wizard.IWizard; +import org.eclipse.jface.wizard.IWizardPage; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; + + +/** + * Interface that all subsystem factory supplied pages contributed to the New Connection wizard + * must implement. + * @see org.eclipse.rse.ui.wizards.AbstractSystemNewConnectionWizardPage + * @see org.eclipse.rse.core.subsystems.ISubSystemConfiguration#getNewConnectionWizardPages(IWizard) + */ +public interface ISystemNewConnectionWizardPage extends IWizardPage +{ + + /** + * This is called when the users presses Finish. All that should be done here is validation + * of the input, returning 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. + *

    + * Return true if the page is complete and has no errors + */ + public boolean isPageComplete(); + + /** + * Return the subsystem factory that supplied this page + */ + public ISubSystemConfiguration getSubSystemFactory(); +} \ 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 new file mode 100644 index 00000000000..6ad2d52736d --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemWizard.java @@ -0,0 +1,105 @@ +/******************************************************************************** + * 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. + *

    + * 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". + *

    + * 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 new file mode 100644 index 00000000000..8d98d1a6219 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemWizardPage.java @@ -0,0 +1,53 @@ +/******************************************************************************** + * 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. + *

    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. + *

    + * 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/SubSystemServiceWizardPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SubSystemServiceWizardPage.java new file mode 100644 index 00000000000..dfc96069f89 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SubSystemServiceWizardPage.java @@ -0,0 +1,188 @@ +/******************************************************************************** + * 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.wizards; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.servicesubsystem.IServiceSubSystem; +import org.eclipse.rse.core.servicesubsystem.IServiceSubSystemConfiguration; +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.model.DummyHost; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemRegistry; +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 class SubSystemServiceWizardPage extends AbstractSystemNewConnectionWizardPage implements ISubSystemPropertiesWizardPage +{ + private ServicesForm _form; + private IServiceSubSystemConfiguration _selectedFactory; + 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) + { + _form = new ServicesForm(getMessageLine()); + Control control = _form.createContents(parent); + + ServiceElement[] elements = getServiceElements(); + _root = new RootServiceElement(elements); + _form.init(_root); + + return control; + } + + protected ServiceElement[] getServiceElements() + { + if (_serviceElements == null) + { + + + IServiceSubSystemConfiguration currentFactory = (IServiceSubSystemConfiguration)getSubSystemFactory(); + IServiceSubSystemConfiguration[] factories = getServiceSubSystemFactories(getMainPage().getSystemType(), currentFactory.getServiceType()); + + IHost dummyHost = null; + if (getWizard() instanceof SystemNewConnectionWizard) + { + dummyHost = ((SystemNewConnectionWizard)getWizard()).getDummyHost(); + } + + // create elements for each + _serviceElements = new ServiceElement[factories.length]; + for (int i = 0; i < factories.length; i++) + { + IServiceSubSystemConfiguration factory = factories[i]; + _serviceElements[i] = new FactoryServiceElement(dummyHost, factory); + + + if (factory == currentFactory) + { + _serviceElements[i].setSelected(true); + } + } + } + return _serviceElements; + } + + protected IServiceSubSystemConfiguration[] getServiceSubSystemFactories(String systemType, Class serviceType) + { + List results = new ArrayList(); + ISystemRegistry sr = SystemPlugin.getTheSystemRegistry(); + ISubSystemConfiguration[] factories = sr.getSubSystemConfigurationsBySystemType(systemType); + + for (int i = 0; i < factories.length; i++) + { + ISubSystemConfiguration factory = factories[i]; + if (factory instanceof IServiceSubSystemConfiguration) + { + IServiceSubSystemConfiguration sfactory = (IServiceSubSystemConfiguration)factory; + if (sfactory.getServiceType() == serviceType) + { + + results.add(sfactory); + } + } + } + + return (IServiceSubSystemConfiguration[])results.toArray(new IServiceSubSystemConfiguration[results.size()]); + } + + public boolean isPageComplete() + { + return true; + } + + public boolean performFinish() + { + if (_root != null) + { + _root.commit(); + _selectedFactory = ((FactoryServiceElement)_form.getSelectedService()).getFactory(); + } + return true; + } + + public boolean applyValues(ISubSystem ss) + { + if (_selectedFactory != null) + { + IServiceSubSystemConfiguration currentFactory = (IServiceSubSystemConfiguration)ss.getSubSystemConfiguration(); + if (currentFactory != null) + { + + if (_selectedFactory != currentFactory) + { + ((IServiceSubSystem)ss).switchServiceFactory(_selectedFactory); + } + } + } + return true; + } + + protected IConnectorService getCustomConnectorService(IServiceSubSystemConfiguration config) + { + ServiceElement[] children = _root.getChildren(); + for (int i = 0; i < children.length; i++) + { + ServiceElement child = (ServiceElement)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/SystemNewConnectionWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewConnectionWizard.java new file mode 100644 index 00000000000..d508da493f5 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewConnectionWizard.java @@ -0,0 +1,520 @@ +/******************************************************************************** + * 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.wizards; +import java.util.Hashtable; +import java.util.Vector; + +import org.eclipse.jface.wizard.IWizardPage; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.rse.core.ISystemTypes; +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.SystemPerspectiveHelpers; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter; +import org.eclipse.rse.model.DummyHost; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.SystemStartHere; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.services.clientserver.messages.SystemMessageException; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.ISystemPreferencesConstants; +import org.eclipse.rse.ui.SystemConnectionForm; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.messages.SystemMessageDialog; + +/** + * Wizard for creating a new remote systems connection. + */ +public class SystemNewConnectionWizard + extends AbstractSystemWizard + +{ + + private ISystemNewConnectionWizardMainPage mainPage; + private SystemNewConnectionWizardRenameProfilePage rnmProfilePage; + private ISystemNewConnectionWizardPage[] subsystemFactorySuppliedWizardPages; + private Hashtable 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 currentlySelectedConnection = null; + private String[] restrictSystemTypesTo; + private static String lastProfile = null; + private boolean showProfilePageInitially = true; + private IHost _dummyHost; + + /** + * Constructor + */ + public SystemNewConnectionWizard() + { + super(SystemResources.RESID_NEWCONN_TITLE, + SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWCONNECTIONWIZARD_ID)); + activeProfileNames = SystemStartHere.getSystemProfileManager().getActiveSystemProfileNames(); + super.setForcePreviousAndNextButtons(true); + super.setNeedsProgressMonitor(true); + } + + /** + * Call this to restrict the system type that the user is allowed to choose + */ + public void restrictSystemType(String systemType) + { + restrictSystemTypesTo = new String[1]; + restrictSystemTypesTo[0] = systemType; + if (mainPage != null) + mainPage.restrictSystemTypes(restrictSystemTypesTo); + } + /** + * Call this to restrict the system types that the user is allowed to choose + */ + public void restrictSystemTypes(String[] systemTypes) + { + this.restrictSystemTypesTo = systemTypes; + if (mainPage != null) + mainPage.restrictSystemTypes(systemTypes); + } + + public IHost getDummyHost() + { + if (_dummyHost == null) + { + _dummyHost = new DummyHost(mainPage.getHostName(), mainPage.getSystemType()); + } + return _dummyHost; + } + + /** + * Creates the wizard pages. + * This method is an override from the parent Wizard class. + */ + public void addPages() + { + try { + mainPage = createMainPage(restrictSystemTypesTo); + mainPage.setConnectionNameValidators(SystemConnectionForm.getConnectionNameValidators()); + mainPage.setCurrentlySelectedConnection(currentlySelectedConnection); + if (defaultUserId != null) + mainPage.setUserId(defaultUserId); + if (defaultConnectionName != null) + mainPage.setConnectionName(defaultConnectionName); + if (defaultHostName != null) + mainPage.setHostName(defaultHostName); + + if (restrictSystemTypesTo != null) + mainPage.restrictSystemTypes(restrictSystemTypesTo); + + ISystemProfile defaultProfile = SystemStartHere.getSystemProfileManager().getDefaultPrivateSystemProfile(); + + showProfilePageInitially = SystemPlugin.getDefault().getShowProfilePageInitially(); + /* DKM - I don't think we should force profiles into the faces of users + * we no longer default to "private" so hopefully this would never be + * desirable + * + // if there is a default private profile, we might want to show the rename profile page + if (defaultProfile != null) + { + // make private profile equal to default profile + privateProfile = defaultProfile; + + // get the private profile index in the list of active profiles + for (int idx=0; (privateProfileIndex<0) && (idx0)) + lastProfile = activeProfileNames[0]; + } + if (lastProfile != null) + mainPage.setProfileNamePreSelection(lastProfile); + } + } + + addPage((WizardPage)mainPage); + + } catch (Exception exc) + { + SystemBasePlugin.logError("New connection: Error in createPages: ",exc); + } + } + + /** + * Creates the wizard's main page. + * This method is an override from the parent class. + */ + protected ISystemNewConnectionWizardMainPage createMainPage(String[] restrictSystemTypesTo) + { + String pageTitle = null; + if ((restrictSystemTypesTo==null) || (restrictSystemTypesTo.length != 1)) + pageTitle = SystemResources.RESID_NEWCONN_PAGE1_TITLE; + else + { + String onlySystemType = restrictSystemTypesTo[0]; + if (onlySystemType.equals(ISystemTypes.SYSTEMTYPE_LOCAL)) + pageTitle =SystemResources.RESID_NEWCONN_PAGE1_LOCAL_TITLE; + else + { + pageTitle =SystemResources.RESID_NEWCONN_PAGE1_REMOTE_TITLE; + pageTitle = SystemMessage.sub(pageTitle, "&1", onlySystemType); + } + } + mainPage = new SystemNewConnectionWizardDefaultMainPage(this, + pageTitle, + SystemResources.RESID_NEWCONN_PAGE1_DESCRIPTION); + setOutputObject(null); + return mainPage; + } + /** + * Set the currently selected connection. Used to better default entry fields. + */ + public void setCurrentlySelectedConnection(IHost conn) + { + this.currentlySelectedConnection = conn; + } + + /** + * 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.setUserId(userId); + } + + /** + * Preset the connection name + */ + public void setConnectionName(String name) + { + defaultConnectionName = name; + if (mainPage != null) + mainPage.setConnectionName(name); + } + /** + * Preset the host name + */ + public void setHostName(String name) + { + defaultHostName = name; + if (mainPage != null) + mainPage.setHostName(name); + } + + /** + * 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.performFinish(); + if (!ok) + setPageError((IWizardPage)mainPage); + else if (ok && hasAdditionalPages()) + { + for (int idx=0; ok && (idx0))// might be in product that doesn't have iSeries plugins + sr.expandSubSystem(objSubSystems[0]); + else + sr.expandHost(conn); + } + else + sr.expandHost(conn); + } + + lastProfile = mainPage.getProfileName(); + setOutputObject(conn); + } catch (Exception exc) + { + if (cursorSet) + setBusyCursor(false); + cursorSet = false; + String msg = "Exception creating connection "; + SystemBasePlugin.logError(msg, exc); + SystemMessageDialog.displayExceptionMessage(getShell(),exc); + ok = false; + } + } + //getShell().setCursor(null); + //busyCursor.dispose(); + if (cursorSet) + setBusyCursor(false); + return ok; + } + return ok; + } + + // callbacks from rename page + + /** + * Set the new profile name specified on the rename profile page... + */ + protected void setNewPrivateProfileName(String newName) + { + activeProfileNames[privateProfileIndex] = newName; + if (mainPage != null) + { + mainPage.setProfileNames(activeProfileNames); + mainPage.setProfileNamePreSelection(newName); + } + } + + /** + * Return the main page of this wizard + */ + public ISystemNewConnectionWizardMainPage getMainPage() + { + return mainPage; + } + /** + * Return the form of the main page of this wizard + */ + public SystemConnectionForm getMainPageForm() + { + return ((SystemNewConnectionWizardDefaultMainPage)mainPage).getForm(); + } + + // ---------------------------------------- + // CALLBACKS FROM SYSTEM CONNECTION PAGE... + // ---------------------------------------- + /** + * Event: the user has selected a system type. + */ + public void systemTypeSelected(String systemType, boolean duringInitialization) + { + subsystemFactorySuppliedWizardPages = getAdditionalWizardPages(systemType); + if (!duringInitialization) + getContainer().updateButtons(); + } + + /* + * Private method to get all the wizard pages from all the subsystem factories, given a + * system type. + */ + protected ISystemNewConnectionWizardPage[] getAdditionalWizardPages(String systemType) + { + // this query is expensive, so only do it once... + subsystemFactorySuppliedWizardPages = (ISystemNewConnectionWizardPage[])ssfWizardPagesPerSystemType.get(systemType); + if (subsystemFactorySuppliedWizardPages == null) + { + // query all affected subsystems for their list of additional wizard pages... + Vector additionalPages = new Vector(); + ISystemRegistry sr = SystemPlugin.getTheSystemRegistry(); + ISubSystemConfiguration[] factories = sr.getSubSystemConfigurationsBySystemType(systemType, true); + for (int idx=0; idx0); + } + + /** + * Return the first additional page to show when user presses Next on the main page + */ + protected IWizardPage getFirstAdditionalPage() + { + if ((subsystemFactorySuppliedWizardPages != null) && (subsystemFactorySuppliedWizardPages.length>0)) + { + IWizardPage previousPage = (IWizardPage)mainPage; + for (int idx=0; idx + *

  • Connection Name + *
  • Hostname/IP-address + *
  • UserId + *
  • Description + * + */ + +public class SystemNewConnectionWizardDefaultMainPage + //extends WizardPage + extends AbstractSystemWizardPage + implements ISystemMessages, ISystemNewConnectionWizardMainPage, + ISystemMessageLine, ISystemConnectionFormCaller +{ + protected String[] restrictSystemTypesTo; + protected SystemConnectionForm form; + protected String parentHelpId; + + /** + * Constructor. Use this when you want to supply your own title and + * description strings. + */ + public SystemNewConnectionWizardDefaultMainPage(Wizard wizard, + String title, + String description) + { + super(wizard, "NewConnection", title, description); + parentHelpId = SystemPlugin.HELPPREFIX + "wncc0000"; + setHelp(parentHelpId); + form = getForm(); + } + + /** + * Call this to restrict the system type that the user is allowed to choose + */ + public void restrictSystemType(String systemType) + { + restrictSystemTypesTo = new String[1]; + restrictSystemTypesTo[0] = systemType; + form.restrictSystemTypes(restrictSystemTypesTo); + } + /** + * Call this to restrict the system types that the user is allowed to choose + */ + public void restrictSystemTypes(String[] systemTypes) + { + restrictSystemTypesTo = systemTypes; + form.restrictSystemTypes(restrictSystemTypesTo); + } + + /** + * Return the main wizard typed + */ + private SystemNewConnectionWizard getOurWizard() + { + IWizard wizard = getWizard(); + if (wizard instanceof SystemNewConnectionWizard) + return (SystemNewConnectionWizard)wizard; + else + return null; + } + + + /** + * Overrride this if you want to supply your own form. This may be called + * multiple times so please only instantatiate if the form instance variable + * is null, and then return the form instance variable. + * @see org.eclipse.rse.ui.SystemConnectionForm + */ + protected SystemConnectionForm getForm() + { + if (form == null) + form = new SystemConnectionForm(this,this); + return form; + } + /** + * Call this to specify a validator for the connection name. It will be called per keystroke. + */ + public void setConnectionNameValidators(ISystemValidator[] v) + { + form.setConnectionNameValidators(v); + } + /** + * Call this to specify a validator for the hostname. It will be called per keystroke. + */ + public void setHostNameValidator(ISystemValidator v) + { + form.setHostNameValidator(v); + } + /** + * Call this to specify a validator for the userId. It will be called per keystroke. + */ + public void setUserIdValidator(ISystemValidator v) + { + form.setUserIdValidator(v); + } + + /** + * This method 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) + { + form.setUserId(userId); + } + + /** + * Set the profile names to show in the combo + */ + public void setProfileNames(String[] names) + { + form.setProfileNames(names); + } + /** + * Set the profile name to preselect + */ + public void setProfileNamePreSelection(String name) + { + form.setProfileNamePreSelection(name); + } + + /** + * Set the currently selected connection so as to better initialize input fields + */ + public void setCurrentlySelectedConnection(IHost connection) + { + form.setCurrentlySelectedConnection(connection); + } + + /** + * Preset the connection name + */ + public void setConnectionName(String name) + { + form.setConnectionName(name); + } + /** + * Preset the host name + */ + public void setHostName(String name) + { + form.setHostName(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. + */ + public Control createContents(Composite parent) + { + return form.createContents(parent, SystemConnectionForm.CREATE_MODE, parentHelpId); + } + /** + * Return the Control to be given initial focus. + * Override from parent. Return control to be given initial focus. + */ + protected Control getInitialFocusControl() + { + return form.getInitialFocusControl(); + } + + /** + * 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() + { + return form.verify(true); + } + + // --------------------------------- // + // METHODS FOR EXTRACTING USER DATA ... + // --------------------------------- // + /** + * Return user-entered System Type. + * Call this after finish ends successfully. + */ + public String getSystemType() + { + return form.getSystemType(); + } + /** + * Return user-entered Connection Name. + * Call this after finish ends successfully. + */ + public String getConnectionName() + { + return form.getConnectionName(); + } + /** + * Return user-entered Host Name. + * Call this after finish ends successfully. + */ + public String getHostName() + { + return form.getHostName(); + } + /** + * Return user-entered Default User Id. + * Call this after finish ends successfully. + */ + public String getDefaultUserId() + { + return form.getDefaultUserId(); + } + /** + * Return location where default user id is to be set. + * @see org.eclipse.rse.core.ISystemUserIdConstants + */ + public int getDefaultUserIdLocation() + { + return form.getUserIdLocation(); + } + /** + * Return user-entered Description. + * Call this after finish ends successfully. + */ + public String getConnectionDescription() + { + return form.getConnectionDescription(); + } + /** + * Return name of profile to contain new connection. + * Call this after finish ends successfully. + */ + public String getProfileName() + { + return form.getProfileName(); + } + + // 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() + { + //System.out.println("Inside isPageComplete. " + form.isPageComplete()); + if (form!=null) + return form.isPageComplete() && form.isConnectionUnique(); + else + return false; + } + + /** + * Intercept of WizardPage so we know when Next is pressed + */ + public IWizardPage getNextPage() + { + //if (wizard == null) + //return null; + //return wizard.getNextPage(this); + + SystemNewConnectionWizard newConnWizard = getOurWizard(); + if (newConnWizard != null) + { + return 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; + + SystemNewConnectionWizard newConnWizard = getOurWizard(); + if (newConnWizard != null) + { + return (isPageComplete() && newConnWizard.hasAdditionalPages() && form.isConnectionUnique()); + } + else + return super.canFlipToNextPage(); + } + + // ---------------------------------------- + // CALLBACKS FROM SYSTEM CONNECTION FORM... + // ---------------------------------------- + /** + * Event: the user has selected a system type. + */ + public void systemTypeSelected(String systemType, boolean duringInitialization) + { + SystemNewConnectionWizard newConnWizard = getOurWizard(); + if (newConnWizard != null) + { + newConnWizard.systemTypeSelected(systemType, duringInitialization); + } + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewConnectionWizardRenameProfilePage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewConnectionWizardRenameProfilePage.java new file mode 100644 index 00000000000..ec5452928ea --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewConnectionWizardRenameProfilePage.java @@ -0,0 +1,166 @@ +/******************************************************************************** + * 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.wizard.Wizard; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemProfileForm; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.messages.ISystemMessageLine; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + + +/** + * First page of the New Connection wizard when creating + * the very first connection. + *

    + * This page asks for a unique personal name for the private profile. + */ + +public class SystemNewConnectionWizardRenameProfilePage + extends AbstractSystemWizardPage + implements ISystemMessages, + ISystemMessageLine +{ + + protected SystemProfileForm form; + + /** + * Constructor. + */ + public SystemNewConnectionWizardRenameProfilePage(Wizard wizard) + { + super(wizard, "RenamePrivateProfile", + SystemResources.RESID_RENAMEDEFAULTPROFILE_PAGE1_TITLE, + SystemResources.RESID_RENAMEDEFAULTPROFILE_PAGE1_DESCRIPTION); + form = getForm(); + setHelp(SystemPlugin.HELPPREFIX + "wncp0000"); + } + + /** + * Return our hosting wizard + */ + protected SystemNewConnectionWizard getOurWizard() + { + return (SystemNewConnectionWizard)getWizard(); + } + + /** + * Overrride this if you want to supply your own form. This may be called + * multiple times so please only instantatiate if the form instance variable + * is null, and then return the form instance variable. + * @see org.eclipse.rse.ui.SystemProfileForm + */ + protected SystemProfileForm getForm() + { + if (form == null) + form = new SystemProfileForm(this,this,null, true); + //SystemStartHere.getSystemProfileManager().getDefaultPrivateSystemProfile()); + return form; + } + /** + * 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) + { + Control c = form.createContents(parent); + form.getInitialFocusControl().setFocus(); + + String initProfileName = SystemPlugin.getLocalMachineName(); + int dotIndex = initProfileName.indexOf('.'); + + if (dotIndex != -1) { + initProfileName = initProfileName.substring(0, dotIndex); + } + + form.setProfileName(initProfileName); + + return c; + } + /** + * Return the Control to be given initial focus. + * Override from parent. Return control to be given initial focus. + */ + protected Control getInitialFocusControl() + { + return form.getInitialFocusControl(); + } + + /** + * 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() + { + return form.verify(); + } + + // --------------------------------- // + // METHODS FOR EXTRACTING USER DATA ... + // --------------------------------- // + /** + * Return name of profile to contain new connection. + * Call this after finish ends successfully. + */ + public String getProfileName() + { + return form.getProfileName(); + } + + // 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() + { + boolean ok = false; + if (form!=null) + { + ok = form.isPageComplete(); + if (ok + && isCurrentPage()) // defect 41831 + getOurWizard().setNewPrivateProfileName(form.getProfileName()); + } + return ok; + } +} \ 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 new file mode 100644 index 00000000000..37e09482c49 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewProfileWizard.java @@ -0,0 +1,104 @@ +/******************************************************************************** + * 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.wizards; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.SystemResources; +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, + SystemPlugin.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((WizardPage)mainPage); + //super.addPages(); + } catch (Exception exc) + { + SystemBasePlugin.logError("New connection: Error in createPages: ",exc); + } + } + + /** + * 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 = SystemPlugin.getTheSystemRegistry(); + String name = mainPage.getProfileName(); + boolean makeActive = mainPage.getMakeActive(); + try + { + sr.createSystemProfile(name,makeActive); + } catch (Exception exc) + { + String msg = "Exception creating profile "; + 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 new file mode 100644 index 00000000000..afb9f1a6386 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewProfileWizardMainPage.java @@ -0,0 +1,208 @@ +/******************************************************************************** + * 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.wizard.Wizard; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.SystemWidgetHelpers; +import org.eclipse.rse.ui.dialogs.SystemUserIdPerSystemTypeDialog; +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: + *

      + *
    • Profile name + *
    + */ + +public class SystemNewProfileWizardMainPage + extends AbstractSystemWizardPage + implements ISystemMessages, + 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 = SystemPlugin.HELPPREFIX + "wnpr"; + + /** + * Constructor. + */ + public SystemNewProfileWizardMainPage(Wizard wizard) + { + super(wizard, "NewProfile", + SystemResources.RESID_NEWPROFILE_PAGE1_TITLE, + SystemResources.RESID_NEWPROFILE_PAGE1_DESCRIPTION); + nameValidator = new ValidatorProfileName(SystemPlugin.getTheSystemRegistry().getAllSystemProfileNamesVector()); + setHelp(HELPID_PREFIX+"0000"); + } + + /** + * 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"); + + // 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"); + + // Verbage + addGrowableFillerLine(composite_prompts, nbrColumns); + addSeparatorLine(composite_prompts, nbrColumns); + SystemWidgetHelpers.createVerbage(composite_prompts, SystemResources.RESID_NEWPROFILE_VERBAGE, 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 ISystemValidator object. + * If the ISystemValidator reports an error the error message is displayed + * in the Dialog's message line. + * @see SystemUserIdPerSystemTypeDialog#setUserIdValidator(ISystemValidator) + */ + 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/SystemSubSystemsPropertiesWizardPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemSubSystemsPropertiesWizardPage.java new file mode 100644 index 00000000000..06075de05e1 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemSubSystemsPropertiesWizardPage.java @@ -0,0 +1,252 @@ +/******************************************************************************** + * 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 java.util.List; + +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.ui.ISystemVerifyListener; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.SystemWidgetHelpers; +import org.eclipse.rse.ui.propertypages.ISystemConnectionWizardErrorUpdater; +import org.eclipse.rse.ui.propertypages.ISystemConnectionWizardPropertyPage; +import org.eclipse.rse.ui.view.monitor.TabFolderLayout; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.ui.dialogs.PropertyPage; + + +/** + * Wizard page that display the property pages for a given subsystem in the + * connection + * + */ +public class SystemSubSystemsPropertiesWizardPage + extends AbstractSystemNewConnectionWizardPage + implements ISystemVerifyListener, ISubSystemPropertiesWizardPage +{ + + private CTabFolder _folder; + private List _propertyPages; + private String _lastHostName; + /** + * Constructor + */ + public SystemSubSystemsPropertiesWizardPage(IWizard wizard, ISubSystemConfiguration parentFactory, List propertyPages) + { + //super(wizard, parentFactory); todo: use this when we enable port + // selection + super( + wizard, + parentFactory, + parentFactory.getId(), + // removed subsystem append since not correct for some languages + parentFactory.getName(), + //+ " " + SystemResources.RESID_SUBSYSTEM_TYPE_VALUE), + //" SubSystem Properties", //TODO create + // message for + // this + //"Configure properties of this subsystem" + SystemResources.RESID_NEWCONN_SUBSYSTEMPAGE_DESCRIPTION + ); + _propertyPages = propertyPages; + } + + /** + * @see AbstractSystemWizardPage#getInitialFocusControl() + */ + protected Control getInitialFocusControl() + { + return getControl(); + } + + /* + * Updates wiard property pages with new hostname + */ + protected void hostNameUpdated(String hostName) + { + if (_folder != null) + { + for (int i = 0; i < _folder.getItemCount(); i++) + { + ISystemConnectionWizardPropertyPage page = + (ISystemConnectionWizardPropertyPage) _folder.getItem(i).getData(); + page.setHostname(hostName); + } + } + + } + + /** + * @see AbstractSystemWizardPage#createContents(Composite) + */ + public Control createContents(Composite parent) + { + int nbrColumns = 2; + Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns); + + _folder = new CTabFolder(composite_prompts, SWT.NONE); + _folder.setLayout(new TabFolderLayout()); + + int numAdded = 0; + for (int i = 0; i < _propertyPages.size(); i++) + { + PropertyPage page = (PropertyPage)_propertyPages.get(i); + if (page != null && page instanceof ISystemConnectionWizardPropertyPage) + { + ISystemConnectionWizardPropertyPage cpage = (ISystemConnectionWizardPropertyPage)page; + cpage.setSubSystemFactory(parentFactory); + + CTabItem titem = new CTabItem(_folder, SWT.NULL, numAdded); + titem.setData(page); + page.createControl(_folder); + titem.setText(page.getTitle()); + try + { + titem.setControl(page.getControl()); + + } + catch (Exception e) + { + // TODO why does the tabfolder hit exception the + // first tiem setcontrol is called? + } + + //set the hostname for the page in case it's required + cpage.setHostname(getMainPage().getHostName()); + cpage.setSystemType(getMainPage().getSystemType()); + + numAdded++; + } + + } + + + if (numAdded == 0) + { + + } + addVerifyListener(); + + return composite_prompts; + } + + /** + * @see ISystemWizardPage#performFinish() + */ + public boolean performFinish() + { + return true; + } + + public boolean applyValues(ISubSystem ss) + { + boolean result = true; + if (_folder != null) + { + for (int i = 0; i < _folder.getItemCount() && result; i++) + { + ISystemConnectionWizardPropertyPage page = + (ISystemConnectionWizardPropertyPage) _folder.getItem(i).getData(); + result = page.applyValues(ss.getConnectorService()); + } + } + return result; + } + + /** + * Return true if the page is complete, so to enable Finish. Called by + * wizard framework. + */ + public boolean isPageComplete() + { + String hostName = getMainPage().getHostName(); + if (!hostName.equals(_lastHostName)) + { + hostNameUpdated(hostName); + _lastHostName = hostName; + } + boolean result = true; + if (_folder != null) + { + for (int i = 0; i < _folder.getItemCount() && result; i++) + { + if (_folder.getItem(i).getData() instanceof ISystemConnectionWizardErrorUpdater) + { + ISystemConnectionWizardErrorUpdater page = + (ISystemConnectionWizardErrorUpdater) _folder.getItem(i).getData(); + result = page.isPageComplete(); + } + } + } + return result; + + } + + protected void addVerifyListener() + { + if (_folder != null) + { + for (int i = 0; i < _folder.getItemCount(); i++) + { + if (_folder.getItem(i).getData() instanceof ISystemConnectionWizardErrorUpdater) + { + ISystemConnectionWizardErrorUpdater page = + (ISystemConnectionWizardErrorUpdater) _folder.getItem(i).getData(); + page.addVerifyListener(this); + } + } + } + } + + /* (non-Javadoc) + * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent) + */ + public void handleVerifyComplete() + { + boolean complete = isPageComplete(); + if (!complete) + { + if (_folder != null) + { + for (int i = 0; i < _folder.getItemCount(); i++) + { + if (_folder.getItem(i).getData() instanceof ISystemConnectionWizardErrorUpdater) + { + ISystemConnectionWizardErrorUpdater page = + (ISystemConnectionWizardErrorUpdater) _folder.getItem(i).getData(); + String error = page.getTheErrorMessage(); + if (error != null && !error.equals("")) + { + setErrorMessage(_folder.getItem(i).getText() + ": " + page.getTheErrorMessage()); + } + } + } + } + } + else + { + clearErrorMessage(); + } + setPageComplete(complete); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/about.html b/rse/plugins/org.eclipse.rse.ui/about.html new file mode 100644 index 00000000000..6f6b96c4c87 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/about.html @@ -0,0 +1,22 @@ + + + +About + + + +

    About This Content

    + +

    February 24, 2005

    +

    License

    + +

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

    + +

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

    + + + \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/build.properties b/rse/plugins/org.eclipse.rse.ui/build.properties new file mode 100644 index 00000000000..11abb04e674 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/build.properties @@ -0,0 +1,33 @@ +output.systems.jar = bin/ +bin.includes = HelpContexts.xml,\ + about.ini,\ + about.mappings,\ + about.properties,\ + messageFile.dtd,\ + plugin.properties,\ + plugin.xml,\ + systemResources.properties,\ + systemmessages.xml,\ + systems.jar,\ + icons/,\ + about.htm,\ + about.html,\ + META-INF/,\ + schema/ +source.systems.jar = references/,\ + filters/,\ + model/,\ + subsystems/,\ + systems/,\ + persistence/,\ + UI/ +jars.compile.order = systems.jar +src.includes = META-INF/,\ + HelpContexts.xml,\ + about.html,\ + icons/,\ + messageFile.dtd,\ + plugin.properties,\ + plugin.xml,\ + schema/,\ + systemmessages.xml diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilter.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilter.java new file mode 100644 index 00000000000..1eae824cf36 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilter.java @@ -0,0 +1,653 @@ +/******************************************************************************** + * 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.filters; +import java.util.Vector; + +import org.eclipse.rse.model.IRSEModelObject; +import org.eclipse.rse.references.ISystemReferencedObject; + + +/** + * + * A representation of the model object 'System Filter'. + * + * + *

    + * The following features are supported: + *

      + *
    • {@link org.eclipse.rse.filters.ISystemFilter#getName Name}
    • + *
    • {@link org.eclipse.rse.filters.ISystemFilter#getType Type}
    • + *
    • {@link org.eclipse.rse.filters.ISystemFilter#isSupportsNestedFilters Supports Nested Filters}
    • + *
    • {@link org.eclipse.rse.filters.ISystemFilter#getRelativeOrder Relative Order}
    • + *
    • {@link org.eclipse.rse.filters.ISystemFilter#isDefault Default}
    • + *
    • {@link org.eclipse.rse.filters.ISystemFilter#isStringsCaseSensitive Strings Case Sensitive}
    • + *
    • {@link org.eclipse.rse.filters.ISystemFilter#isPromptable Promptable}
    • + *
    • {@link org.eclipse.rse.filters.ISystemFilter#isSupportsDuplicateFilterStrings Supports Duplicate Filter Strings}
    • + *
    • {@link org.eclipse.rse.filters.ISystemFilter#isNonDeletable Non Deletable}
    • + *
    • {@link org.eclipse.rse.filters.ISystemFilter#isNonRenamable Non Renamable}
    • + *
    • {@link org.eclipse.rse.filters.ISystemFilter#isNonChangable Non Changable}
    • + *
    • {@link org.eclipse.rse.filters.ISystemFilter#isStringsNonChangable Strings Non Changable}
    • + *
    • {@link org.eclipse.rse.filters.ISystemFilter#getRelease Release}
    • + *
    • {@link org.eclipse.rse.filters.ISystemFilter#isSingleFilterStringOnly Single Filter String Only}
    • + *
    • {@link org.eclipse.rse.filters.ISystemFilter#getNestedFilters Nested Filters}
    • + *
    • {@link org.eclipse.rse.filters.ISystemFilter#getParentFilter Parent Filter}
    • + *
    • {@link org.eclipse.rse.filters.ISystemFilter#getStrings Strings}
    • + *
    + *

    + * + */ +/** + * @lastgen interface SystemFilterPool extends SystemReferencedObject, SystemFilterContainer {} + */ +public interface ISystemFilter extends ISystemReferencedObject, ISystemFilterContainer, IRSEModelObject +{ + /** + * + * + * @generated + */ + String copyright = "(c) Copyright IBM Corporation 2002, 2004."; + + /** + * Returns the value of the 'Name' attribute. + * + *

    + * If the meaning of the 'Name' attribute isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @see org.eclipse.rse.filters.FiltersPackage#getSystemFilter_Name() + * @model + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Returns the value of the 'Type' attribute. + * + *

    + * If the meaning of the 'Type' attribute isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Type' attribute. + * @see #setType(String) + * @see org.eclipse.rse.filters.FiltersPackage#getSystemFilter_Type() + * @model + * @generated + */ + String getType(); + + /** + * Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#getType Type}' attribute. + * + * + * @param value the new value of the 'Type' attribute. + * @see #getType() + * @generated + */ + void setType(String value); + + /** + * Returns the value of the 'Supports Nested Filters' attribute. + * + *

    + * If the meaning of the 'Supports Nested Filters' attribute isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Supports Nested Filters' attribute. + * @see #setSupportsNestedFilters(boolean) + * @see org.eclipse.rse.filters.FiltersPackage#getSystemFilter_SupportsNestedFilters() + * @model + * @generated + */ + boolean isSupportsNestedFilters(); + + /** + * Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isSupportsNestedFilters Supports Nested Filters}' attribute. + * + * + * @param value the new value of the 'Supports Nested Filters' attribute. + * @see #isSupportsNestedFilters() + * @generated + */ + void setSupportsNestedFilters(boolean value); + + /** + * Returns the value of the 'Relative Order' attribute. + * + *

    + * If the meaning of the 'Relative Order' attribute isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Relative Order' attribute. + * @see #setRelativeOrder(int) + * @see org.eclipse.rse.filters.FiltersPackage#getSystemFilter_RelativeOrder() + * @model + * @generated + */ + int getRelativeOrder(); + + /** + * Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#getRelativeOrder Relative Order}' attribute. + * + * + * @param value the new value of the 'Relative Order' attribute. + * @see #getRelativeOrder() + * @generated + */ + void setRelativeOrder(int value); + + /** + * Returns the value of the 'Default' attribute. + * + *

    + * If the meaning of the 'Default' attribute isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Default' attribute. + * @see #setDefault(boolean) + * @see org.eclipse.rse.filters.FiltersPackage#getSystemFilter_Default() + * @model + * @generated + */ + boolean isDefault(); + + /** + * Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isDefault Default}' attribute. + * + * + * @param value the new value of the 'Default' attribute. + * @see #isDefault() + * @generated + */ + void setDefault(boolean value); + + /** + * Returns the value of the 'Strings Case Sensitive' attribute. + * + *

    + * If the meaning of the 'Strings Case Sensitive' attribute isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Strings Case Sensitive' attribute. + * @see #isSetStringsCaseSensitive() + * @see #unsetStringsCaseSensitive() + * @see #setStringsCaseSensitive(boolean) + * @see org.eclipse.rse.filters.FiltersPackage#getSystemFilter_StringsCaseSensitive() + * @model unsettable="true" + * @generated + */ + boolean isStringsCaseSensitive(); + + /** + * Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isStringsCaseSensitive Strings Case Sensitive}' attribute. + * + * + * @param value the new value of the 'Strings Case Sensitive' attribute. + * @see #isSetStringsCaseSensitive() + * @see #unsetStringsCaseSensitive() + * @see #isStringsCaseSensitive() + * @generated + */ + void setStringsCaseSensitive(boolean value); + + /** + * Unsets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isStringsCaseSensitive Strings Case Sensitive}' attribute. + * + * + * @see #isSetStringsCaseSensitive() + * @see #isStringsCaseSensitive() + * @see #setStringsCaseSensitive(boolean) + * @generated + */ + void unsetStringsCaseSensitive(); + + /** + * Returns whether the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isStringsCaseSensitive Strings Case Sensitive}' attribute is set. + * + * + * @return whether the value of the 'Strings Case Sensitive' attribute is set. + * @see #unsetStringsCaseSensitive() + * @see #isStringsCaseSensitive() + * @see #setStringsCaseSensitive(boolean) + * @generated + */ + boolean isSetStringsCaseSensitive(); + + /** + * Returns the value of the 'Promptable' attribute. + * + *

    + * If the meaning of the 'Promptable' attribute isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Promptable' attribute. + * @see #setPromptable(boolean) + * @see org.eclipse.rse.filters.FiltersPackage#getSystemFilter_Promptable() + * @model + * @generated + */ + boolean isPromptable(); + + /** + * Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isPromptable Promptable}' attribute. + * + * + * @param value the new value of the 'Promptable' attribute. + * @see #isPromptable() + * @generated + */ + void setPromptable(boolean value); + + /** + * Returns the value of the 'Supports Duplicate Filter Strings' attribute. + * + *

    + * If the meaning of the 'Supports Duplicate Filter Strings' attribute isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Supports Duplicate Filter Strings' attribute. + * @see #setSupportsDuplicateFilterStrings(boolean) + * @see org.eclipse.rse.filters.FiltersPackage#getSystemFilter_SupportsDuplicateFilterStrings() + * @model + * @generated + */ + boolean isSupportsDuplicateFilterStrings(); + + /** + * Does this support duplicate filter strings? Calls mof-generated isSupportsDuplicateFilterStrings. + */ + public boolean supportsDuplicateFilterStrings(); + + /** + * Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isSupportsDuplicateFilterStrings Supports Duplicate Filter Strings}' attribute. + * + * + * @param value the new value of the 'Supports Duplicate Filter Strings' attribute. + * @see #isSupportsDuplicateFilterStrings() + * @generated + */ + void setSupportsDuplicateFilterStrings(boolean value); + + /** + * Returns the value of the 'Non Deletable' attribute. + * + *

    + * If the meaning of the 'Non Deletable' attribute isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Non Deletable' attribute. + * @see #setNonDeletable(boolean) + * @see org.eclipse.rse.filters.FiltersPackage#getSystemFilter_NonDeletable() + * @model + * @generated + */ + boolean isNonDeletable(); + + /** + * Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isNonDeletable Non Deletable}' attribute. + * + * + * @param value the new value of the 'Non Deletable' attribute. + * @see #isNonDeletable() + * @generated + */ + void setNonDeletable(boolean value); + + /** + * Returns the value of the 'Non Renamable' attribute. + * + *

    + * If the meaning of the 'Non Renamable' attribute isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Non Renamable' attribute. + * @see #setNonRenamable(boolean) + * @see org.eclipse.rse.filters.FiltersPackage#getSystemFilter_NonRenamable() + * @model + * @generated + */ + boolean isNonRenamable(); + + /** + * Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isNonRenamable Non Renamable}' attribute. + * + * + * @param value the new value of the 'Non Renamable' attribute. + * @see #isNonRenamable() + * @generated + */ + void setNonRenamable(boolean value); + + /** + * Returns the value of the 'Non Changable' attribute. + * + *

    + * If the meaning of the 'Non Changable' attribute isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Non Changable' attribute. + * @see #setNonChangable(boolean) + * @see org.eclipse.rse.filters.FiltersPackage#getSystemFilter_NonChangable() + * @model + * @generated + */ + boolean isNonChangable(); + + /** + * Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isNonChangable Non Changable}' attribute. + * + * + * @param value the new value of the 'Non Changable' attribute. + * @see #isNonChangable() + * @generated + */ + void setNonChangable(boolean value); + + /** + * Returns the value of the 'Strings Non Changable' attribute. + * + *

    + * If the meaning of the 'Strings Non Changable' attribute isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Strings Non Changable' attribute. + * @see #setStringsNonChangable(boolean) + * @see org.eclipse.rse.filters.FiltersPackage#getSystemFilter_StringsNonChangable() + * @model + * @generated + */ + boolean isStringsNonChangable(); + + /** + * Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isStringsNonChangable Strings Non Changable}' attribute. + * + * + * @param value the new value of the 'Strings Non Changable' attribute. + * @see #isStringsNonChangable() + * @generated + */ + void setStringsNonChangable(boolean value); + + /** + * Returns the value of the 'Release' attribute. + * + *

    + * If the meaning of the 'Release' attribute isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Release' attribute. + * @see #setRelease(int) + * @see org.eclipse.rse.filters.FiltersPackage#getSystemFilter_Release() + * @model + * @generated + */ + int getRelease(); + + /** + * Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#getRelease Release}' attribute. + * + * + * @param value the new value of the 'Release' attribute. + * @see #getRelease() + * @generated + */ + void setRelease(int value); + + /** + * Returns the value of the 'Single Filter String Only' attribute. + * + *

    + * If the meaning of the 'Single Filter String Only' attribute isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Single Filter String Only' attribute. + * @see #isSetSingleFilterStringOnly() + * @see #unsetSingleFilterStringOnly() + * @see #setSingleFilterStringOnly(boolean) + * @see org.eclipse.rse.filters.FiltersPackage#getSystemFilter_SingleFilterStringOnly() + * @model unsettable="true" + * @generated + */ + boolean isSingleFilterStringOnly(); + + /** + * Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isSingleFilterStringOnly Single Filter String Only}' attribute. + * + * + * @param value the new value of the 'Single Filter String Only' attribute. + * @see #isSetSingleFilterStringOnly() + * @see #unsetSingleFilterStringOnly() + * @see #isSingleFilterStringOnly() + * @generated + */ + void setSingleFilterStringOnly(boolean value); + + /** + * Unsets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isSingleFilterStringOnly Single Filter String Only}' attribute. + * + * + * @see #isSetSingleFilterStringOnly() + * @see #isSingleFilterStringOnly() + * @see #setSingleFilterStringOnly(boolean) + * @generated + */ + void unsetSingleFilterStringOnly(); + + /** + * Returns whether the value of the '{@link org.eclipse.rse.filters.ISystemFilter#isSingleFilterStringOnly Single Filter String Only}' attribute is set. + * + * + * @return whether the value of the 'Single Filter String Only' attribute is set. + * @see #unsetSingleFilterStringOnly() + * @see #isSingleFilterStringOnly() + * @see #setSingleFilterStringOnly(boolean) + * @generated + */ + boolean isSetSingleFilterStringOnly(); + + /** + * Returns the value of the 'Nested Filters' containment reference list. + * The list contents are of type {@link org.eclipse.rse.filters.ISystemFilter}. + * It is bidirectional and its opposite is '{@link org.eclipse.rse.filters.ISystemFilter#getParentFilter Parent Filter}'. + * + *

    + * If the meaning of the 'Nested Filters' containment reference list isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Nested Filters' containment reference list. + * @see org.eclipse.rse.filters.FiltersPackage#getSystemFilter_NestedFilters() + * @see org.eclipse.rse.filters.ISystemFilter#getParentFilter + * @generated + */ + java.util.List getNestedFilters(); + + /** + * Returns the value of the 'Parent Filter' container reference. + * It is bidirectional and its opposite is '{@link org.eclipse.rse.filters.ISystemFilter#getNestedFilters Nested Filters}'. + * + *

    + * If the meaning of the 'Parent Filter' container reference isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Parent Filter' container reference. + * @see #setParentFilter(ISystemFilter) + * @see org.eclipse.rse.filters.FiltersPackage#getSystemFilter_ParentFilter() + * @see org.eclipse.rse.filters.ISystemFilter#getNestedFilters + * @model opposite="nestedFilters" + * @generated + */ + ISystemFilter getParentFilter(); + + /** + * Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilter#getParentFilter Parent Filter}' container reference. + * + * + * @param value the new value of the 'Parent Filter' container reference. + * @see #getParentFilter() + * @generated + */ + void setParentFilter(ISystemFilter value); + + /** + * Returns the value of the 'Strings' containment reference list. + * The list contents are of type {@link org.eclipse.rse.filters.ISystemFilterString}. + * + *

    + * If the meaning of the 'Strings' containment reference list isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Strings' containment reference list. + * @see org.eclipse.rse.filters.FiltersPackage#getSystemFilter_Strings() + * @generated + */ + java.util.List getStrings(); + + /** + * Return the parent pool of this filter. For nested filters, we walk up the parent chain + * until we find the pool. + */ + public ISystemFilterPool getParentFilterPool(); + /** + * Internal use method to set the parent filter pool + */ + public void setParentFilterPool(ISystemFilterPool parentPool); + /** + * Set this filter's filter strings by giving a Vector of String objects + */ + public void setFilterStrings(Vector strings); + /** + * Set this filter's filter strings by giving an array of String objects + */ + public void setFilterStrings(String[] strings); + /** + * Get this filter's filter strings as a Vector of String objects + */ + public Vector getFilterStringsVector(); + /** + * Get this filter's filter strings as a Vector of FilterString objects + */ + public Vector getFilterStringObjectsVector(); + /** + * Get this filter's filter strings as an array + */ + public String[] getFilterStrings(); + /** + * Get this filter's filter string objects as an array + */ + public ISystemFilterString[] getSystemFilterStrings(); + /** + * Get the number of filter strings this filter currently has + */ + public int getFilterStringCount(); + /** + * Get a filter string given its string value + */ + public ISystemFilterString getSystemFilterString(String string); + /** + * Append a new filter string to this filter's list + */ + public ISystemFilterString addFilterString(String newString); + /** + * Insert a new filter string to this filter's list, at the given zero-based position + */ + public ISystemFilterString addFilterString(String newString, int position); + /** + * Update a new filter string's string value + */ + public void updateFilterString(ISystemFilterString filterString, String newValue); + /** + * Delete a filter string from this filter's list. + * @return the SystemFilterString object deleted, or null if not found + */ + public ISystemFilterString removeFilterString(String oldString); + /** + * Remove a filter string from this filter's list, given its zero-based position + * @return the SystemFilterString object deleted, or null if not found + */ + public ISystemFilterString removeFilterString(int position); + /** + * Remove a filter string from this filter's list, given its SystemFilterString object. + * @return true if the given string existed and hence was deleted. + */ + public boolean removeFilterString(ISystemFilterString filterString); + /** + * Move a given filter string to a given zero-based location + */ + public void moveSystemFilterString(int pos, ISystemFilterString filterString); + /** + * Copies a given filter string from this filter to another filter in this pool or another pool + * in this manager or another manager. + */ + public ISystemFilterString copySystemFilterString(ISystemFilter targetFilter, ISystemFilterString oldFilterString); + /** + * Return true if this filter is a nested filter or not. If not, its parent is the filter pool. + */ + public boolean isNested(); + /** + * Return true if this a transient or simple filter that is only created temporary "on the fly" + * and not intended to be saved or part of the filter framework. Eg it has no manager or provider. + *

    + * We always return false. + * @see SystemFilterSimple + */ + public boolean isTransient(); + /** + * Clones a given filter to the given target filter. + * All filter strings, and all nested filters, are copied. + * @param targetFilter new filter into which we copy all our data + */ + public void clone(ISystemFilter targetFilter); + /** + * Return the ISystemFilterContainer parent of this filter. Will be either + * a SystemFilterPool or a SystemFilter if this is a nested filter. + */ + public ISystemFilterContainer getParentFilterContainer(); + /** + * Return the caller which instantiated the filter pool manager overseeing this filter framework instance + */ + public ISystemFilterPoolManagerProvider getProvider(); + +} // SystemFilter \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterConstants.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterConstants.java new file mode 100644 index 00000000000..d5477da716a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterConstants.java @@ -0,0 +1,41 @@ +/******************************************************************************** + * 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.filters; +/** + * Constants used throughout filters framework. + */ +public interface ISystemFilterConstants extends ISystemFilterSavePolicies +{ + /** + * Parameter value on create operations when a restore should be attempted first + */ + public static final boolean TRY_TO_RESTORE_YES = true; + /** + * Parameter value on create operations when no restore should be attempted first + */ + public static final boolean TRY_TO_RESTORE_NO = false; + + /** + * Suffix used when persisting data to a file. + */ + public static final String SAVEFILE_SUFFIX = ".xmi"; + + /** + * Default value for the type attribute for filter pools, filters and filterstrings + */ + public static final String DEFAULT_TYPE = "default"; +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterContainer.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterContainer.java new file mode 100644 index 00000000000..966971ef78c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterContainer.java @@ -0,0 +1,111 @@ +/******************************************************************************** + * 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.filters; +// + +import java.util.Vector; + +import org.eclipse.rse.persistence.IRSEPersistableContainer; + +/** + * Filter containers are any objects that contain filters. + * This includes filter pools and filters themselves. + */ +public interface ISystemFilterContainer extends IRSEPersistableContainer +{ + /** + * Return the filter pool manager managing this collection of filter pools and their filters. + */ + public ISystemFilterPoolManager getSystemFilterPoolManager(); + /** + * @return The value of the StringsCaseSensitive attribute + * Are filter strings in this filter case sensitive? + * If not set locally, queries the parent filter pool manager's atttribute. + */ + public boolean areStringsCaseSensitive(); + /** + * Creates a new system filter within this container (SystemFilterPool or SystemFilter) + * @param data Optional transient data you want stored in the created filter. Can be null. + * @param aliasName The name to give the new filter. Must be unique for this pool. + * @param filterStrings The list of String objects that represent the filter strings. + */ + public ISystemFilter createSystemFilter(String aliasName, Vector filterStrings); + /** + * Adds given filter to the list. + *

    PLEASE NOTE: + *

      + *
    • createSystemFilter calls this method for you! + *
    • this is a no-op if a filter with the same aliasname already exists + *
    + * @param filter SystemFilter object to add + * @return true if added, false if filter with this aliasname already existed. + */ + public boolean addSystemFilter(ISystemFilter filter); + /** + * Return Vector of String objects: the names of existing filters in this container. + * Needed by name validators for New and Rename actions to verify new name is unique. + */ + public Vector getSystemFilterNames(); + /** + * Return a Vector of the filters contained in this filter container. + */ + public Vector getSystemFiltersVector(); + /** + * Return an array of the filters contained in this filter container. + */ + public ISystemFilter[] getSystemFilters(); + /** + * Return a system filter given its name + */ + public ISystemFilter getSystemFilter(String filterName); + /** + * Return the parent pool of this container. + * If this is itself a pool, returns "this". + * Else, for a nested filter, returns the pool that is the ultimate parent of this filter. + */ + public ISystemFilterPool getSystemFilterPool(); + /** + * Return how many filters are defined in this filter container + */ + public int getSystemFilterCount(); + /** + * Removes a given filter from the list. + * @param filter SystemFilter object to remove + */ + public void deleteSystemFilter(ISystemFilter filter); + /** + * Renames a given filter in the list. + * @param filter SystemFilter object to rename + * @param newName New name to assign it. Assumes unique checking already done. + */ + public void renameSystemFilter(ISystemFilter filter, String newName); + /** + * Return a given filter's zero-based location + */ + public int getSystemFilterPosition(ISystemFilter filter); + /** + * Move a given filter to a given zero-based location + */ + public void moveSystemFilter(int pos, ISystemFilter filter); + /** + * Updates a given filter in the list. + * @param filter SystemFilter object to update + * @param newName New name to assign it. Assumes unique checking already done. + * @param newStrings New strings to assign it. Replaces current strings. + */ + public void updateSystemFilter(ISystemFilter filter, String newName, String[] newStrings); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterContainerReference.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterContainerReference.java new file mode 100644 index 00000000000..b5a0b8cdbe3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterContainerReference.java @@ -0,0 +1,81 @@ +/******************************************************************************** + * 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.filters; + +import org.eclipse.rse.core.subsystems.ISubSystem; + +/** + * Both SystemFilter and SystemFilterPool contain filters, so the + * common methods for filters are abstracted out in SystemFilterContainer, + * which both classes implement. + * Both SystemFilterReference and SystemFilterPoolReference hold references + * to SystemFilterContainer objects (either SystemFilter or SystemFilterPool). + * There are a couple of methods that are common to both classes, related to + * getting an array of references to the filters that are held by the referenced + * object. + * This interface captures those common methods, and both + * SystemFilterReferenceImpl and SystemFilterPoolReferenceImpl + * implement this interface and hence these methods. + * @see org.eclipse.rse.internal.filters.SystemFilterContainerReferenceCommonMethods + */ +public interface ISystemFilterContainerReference +{ + /** + * Return the object to which we hold a reference. This is either + * SystemFilter or SystemFilterPool. Since both implement + * SystemFilterContainer, that is what we return. + */ + public ISystemFilterContainer getReferencedSystemFilterContainer(); + /** + * Build and return an array of SystemFilterReference objects. + * Each object is created new. There is one for each of the filters + * in the reference SystemFilter or SystemFilterPool. + * For performance reasons, we will cache this array and only + * return a fresh one if something changes in the underlying + * filter list. + */ + public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem); + /** + * Return an existing reference to a given system filter. + * If no reference currently exists to this filter, returns null. + * @see #getSystemFilterReference(ISystemFilter) + */ + public ISystemFilterReference getExistingSystemFilterReference(ISubSystem subSystem, ISystemFilter filter); + /** + * Create a single filter refererence to a given filter + * If there already is a reference to this filter, it is returned. + * If not, a new reference is created and appended to the end of the existing filter reference array. + * @see #getExistingSystemFilterReference(ISystemFilter) + */ + public ISystemFilterReference getSystemFilterReference(ISubSystem subSystem, ISystemFilter filter); + + /** + * Return the name of the SystemFilter or SystemFilterPool that we reference. + * For such objects this is what we show in the GUI. + */ + public String getName(); + + /** + * Return true if the referenced pool or filter has filters. + */ + public boolean hasFilters(); + + /** + * Return count of the number of filters in the referenced pool or filter + */ + public int getFilterCount(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterNamingPolicy.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterNamingPolicy.java new file mode 100644 index 00000000000..a485a856a0e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterNamingPolicy.java @@ -0,0 +1,68 @@ +/******************************************************************************** + * 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.filters; +/** + * Allows tool writers to specify the naming standards for the + * persistance files and folders involved with filters. + *

    + * Note that not all methods will be used for all saving policies. + *

    + * @see org.eclipse.rse.internal.filters.SystemFilterNamingPolicy#getNamingPolicy() + */ +public interface ISystemFilterNamingPolicy +{ + /** + * Get the unqualified save file name for the given SystemFilterPoolManager object name. + * Do NOT include the extension, as .xmi will be added. + */ + public String getManagerSaveFileName(String managerName); + /** + * Get the unqualified save file name for the given SystemFilterPoolReferenceManager object name. + * Do NOT include the extension, as .xmi will be added. + */ + public String getReferenceManagerSaveFileName(String managerName); + /** + * Get the unqualified save file name for the given SystemFilterPool object name. + * Do NOT include the extension, as .xmi will be added. + */ + public String getFilterPoolSaveFileName(String poolName); + /** + * Get the file name prefix for all pool files. + * Used to deduce the saved pools by examining the file system + */ + public String getFilterPoolSaveFileNamePrefix(); + /** + * Get the folder name for the given SystemFilterPool object name. + */ + public String getFilterPoolFolderName(String poolName); + /** + * Get the folder name prefix for all pool folders. + * Used to deduce the saved pools by examining the file system + */ + public String getFilterPoolFolderNamePrefix(); + /** + * Get the unqualified save file name for the given SystemFilter object name + * Do NOT include the extension, as .xmi will be added. + */ + public String getFilterSaveFileName(String filterName); + /** + * Get the file name prefix for all filter files. + * Used to deduce the saved pools by examining the file system + */ + public String getFilterSaveFileNamePrefix(); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPool.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPool.java new file mode 100644 index 00000000000..a7a63bedd9a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPool.java @@ -0,0 +1,343 @@ +/******************************************************************************** + * 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.filters; +import org.eclipse.rse.model.IRSEModelObject; +import org.eclipse.rse.references.ISystemPersistableReferencedObject; + + +/** + * This interface represents a system filter pool, which is a means of + * grouping filters.
    + * By default this is represented as a folder on disk, with each filter + * stored as a file in that folder. + */ +/** + * @lastgen interface SystemFilterPool extends SystemPersistableReferencedObject, SystemFilterContainer {} + */ +public interface ISystemFilterPool extends ISystemPersistableReferencedObject, ISystemFilterContainer, IRSEModelObject +{ + // external methods + /** + * Return the caller which instantiated the filter pool manager overseeing this filter framework instance + */ + public ISystemFilterPoolManagerProvider getProvider(); + /** + * Set the naming policy used when saving data to disk. + * @see org.eclipse.rse.filters.ISystemFilterNamingPolicy + */ + public void setNamingPolicy(ISystemFilterNamingPolicy namingPolicy); + /** + * Get the naming policy currently used when saving data to disk. + * @see org.eclipse.rse.filters.ISystemFilterNamingPolicy + */ + public ISystemFilterNamingPolicy getNamingPolicy(); + /** + * Does this filter support nested filters? + */ + public boolean supportsNestedFilters(); + /** + * Does this support duplicate filter strings? Calls mof-generated isSupportsDuplicateFilterStrings. + */ + public boolean supportsDuplicateFilterStrings(); + /** + * @return The value of the StringsCaseSensitive attribute + * Are filter strings in this filter case sensitive? + * If not set locally, queries the parent filter pool manager's atttribute. + */ + public boolean isStringsCaseSensitive(); + + /** + * Set the filter pool manager. + */ + public void setSystemFilterPoolManager(ISystemFilterPoolManager mgr); + /** + * Return the filter pool manager managing this collection of filter pools and their filters. + */ + public ISystemFilterPoolManager getSystemFilterPoolManager(); + /** + * This is to set transient data that is queryable via getFilterPoolData + */ + public void setSystemFilterPoolData(Object data); + /** + * Return transient data set via setFilterPoolData. + */ + public Object getSystemFilterPoolData(); + /** + * Clone this filter pools' attributes and filters into another filter pool. + * Assumes the core attributes were already set when filter pool was created: + *

      + *
    • Name + *
    • Deletable + *
    • Supports nested filters + *
    • Manager + *
    + * Attributes we clone: + *
      + *
    • Data + *
    • Type + *
    • Default + *
    + */ + public void cloneSystemFilterPool(ISystemFilterPool targetPool) + throws Exception; + /** + * Copy a system filter to this or another filter pool. + */ + public ISystemFilter copySystemFilter(ISystemFilterPool targetPool, ISystemFilter oldFilter, String newName) + throws Exception; + /** + * Order filters according to user preferences. + *

    + * While the framework has all the code necessary to arrange filters and save/restore + * that arrangement, you may choose to use preferences instead of this support. + * In this case, call this method and pass in the saved and sorted filter name list. + *

    + * Called by someone after restore. + */ + public void orderSystemFilters(String[] names); + /** + * Set the save file policy. See constants in SystemFilterConstants. One of: + *

      + *
    • SAVE_POLICY_ONE_FILE_PER_POOL + *
    • SAVE_POLICY_ONE_FILE_PER_FILTER + *
    + * This method is called by the SystemFilterPoolManager. + */ + public void setSavePolicy(int policy); + + + public String getId(); + + /** + * @generated This field/method will be replaced during code generation + * @return The value of the Name attribute + */ + String getName(); + + + /** + * @generated This field/method will be replaced during code generation + * @param value The new value of the Name attribute + */ + void setName(String value); + + /** + * @generated This field/method will be replaced during code generation + * @return The value of the Type attribute + * Allows tools to have typed filter pools + */ + String getType(); + + /** + * @generated This field/method will be replaced during code generation + * @param value The new value of the Type attribute + */ + void setType(String value); + + /** + * @generated This field/method will be replaced during code generation + * @return The value of the SupportsNestedFilters attribute + */ + boolean isSupportsNestedFilters(); + + /** + * @generated This field/method will be replaced during code generation + * @param value The new value of the SupportsNestedFilters attribute + */ + void setSupportsNestedFilters(boolean value); + + /** + * @generated This field/method will be replaced during code generation + * @return The value of the Deletable attribute + */ + boolean isDeletable(); + + /** + * @generated This field/method will be replaced during code generation + * @param value The new value of the Deletable attribute + */ + void setDeletable(boolean value); + + /** + * @generated This field/method will be replaced during code generation + * @return The value of the Default attribute + * Is this a default vendor-supplied pool versus user-created pool + */ + boolean isDefault(); + + /** + * @generated This field/method will be replaced during code generation + * @param value The new value of the Default attribute + */ + void setDefault(boolean value); + + /** + * @generated This field/method will be replaced during code generation + * @param value The new value of the StringsCaseSensitive attribute + */ + void setStringsCaseSensitive(boolean value); + + /** + * @generated This field/method will be replaced during code generation + * Unsets the StringsCaseSensitive attribute + */ + void unsetStringsCaseSensitive(); + + /** + * @generated This field/method will be replaced during code generation + * @return true if the StringsCaseSensitive attribute has been set + */ + boolean isSetStringsCaseSensitive(); + + /** + * @generated This field/method will be replaced during code generation + * @return The list of Filters references + */ + java.util.List getFilters(); + + /** + * @generated This field/method will be replaced during code generation + * @return The value of the SupportsDuplicateFilterStrings attribute + */ + boolean isSupportsDuplicateFilterStrings(); + + /** + * @generated This field/method will be replaced during code generation + * @param value The new value of the SupportsDuplicateFilterStrings attribute + */ + void setSupportsDuplicateFilterStrings(boolean value); + + /** + * @generated This field/method will be replaced during code generation + * @return The value of the Release attribute + * In what release was this created? Typically, will be the version and release + * times 10, as in 40 or 51. + */ + int getRelease(); + + /** + * @generated This field/method will be replaced during code generation + * @param value The new value of the Release attribute + */ + void setRelease(int value); + + /** + * Returns the value of the 'Single Filter String Only' attribute. + * + *

    + * If the meaning of the 'Single Filter String Only' attribute isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Single Filter String Only' attribute. + * @see #isSetSingleFilterStringOnly() + * @see #unsetSingleFilterStringOnly() + * @see #setSingleFilterStringOnly(boolean) + * @see org.eclipse.rse.filters.FiltersPackage#getSystemFilterPool_SingleFilterStringOnly() + * @model unsettable="true" + * @generated + */ + boolean isSingleFilterStringOnly(); + + /** + * Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilterPool#isSingleFilterStringOnly Single Filter String Only}' attribute. + * + * + * @param value the new value of the 'Single Filter String Only' attribute. + * @see #isSetSingleFilterStringOnly() + * @see #unsetSingleFilterStringOnly() + * @see #isSingleFilterStringOnly() + * @generated + */ + void setSingleFilterStringOnly(boolean value); + + /** + * Unsets the value of the '{@link org.eclipse.rse.filters.ISystemFilterPool#isSingleFilterStringOnly Single Filter String Only}' attribute. + * + * + * @see #isSetSingleFilterStringOnly() + * @see #isSingleFilterStringOnly() + * @see #setSingleFilterStringOnly(boolean) + * @generated + */ + void unsetSingleFilterStringOnly(); + + /** + * Returns whether the value of the '{@link org.eclipse.rse.filters.ISystemFilterPool#isSingleFilterStringOnly Single Filter String Only}' attribute is set. + * + * + * @return whether the value of the 'Single Filter String Only' attribute is set. + * @see #unsetSingleFilterStringOnly() + * @see #isSingleFilterStringOnly() + * @see #setSingleFilterStringOnly(boolean) + * @generated + */ + boolean isSetSingleFilterStringOnly(); + + /** + * Returns the value of the 'Owning Parent Name' attribute. + * + *

    + * If the meaning of the 'Owning Parent Name' attribute isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Owning Parent Name' attribute. + * @see #setOwningParentName(String) + * @see org.eclipse.rse.filters.FiltersPackage#getSystemFilterPool_OwningParentName() + * @model + * @generated + */ + String getOwningParentName(); + + /** + * Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilterPool#getOwningParentName Owning Parent Name}' attribute. + * + * + * @param value the new value of the 'Owning Parent Name' attribute. + * @see #getOwningParentName() + * @generated + */ + void setOwningParentName(String value); + + /** + * Returns the value of the 'Non Renamable' attribute. + * + *

    + * If the meaning of the 'Non Renamable' attribute isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Non Renamable' attribute. + * @see #setNonRenamable(boolean) + * @see org.eclipse.rse.filters.FiltersPackage#getSystemFilterPool_NonRenamable() + * @model + * @generated + */ + boolean isNonRenamable(); + + /** + * Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilterPool#isNonRenamable Non Renamable}' attribute. + * + * + * @param value the new value of the 'Non Renamable' attribute. + * @see #isNonRenamable() + * @generated + */ + void setNonRenamable(boolean value); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolManager.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolManager.java new file mode 100644 index 00000000000..ec07717e5b4 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolManager.java @@ -0,0 +1,634 @@ +/******************************************************************************** + * 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.filters; +import java.util.Vector; + +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.persistence.IRSEPersistableContainer; + + + + + +/** + * A filter pool manager manages filter pools. + *

    + * Each filter pool that is managed becomes a folder on disk. + *

    + * To create a filter pool manager instance, use the factory methods + * in SystemFilterPoolManagerImpl in the ...impl package. + * You must pass a folder that represents the anchor point for the + * pools managed by this manager instance. + *

    + * Depending on your tools' needs, you have four choices about how + * the filter pools and filters are persisted to disk. The decision is + * made at the time you instantiate the pool manager and is one of the + * following constants from the {@link SystemFilterConstants} interface: + *

      + *
    • SAVE_POLICY_ONE_FILE_PER_MANAGER - one file: mgrName.xmi + *
    • SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL - one file and folder per pool + *
    • SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER - one file per pool, all files in one folder + *
    • SAVE_POLICY_ONE_FILE_PER_FILTER - one file per filter, one folder per pool + *
    + *

    + * With the policy of one file per pool, there are two possibilities regarding + * the folder structure: + *

      + *
    • Each pool gets its own subfolder, and the pool's xmi file goes in + * the pool's unique subfolder: SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL + *
    • There are no subfolders per pool, all the xmi pool files go in the + * same folder as specified when creating this manager instance: + * SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER + *
    + *

    + * With the policy of one file per filter, each filter pool must have its own folder. + *

    + * With an instantiated filter pool manager (most tools will only need + * one such instance), you now simply call its methods to work with + * filter pools. For example, use it to: + *

      + *
    • Restore all filter pools from disk + *
    • Save all, or individual, filter pools to disk + *
    • Get a list of existing filter pools + *
    • Create filter pools + *
    • Delete filter pools + *
    • Re-order filter pools + *
    • Clone filter pools + *
    • Rename filter pools + *
    • Save all, or individual, filter pools + *
    + * All the underlying file system work is handled for you. + *

    + * Further, this is the front door for working with filters too. By forcing all + * filter related activity through a single point like this, we can ensure that + * all changes are saved to disk, and events are fired properly. + */ +/** + * @lastgen interface SystemFilterPoolManager {} + */ +public interface ISystemFilterPoolManager extends IRSEPersistableContainer +{ + // --------------------------------- + // ATTRIBUTE METHODS + // --------------------------------- + /** + * Return the caller which instantiated the filter pool manager + */ + public ISystemFilterPoolManagerProvider getProvider(); + + /** + * Return the owning profile for this provider + */ + public ISystemProfile getSystemProfile(); + + /** + * Set the caller instance which instantiated the filter pool manager. + * This is only recorded to enable getProvider from any filter framework object. + */ + public void setProvider(ISystemFilterPoolManagerProvider caller); + + /** + * This is to set transient data that is subsequently queryable. + */ + public void setSystemFilterPoolManagerData(Object data); + /** + * Return transient data set via setFilterPoolDataManager. + */ + public Object getSystemFilterPoolManagerData(); + /** + * Return the name of this manager. + * This matches the name of the folder, which is the parent of the individual filter pool folders. + */ + public String getName(); + +/** + * Set the name of this manager. + */ + public void setName(String name); + + /** + * Return attribute indicating if filter pools managed by this manager support nested filters. + */ + public boolean supportsNestedFilters(); + /** + * Return attribute indicating if filters managed by this manager support nested duplicate filter strings. + */ + public boolean supportsDuplicateFilterStrings(); + /** + * Set attribute indicating if filter pools managed by this manager support nested filters, by default. + */ + public void setSupportsNestedFilters(boolean supports); + + /** + * Set attribute indicating if filters managed by this manager support duplicate filter strings, by default. + */ + public void setSupportsDuplicateFilterStrings(boolean supports); + + /** + * @return The value of the StringsCaseSensitive attribute + * Are filter strings in this filter case sensitive? + */ + public boolean isStringsCaseSensitive(); + + /** + * @return The value of the StringsCaseSensitive attribute + * Are filter strings in this filter case sensitive? + * Same as isStringsCaseSensitive() + */ + public boolean areStringsCaseSensitive(); + + /** + * Return false if the instantiation of this filter pool manager resulting in a new manager versus a restoration + */ + public boolean wasRestored(); + + // --------------------------------- + // FILTER POOL METHODS + // --------------------------------- + /** + * Get array of filter pool names currently existing. + */ + public String[] getSystemFilterPoolNames(); + /** + * Get vector of filter pool names currently existing. + */ + public Vector getSystemFilterPoolNamesVector(); + + /** + * Return array of SystemFilterPools managed by this manager. + */ + public ISystemFilterPool[] getSystemFilterPools(); + + /** + * Given a filter pool name, return that filter pool object. + * If not found, returns null. + */ + public ISystemFilterPool getSystemFilterPool(String name); + + /** + * Return the first pool that has the default attribute set to true. + * If none found, returns null. + */ + public ISystemFilterPool getFirstDefaultSystemFilterPool(); + + /** + * Create a new filter pool. + * Inherits the following attributes from this manager: + *

      + *
    • data ... the transient data to be associated with every filter pool and filter + *
    • supportsNestedFilters ... whether filters in the pool can themselves contain filters + *
    + *

    + * If a pool of this name already exists, null will be returned. + *

    + * Depending on the save policy, a new folder to hold the pool may be created. Its name will + * be derived from the pool name. + *

    + * If the operation is successful, the pool will be saved to disk. + *

    + * If this operation fails unexpectedly, an exception will be thrown. + */ + public ISystemFilterPool createSystemFilterPool(String name, boolean isDeletable) + throws Exception; + + /** + * Delete a given filter pool. Dependending on the save policy, the + * appropriate file or folder on disk will also be deleted. + *

    + * Does the following: + *

      + *
    • Removes all references + *
    • Removes pool object from in-memory model + *
    • Removes folder from disk for policies of one folder per pool + *
    • Removes file from disk for policy of one file per pool + *
    • Saves model to disk for policy of one file per manager + *
    • Invalidates in-memory caches + *
    • Calls back to inform caller of this event + *
    + * @param pool The filter pool object to physically delete + */ + public void deleteSystemFilterPool(ISystemFilterPool pool) + throws Exception; + + /** + * Delete all existing filter pools. Call this when you are about to delete this manager, say. + */ + public void deleteAllSystemFilterPools(); + + /** + * Pre-test if we are going to run into any trouble renaming any of the files or folders + * used to persist a filter pool. + * @returns true if everything seems ok, false if a file/folder is in use. + */ + public boolean preTestRenameFilterPool(ISystemFilterPool pool) throws Exception; + /** + * Rename a given filter pool. Dependending on the save policy, the + * appropriate file or folder on disk will also be renamed. + *

    + * Does the following: + *

      + *
    • Renames referencing objects + *
    • Renames pool object in the in-memory model + *
    • Renames folder on disk for policies of one folder per pool + *
    • Renames file on disk for policy of one file per pool + *
    • Saves model to disk for policy of one file per manager + *
    • Invalidates in-memory caches + *
    + * @param pool The filter pool object to physically rename + * @param newName The new name to give the pool + */ + public void renameSystemFilterPool(ISystemFilterPool pool, String newName) + throws Exception; + + /** + * Copy the specified filter pool from this manager to this manager or another manager. + *

    + * Does the following: + *

      + *
    • Clones all filters within the pool + *
    • Clones all filter strings within each filter + *
    • Asks target manager to save to disk + *
    • Calls back to target manager provider, unless callbacks are suspended + *
    + * @param targetMgr The target manager to copy our filter pool to. Can be this manager, but target pool name must be unique. + * @param pool The filter pool to copy + * @param newName The new name to give the copied pool + * @return the new copy of the copied system filter pool + */ + public ISystemFilterPool copySystemFilterPool(ISystemFilterPoolManager targetMgr, ISystemFilterPool pool, String newName) + throws Exception; + + /** + * Copy all filter pools from this manager to another manager. + *

    + * Does the following: + *

      + *
    • Clones all filter pools + *
    • Clones all filters within each pool + *
    • Clones all filter strings within each filter + *
    • Asks target manager to save to disk + *
    • Does not callback to caller to fire events, assumes caller doesn't want to know + *
    + * @param targetMgr The target manager to copy our filter pools to + */ + public void copySystemFilterPools(ISystemFilterPoolManager targetMgr) + throws Exception; + + /** + * Move the specified filter pool from this manager to another manager. + *

    + * Does the following: + *

      + *
    • Performs a {@link #copySystemFilterPool(ISystemFilterPoolManager, ISystemFilterPool, String) copySystemFilterPool} operation. + *
    • If copy is successful, updates all references to reference the new copy. + *
    • If copy is successful, deletes original filter pool in this manager + *
    • If this final delete fails, deletes the copied version and restore original references + *
    • Asks target manager to save to disk + *
    • Saves this manager to disk + *
    • Calls back to both targer manager provider and this manager provider, unless callbacks are suspended + *
    + * @param targetMgr The target manager to move our filter pool to. Cannot be this manager. + * @param oldPool The filter pool to move + * @param newName The new name to give the moved pool + * @return the new copy of the moved system filter pool + */ + public ISystemFilterPool moveSystemFilterPool(ISystemFilterPoolManager targetMgr, ISystemFilterPool oldPool, String newName) + throws Exception; + + // --------------------------------- + // FILTER METHODS + // --------------------------------- + /** + * Creates a new system filter within the given filter container (either a filter pool, or + * a filter). This creates the filter, and then saves the filter pool. + *

    Calls back to provider to inform of the event (filterEventFilterCreated) + * @param parent The parent which is either a SystemFilterPool or a SystemFilter + * @param aliasName The name to give the new filter. Must be unique for this pool. + * @param filterStrings The list of String objects that represent the filter strings. + */ + public ISystemFilter createSystemFilter(ISystemFilterContainer parent, + String aliasName, Vector filterStrings) + throws Exception; + /** + * Creates a new system filter that is typed. + * Same as {@link #createSystemFilter(ISystemFilterContainer, String, Vector)} but + * takes a filter type as an additional parameter. + *

    + * A filter's type is an arbitrary string that is not interpreted or used by the base framework. This + * is for use entirely by tools who wish to support multiple types of filters and be able to launch unique + * actions per type, say. + * + * @param parent The parent which is either a SystemFilterPool or a SystemFilter + * @param aliasName The name to give the new filter. Must be unique for this pool. + * @param filterStrings The list of String objects that represent the filter strings. + * @param type The type of this filter + */ + public ISystemFilter createSystemFilter(ISystemFilterContainer parent, + String aliasName, Vector filterStrings, String type) + throws Exception; + /** + * Creates a new system filter that is typed and promptable + * Same as {@link #createSystemFilter(ISystemFilterContainer, String ,Vector, String)} but + * takes a boolean indicating if it is promptable. + *

    + * A promptable filter is one in which the user is prompted for information at expand time. + * There is no base filter framework support for this, but tools can query this attribute and + * do their own thing at expand time. + * + * @param parent The parent which is either a SystemFilterPool or a SystemFilter + * @param aliasName The name to give the new filter. Must be unique for this pool. + * @param filterStrings The list of String objects that represent the filter strings. + * @param type The type of this filter + * @param promptable Pass true if this is a promptable filter + */ + public ISystemFilter createSystemFilter(ISystemFilterContainer parent, + String aliasName, Vector filterStrings, String type, boolean promptable) + throws Exception; + + /** + * Delete an existing system filter. + * Does the following: + *

      + *
    • Removes filter from its parent in memory. + *
    • If appropriate for the save policy, deletes the filter's file from disk. + *
    • Save the SystemFilterPool which direct or indirectly contains the filter. + *
    • Calls back to provider to inform of the event (filterEventFilterDelete) + *
    + */ + public boolean deleteSystemFilter(ISystemFilter filter) + throws Exception; + /** + * Renames a filter. This is better than filter.setName(String newName) as it + * saves the parent pool to disk. + *

    + * Does the following: + *

      + *
    • Renames the object in the in-memory cache + *
    • If appropriate for the save policy, rename's the filter's file on disk. + *
    • Save parent filter pool's in-memory object to disk. + *
    • Calls back to provider to inform of the event (filterEventFilterRenamed) + *
    + */ + public void renameSystemFilter(ISystemFilter filter, String newName) + throws Exception; + + /** + * Updates a filter. This is better than doing it directly as it saves it to disk. + *

    + * Does the following: + *

      + *
    • Updates the object in the in-memory cache + *
    • Save parent filter pool's in-memory object to disk. + *
    • Calls back to provider to inform of the event (filterEventFilterUpdated). Will be two callbacks if the name is changed ((filterEventFilterRenamed) + *
    + */ + public void updateSystemFilter(ISystemFilter filter, String newName, String[] strings) + throws Exception; + + /** + * Sets a filter's type. This is better than calling filter.setType(String) directly as it saves the filter to disk after. + *

    + * A filter's type is an arbitrary string that is not interpreted or used by the base framework. This + * is for use entirely by tools who wish to support multiple types of filters and be able to launch unique + * actions per type, say. + * @param parent The parent which is either a SystemFilterPool or a SystemFilter + * @param type The type of this filter + */ + public void setSystemFilterType(ISystemFilter filter, String newType) + throws Exception; + + /** + * Copy a system filter to a pool in this or another filter manager. + */ + public ISystemFilter copySystemFilter(ISystemFilterPool targetPool, ISystemFilter oldFilter, String newName) + throws Exception; + + /** + * Return the zero-based position of a SystemFilter object within its container + */ + public int getSystemFilterPosition(ISystemFilter filter); + + /** + * Move a system filter to a pool in this or another filter manager. + * Does this by first copying the filter, and only if successful, deleting the old copy. + */ + public ISystemFilter moveSystemFilter(ISystemFilterPool targetPool, ISystemFilter oldFilter, String newName) + throws Exception; + + /** + * Move existing filters a given number of positions in the same container. + * 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.

    + *

    + * Does the following: + *

      + *
    • After the move, the pool containing the filter is saved to disk. + *
    • Calls back to provider to inform of the event (filterEventFiltersRePositioned) + *
    + * @param filters Array of SystemFilters to move. + * @param newPosition new zero-based position for the filters + */ + public void moveSystemFilters(ISystemFilter filters[], int delta) + throws Exception; + + /** + * Order filters according to user preferences. + *

    + * While the framework has all the code necessary to arrange filters and save/restore + * that arrangement, you may choose to use preferences instead of this support. + * In this case, call this method and pass in the saved and sorted filter name list. + *

    + * Called by someone after restore. + */ + public void orderSystemFilters(ISystemFilterPool pool, String[] names) throws Exception; + + // ------------------------------- + // SYSTEM FILTER STRING METHODS... + // ------------------------------- + /** + * Append a new filter string to the given filter's list + *

    + * Does the following: + *

      + *
    • Adds the filter string to the in-memory cache + *
    • Saves parent filter pool to disk. + *
    • Calls back to provider to inform it of this event (filterEventFilterStringCreated) + *
    + */ + public ISystemFilterString addSystemFilterString(ISystemFilter filter, String newString) throws Exception; + /** + * Insert a new filter string to the given filter's list, at the given zero-based position + *

    + * Does the following: + *

      + *
    • Adds the filter string to the in-memory cache + *
    • Saves parent filter pool to disk. + *
    • Calls back to provider to inform it of this event (filterEventFilterStringCreated) + *
    + */ + public ISystemFilterString addSystemFilterString(ISystemFilter filter, String newString, int position) throws Exception; + /** + * Remove a filter string from this filter's list, given its SystemFilterString object. + *

    + * Does the following: + *

      + *
    • Removes the filter string from the in-memory cache + *
    • Saves parent filter pool to disk. + *
    • Calls back to provider to inform it of this event (filterEventFilterStringDeleted) + *
    + * @return true if the given string existed and hence was deleted. + */ + public boolean removeSystemFilterString(ISystemFilter filter, ISystemFilterString filterString) throws Exception; + /** + * Delete a filter string from the given filter's list + *

    + * Does the following: + *

      + *
    • Removes the filter string from the in-memory cache + *
    • Saves parent filter pool to disk. + *
    • Calls back to provider to inform it of this event (filterEventFilterStringDeleted) + *
    + * @return true if given string was found and hence was deleted. + */ + public boolean removeSystemFilterString(ISystemFilter filter, String oldString) throws Exception; + /** + * Remove a filter string from the given filter's list, given its zero-based position + *

    + * Does the following: + *

      + *
    • Removes the filter string from the in-memory cache + *
    • Saves parent filter pool to disk. + *
    • Calls back to provider to inform it of this event (filterEventFilterStringDeleted) + *
    + * @return true if a string existed at the given position and hence was deleted. + */ + public boolean removeSystemFilterString(ISystemFilter filter, int position) throws Exception; + /** + * Update a filter string's string vale + *

    + * Does the following: + *

      + *
    • Update the filter string in the in-memory cache + *
    • Saves parent filter pool to disk. + *
    • Calls back to provider to inform it of this event (filterEventFilterStringUpdated) + *
    + */ + public void updateSystemFilterString(ISystemFilterString filterString, String newValue) throws Exception; + /** + * Return the zero-based position of a SystemFilterString object within its filter + */ + public int getSystemFilterStringPosition(ISystemFilterString filterString); + /** + * Copy a system filter string to a filter in this or another filter pool manager. + */ + public ISystemFilterString copySystemFilterString(ISystemFilter targetFilter, ISystemFilterString oldFilterString) + throws Exception; + /** + * Move a system filter string to a filter in this or another filter pool manager. + * Does this by doing a copy operation, then if successful doing a delete operation. + */ + public ISystemFilterString moveSystemFilterString(ISystemFilter targetFilter, ISystemFilterString oldFilterString) + throws Exception; + /** + * Move existing filter strings a given number of positions in the same filter + * 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.

    + *

    + * Does the following: + *

      + *
    • After the move, the filter pool containing the filter containing the filter strings is saved to disk. + *
    • Calls back to provider to inform of the event (filterEventFilterStringsRePositioned) + *
    + * @param filterStrings Array of SystemFilterStrings to move. + * @param newPosition new zero-based position for the filter strings + */ + public void moveSystemFilterStrings(ISystemFilterString filterStrings[], int delta) + throws Exception; + + // ----------------------------------- + // SUSPEND/RESUME CALLBACKS METHODS... + // ----------------------------------- + /** + * Suspend callbacks to the provider + */ + public void suspendCallbacks(boolean suspend); + + + + /** + * @generated This field/method will be replaced during code generation + * @return The value of the SupportsNestedFilters attribute + */ + boolean isSupportsNestedFilters(); + + /** + * @generated This field/method will be replaced during code generation + * @param value The new value of the StringsCaseSensitive attribute + */ + void setStringsCaseSensitive(boolean value); + + /** + * @generated This field/method will be replaced during code generation + * @return The list of Pools references + */ + java.util.List getPools(); + + /** + * @generated This field/method will be replaced during code generation + * @return The value of the SupportsDuplicateFilterStrings attribute + */ + boolean isSupportsDuplicateFilterStrings(); + + /** + * @generated This field/method will be replaced during code generation + * Unsets the SupportsDuplicateFilterStrings attribute + */ + void unsetSupportsDuplicateFilterStrings(); + + /** + * @generated This field/method will be replaced during code generation + * @return true if the SupportsDuplicateFilterStrings attribute has been set + */ + boolean isSetSupportsDuplicateFilterStrings(); + + /** + * Returns the value of the 'Single Filter String Only' attribute. + * + *

    + * If the meaning of the 'Single Filter String Only' attribute isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Single Filter String Only' attribute. + * @see #setSingleFilterStringOnly(boolean) + * @see org.eclipse.rse.filters.FiltersPackage#getSystemFilterPoolManager_SingleFilterStringOnly() + * @model + * @generated + */ + boolean isSingleFilterStringOnly(); + + /** + * Sets the value of the '{@link org.eclipse.rse.filters.ISystemFilterPoolManager#isSingleFilterStringOnly Single Filter String Only}' attribute. + * + * + * @param value the new value of the 'Single Filter String Only' attribute. + * @see #isSingleFilterStringOnly() + * @generated + */ + void setSingleFilterStringOnly(boolean value); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolManagerProvider.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolManagerProvider.java new file mode 100644 index 00000000000..24847141973 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolManagerProvider.java @@ -0,0 +1,132 @@ +/******************************************************************************** + * 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.filters; +import org.eclipse.core.runtime.IAdaptable; + +/** + * An interface for classes that instantiate SystemFilterPoolManager objects. + * This is the "caller" and as is recorded and recoverable from any object within + * the filter framework. This enables callers to get back instances of themselves + * given any filter object. Important when enabling UI actions against user + * selected filter framework objects + *

    + * Further, the goal is the allow all the filter framework UI actions to work + * independently, able to fully handle all actions without intervention on the + * provider's part. However, often the provider needs to be informed of all events + * in order to fire events to update its GUI. So this interface captures those + * callbacks that done to the provider for every interesting event. Should you + * not care about these, supply empty shells for these methods. + */ +public interface ISystemFilterPoolManagerProvider extends IAdaptable +{ + + /** + * Return the unique id for this provider + * @return + */ + public String getId(); + + /** + * Return the manager object for the given manager name. + */ + public ISystemFilterPoolManager getSystemFilterPoolManager(String managerName); + /** + * Return all the manager objects this provider owns + */ + public ISystemFilterPoolManager[] getSystemFilterPoolManagers(); + /** + * Return all the manager objects this provider owns, to which it wants + * to support referencing from the given filter reference manager. + *

    + * Called by SystemFilterPoolReferenceManager. + */ + public ISystemFilterPoolManager[] getReferencableSystemFilterPoolManagers(ISystemFilterPoolReferenceManager refMgr); + /** + * Last chance call, by a filter pool reference manager, when a reference to a filter + * pool is found but the referenced master filter pool is not found in those the reference + * manager by getSystemFilterPoolManagers(). + *

    + * If this returns null, then this broken reference will be deleted + */ + public ISystemFilterPool getSystemFilterPoolForBrokenReference(ISystemFilterPoolReferenceManager callingRefenceMgr, + String missingPoolMgrName, String missingPoolName); + + // --------------------- + // FILTER POOL EVENTS... + // --------------------- + /** + * A new filter pool has been created + */ + public void filterEventFilterPoolCreated(ISystemFilterPool newPool); + /** + * A filter pool has been deleted + */ + public void filterEventFilterPoolDeleted(ISystemFilterPool oldPool); + /** + * A filter pool has been renamed + */ + public void filterEventFilterPoolRenamed(ISystemFilterPool pool, String oldName); + /** + * One or more filter pools have been re-ordered within their manager + */ + public void filterEventFilterPoolsRePositioned(ISystemFilterPool[] pools, int delta); + + // --------------------- + // FILTER EVENTS... + // --------------------- + /** + * A new filter has been created + */ + public void filterEventFilterCreated(ISystemFilter newFilter); + /** + * A filter has been deleted + */ + public void filterEventFilterDeleted(ISystemFilter oldFilter); + /** + * A filter has been renamed + */ + public void filterEventFilterRenamed(ISystemFilter filter, String oldName); + /** + * A filter's strings have been updated + */ + public void filterEventFilterUpdated(ISystemFilter filter); + /** + * One or more filters have been re-ordered within their pool or filter (if nested) + */ + public void filterEventFiltersRePositioned(ISystemFilter[] filters, int delta); + + // ----------------------- + // FILTER STRING EVENTS... + // ----------------------- + /** + * A new filter string has been created + */ + public void filterEventFilterStringCreated(ISystemFilterString newFilterString); + /** + * A filter string has been deleted + */ + public void filterEventFilterStringDeleted(ISystemFilterString oldFilterString); + /** + * A filter string has been updated + */ + public void filterEventFilterStringUpdated(ISystemFilterString filterString); + /** + * One or more filters have been re-ordered within their filter + */ + public void filterEventFilterStringsRePositioned(ISystemFilterString[] filterStrings, int delta); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolReference.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolReference.java new file mode 100644 index 00000000000..9cd0fb5c8ad --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolReference.java @@ -0,0 +1,81 @@ +/******************************************************************************** + * 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.filters; +import org.eclipse.rse.model.IRSEModelObject; +import org.eclipse.rse.references.ISystemPersistableReferencingObject; + + +/** + * Interface implemented by references to filter pools. Filter pools are stored at the profile + * level, while subsystems contain references to one or more pools. A pool can be referenced + * by multiple connections. Pools don't go away until explicitly deleted by the user, regardless + * of their reference count. + */ +/** + * @lastgen interface SystemFilterPoolReference extends SystemPersistableReferencingObject, ISystemPersistableReferencingObject, SystemFilterContainerReference {} + */ +public interface ISystemFilterPoolReference extends ISystemPersistableReferencingObject, ISystemFilterContainerReference, IRSEModelObject +{ + /** + * Return the reference manager which is managing this filter reference + * framework object. + */ + public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager(); + + /** + * Return the object which instantiated the pool reference manager object. + * Makes it easy to get back to the point of origin, given any filter reference + * framework object + */ + public ISystemFilterPoolReferenceManagerProvider getProvider(); + + /** + * Return name of the filter pool we reference + * The pool name is stored qualified by the manager name, + * so we first have to strip it off. + */ + public String getReferencedFilterPoolName(); + /** + * Return name of the filter pool manager containing the pool we reference. + * The pool name is stored qualified by the manager name, + * so we get it from there. + */ + public String getReferencedFilterPoolManagerName(); + + /** + * Reset the name of the filter pool we reference. + * Called on filter pool rename operations + */ + public void resetReferencedFilterPoolName(String newName); + + + /** + * Set the filter pool that we reference. + * This also calls addReference(this) on that pool! + */ + public void setReferenceToFilterPool(ISystemFilterPool pool); + + /** + * Return referenced filter pool object + */ + public ISystemFilterPool getReferencedFilterPool(); + + /** + * Return fully qualified name that includes the filter pool managers name + */ + public String getFullName(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolReferenceManager.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolReferenceManager.java new file mode 100644 index 00000000000..b0e01a8277f --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolReferenceManager.java @@ -0,0 +1,268 @@ +/******************************************************************************** + * 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.filters; +import java.util.Vector; + +import org.eclipse.core.resources.IFolder; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.references.ISystemBasePersistableReferenceManager; + + +/** + * This class manages a persistable list of objects each of which reference + * a filter pool. This class builds on the parent class SystemPersistableReferenceManager, + * offering convenience versions of the parent methods that are typed to the + * classes in the filters framework. + */ +/** + * @lastgen interface SystemFilterPoolReferenceManager extends SystemPersistableReferenceManager {} + */ +public interface ISystemFilterPoolReferenceManager extends ISystemBasePersistableReferenceManager +{ + /** + * Get the object which instantiated this instance of the filter pool reference manager. + * This is also available from any filter reference framework object. + */ + public ISystemFilterPoolReferenceManagerProvider getProvider(); + /** + * Set the object which instantiated this instance of the filter pool reference manager. + * This makes it available to retrieve from any filter reference framework object, + * via the ubiquitous getProvider interface method. + */ + public void setProvider(ISystemFilterPoolReferenceManagerProvider caller); + /** + * Turn off callbacks to the provider until turned on again. + */ + public void setProviderEventNotification(boolean fireEvents); + // ------------------------------------------------------------ + // Methods for setting and querying related filterpool manager + // ------------------------------------------------------------ + /* + * Set the managers of the master list of filter pools, from which + * objects in this list reference. + * NOW DELETED SO THAT WE DYNAMICALLY QUERY THIS LIST FROM THE + * ASSOCIATED SYSTEMFILTERPOOLMANAGER PROVIDER, SO IT IS ALWAYS UP + * TO DATE. psc. + */ + //public void setSystemFilterPoolManagers(SystemFilterPoolManager[] mgrs); + /** + * Set the associated master pool manager provider. Note the provider + * typically manages multiple pool managers and we manage references + * across those. + */ + public void setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider poolMgrProvider); + /** + * Get the associated master pool manager provider. Note the provider + * typically manages multiple pool managers and we manage references + * across those. + */ + public ISystemFilterPoolManagerProvider getSystemFilterPoolManagerProvider(); + /** + * Get the managers of the master list of filter pools, from which + * objects in this list reference. + */ + public ISystemFilterPoolManager[] getSystemFilterPoolManagers(); + /** + * Get the managers of the master list of filter pools, from which + * objects in this list reference, but which are not in the list of + * managers our pool manager supplier gives us. That is, these are + * references to filter pools outside the expected list. + * @return null if no unmatched managers found, else an array of such managers. + */ + public ISystemFilterPoolManager[] getAdditionalSystemFilterPoolManagers(); + /** + * Set the default manager of the master list of filter pools, from which + * objects in this list reference. + */ + public void setDefaultSystemFilterPoolManager(ISystemFilterPoolManager mgr); + /** + * Get the default manager of the master list of filter pools, from which + * objects in this list reference. + */ + public ISystemFilterPoolManager getDefaultSystemFilterPoolManager(); + + // --------------------------------------------------- + // Methods that work on FilterPool referencing objects + // --------------------------------------------------- + /** + * Ask each referenced pool for its name, and update it. + * Called after the name of the pool or its manager changes. + */ + public void regenerateReferencedSystemFilterPoolNames(); + /** + * Return array of SystemFilterPoolReference objects. + * Result will never be null, although it may be an array of length zero. + */ + public ISystemFilterPoolReference[] getSystemFilterPoolReferences(); + /** + * In one shot, set the filter pool references + *

    Calls back to inform provider + * @param array of filter pool reference objects to set the list to. + * @param deReference true to first de-reference all objects in the existing list. + */ + public void setSystemFilterPoolReferences(ISystemFilterPoolReference[] filterPoolReferences, + boolean deReference); + /** + * Create a filter pool referencing object, but do NOT add it to the list, do NOT call back. + */ + public ISystemFilterPoolReference createSystemFilterPoolReference(ISystemFilterPool filterPool); + /** + * Add a filter pool referencing object to the list. + * @return the new count of referencing objects + */ + public int addSystemFilterPoolReference(ISystemFilterPoolReference filterPoolReference); + /** + * Reset the filter pool a reference points to. Called on a move-filter-pool operation + */ + public void resetSystemFilterPoolReference(ISystemFilterPoolReference filterPoolReference, ISystemFilterPool newPool); + /** + * Remove a filter pool referencing object from the list. + * @param filterPool Reference the reference to remove + * @param deReference true if we want to dereference the referenced object (call removeReference on it) + * @return the new count of referencing objects + */ + public int removeSystemFilterPoolReference(ISystemFilterPoolReference filterPoolReference, + boolean deReference); + /** + * Return count of referenced filter pools + */ + public int getSystemFilterPoolReferenceCount(); + /** + * Return the zero-based position of a SystemFilterPoolReference object within this list + */ + public int getSystemFilterPoolReferencePosition(ISystemFilterPoolReference filterPoolRef); + /** + * Move a given filter pool reference to a given zero-based location + *

    Calls back to inform provider + */ + public void moveSystemFilterPoolReference(ISystemFilterPoolReference filterPoolRef,int pos); + /** + * Move existing filter pool references a given number of positions. + * 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.

    + *

    Calls back to inform provider + * @param filterPoolRefs Array of SystemFilterPoolReferences to move. + * @param newPosition new zero-based position for the filter pool references. + */ + public void moveSystemFilterPoolReferences(ISystemFilterPoolReference[] filterPoolRefs, int delta); + + // ---------------------------------------------- + // Methods that work on FilterPool master objects + // ---------------------------------------------- + /** + * Return array of filter pools currently referenced by this manager + * Result will never be null, although it may be an array of length zero. + */ + public ISystemFilterPool[] getReferencedSystemFilterPools(); + /** + * Return true if the given filter pool has a referencing object in this list. + */ + public boolean isSystemFilterPoolReferenced(ISystemFilterPool filterPool); + /** + * Given a filter pool, locate the referencing object for it and return it. + * @return the referencing object if found, else null + */ + public ISystemFilterPoolReference getReferenceToSystemFilterPool(ISystemFilterPool filterPool); + /** + * Given a filter pool, create a referencing object and add it to the list. + *

    Calls back to inform provider + * @return new filter pool reference + */ + public ISystemFilterPoolReference addReferenceToSystemFilterPool(ISystemFilterPool filterPool); + + /** + * Given a filter pool, locate the referencing object for it and remove it from the list. + *

    Calls back to inform provider + * @return the new count of referencing objects + */ + public int removeReferenceToSystemFilterPool(ISystemFilterPool filterPool); + /** + * A reference filter pool has been renamed. Update our stored name... + *

    Calls back to inform provider + */ + public void renameReferenceToSystemFilterPool(ISystemFilterPool pool); + /** + * In one shot, set the filter pool references to new references to supplied filter pools. + *

    Calls back to inform provider + * @param array of filter pool objects to create references for + * @param deReference true to first de-reference all objects in the existing list. + */ + public void setSystemFilterPoolReferences(ISystemFilterPool[] filterPools, + boolean deReference); + // ------------------------- + // SPECIAL CASE METHODS + // ------------------------- + /** + * Create a single filter refererence to a given filter. Needed when a filter + * is added to a pool, and the GUI is not showing pools but rather all filters + * in all pool references. + */ + public ISystemFilterReference getSystemFilterReference(ISubSystem subSystem, ISystemFilter filter); + /** + * Concatenate all filter references from all filter pools we reference, into one + * big list. + */ + public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem); + /** + * Given a filter reference, return its position within this reference manager + * when you think of all filter references from all filter pool references as + * being concatenated + */ + public int getSystemFilterReferencePosition(ISystemFilterReference filterRef); + /** + * Given a filter, return its position within this reference manager + * when you think of all filter references from all filter pool references as + * being concatenated + */ + public int getSystemFilterReferencePosition(ISubSystem subSystem, ISystemFilter filter); + // ------------------------- + // SAVE / RESTORE METHODS... + // ------------------------- + /** + * After restoring this from disk, there is only the referenced object name, + * not the referenced object pointer, for each referencing object. + *

    + * This method is called after restore and for each restored object in the list must: + *

      + *
    1. Do what is necessary to find the referenced object, and set the internal reference pointer. + *
    2. Call addReference(this) on that object so it can maintain it's in-memory list + * of all referencing objects. + *
    3. Set the important transient variables + *
    + * @param relatedManagers the filter pool managers that hold filter pools we reference + * @param provider the host of this reference manager, so you can later call getProvider + * @return A Vector of SystemFilterPoolReferences that were not successfully resolved, or null if all + * were resolved. + */ + public Vector resolveReferencesAfterRestore(ISystemFilterPoolManagerProvider relatedPoolMgrProvider, + ISystemFilterPoolReferenceManagerProvider provider); + /** + * Save all the filter pool references to disk. + * Use only if not doing your own saving, else override or set save policy to none. + */ + public void save() + throws Exception; + + /** + * Return the folder that this manager is contained in. + */ + public IFolder getFolder(); + /** + * Reset the folder that this manager is contained in. + */ + public void resetManagerFolder(IFolder newFolder); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolReferenceManagerProvider.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolReferenceManagerProvider.java new file mode 100644 index 00000000000..ab53e8b9787 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolReferenceManagerProvider.java @@ -0,0 +1,94 @@ +/******************************************************************************** + * 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.filters; +/** + * An interface for classes that instantiate SystemFilterPoolReferenceManager objects. + * This is the "caller" and as is recorded and recoverable from any object within + * the filter reference framework. This enables callers to get back instances of themselves + * given any filter reference object. Important when enabling UI actions against user + * selected filter reference framework objects + *

    + * Further, the goal is the allow all the filter framework UI actions to work + * independently, able to fully handle all actions without intervention on the + * provider's part. However, often the provider needs to be informed of all events + * in order to fire events to update its GUI. So this interface captures those + * callbacks that done to the provider for every interesting event. Should you + * not care about these, supply empty shells for these methods. + */ +public interface ISystemFilterPoolReferenceManagerProvider +{ + /** + * Return the SystemFilterPoolReferenceManager object this provider holds/provides. + */ + public ISystemFilterPoolReferenceManager getSystemFilterPoolReferenceManager(); + /** + * Return the owning filter pool that is unique to this provider + */ + public ISystemFilterPool getUniqueOwningSystemFilterPool(boolean createIfNotFound); + + // ------------------------------- + // FILTER POOL REFERENCE EVENTS... + // ------------------------------- + /** + * A new filter pool reference has been created + */ + public void filterEventFilterPoolReferenceCreated(ISystemFilterPoolReference newPoolRef); + /** + * A filter pool reference has been deleted + */ + public void filterEventFilterPoolReferenceDeleted(ISystemFilterPoolReference filterPoolRef); + /** + * A single filter pool reference has been reset to reference a new pool + */ + public void filterEventFilterPoolReferenceReset(ISystemFilterPoolReference filterPoolRef); + /** + * All filter pool references has been reset + */ + public void filterEventFilterPoolReferencesReset(); + /** + * A filter pool reference has been renamed (ie, its reference filter pool renamed) + */ + public void filterEventFilterPoolReferenceRenamed(ISystemFilterPoolReference poolRef, String oldName); + /** + * One or more filter pool references have been re-ordered within their manager + */ + public void filterEventFilterPoolReferencesRePositioned(ISystemFilterPoolReference[] poolRefs, int delta); + // ------------------------------- + // FILTER REFERENCE EVENTS... + // ------------------------------- + /** + * A new filter has been created. This is called when a filter pool reference is selected and a new filter + * is created, so that the provider can expand the selected filter pool reference and reveal the new filter + * within the selected pool reference. + *

    + * Only the selected node should be expanded if not already. All other references to this pool will already + * have been informed of the new addition, and will have refreshed their children but not expanded them. + */ + public void filterEventFilterCreated(Object selectedObject, ISystemFilter newFilter); + // --------------------------------- + // FILTER STRING REFERENCE EVENTS... + // --------------------------------- + /** + * A new filter string has been created. This is called when a filter reference is selected and a new filter + * string is created, so that the provider can expand the selected filter reference and reveal the new filter + * string within the selected filter reference. + *

    + * Only the selected node should be expanded if not already. All other references to this filter will already + * have been informed of the new addition, and will have refreshed their children but not expanded them. + */ + public void filterEventFilterStringCreated(Object selectedObject, ISystemFilterString newFilterString); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolSelectionValidator.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolSelectionValidator.java new file mode 100644 index 00000000000..4ca0e68520d --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolSelectionValidator.java @@ -0,0 +1,40 @@ +/******************************************************************************** + * 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.filters; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; + +/** + * An interface required if you wish to be called back by the + * system filter wizard, when the user selects a target filter pool. + */ +public interface ISystemFilterPoolSelectionValidator +{ + + /** + * Delimiter used to qualify filter names by filter pool name, when calling + * filter pool selection validator in new filter wizard. + */ + public static final String DELIMITER_FILTERPOOL_FILTER = "_____"; + + /** + * Validate the given selection. + * @param filterPool the user-selected filter pool + * @return null if no error, else a SystemMessage + */ + public SystemMessage validate(ISystemFilterPool filterPool); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolWrapper.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolWrapper.java new file mode 100644 index 00000000000..1b123842e82 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolWrapper.java @@ -0,0 +1,33 @@ +/******************************************************************************** + * 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.filters; +/** + * The system filter wizard allows callers to pass a list of wrapper objects + * for the user to select a filter pool + */ +public interface ISystemFilterPoolWrapper +{ + + /** + * Get the name to display in the combo box for this wrapper + */ + public String getDisplayName(); + /** + * Get the wrappered SystemFilterPool object + */ + public ISystemFilterPool getSystemFilterPool(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolWrapperInformation.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolWrapperInformation.java new file mode 100644 index 00000000000..d450dad2648 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolWrapperInformation.java @@ -0,0 +1,51 @@ +/******************************************************************************** + * 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.filters; +/** + * The system filter wizard allows callers to pass a list of wrapper objects + * for the user to select a filter pool. Effectively, this prompting for + * euphamisms to filter pools. This requires an array of wrapper objects, + * and requires replacement mri for the pool prompt and tooltip text, and + * the verbage above it. + *

    + * This is all encapsulated in this interface. There is also a class offered + * that implements all this and is populated via setters. + */ +public interface ISystemFilterPoolWrapperInformation +{ + + /** + * Get the label + */ + public String getPromptLabel(); + + /** + * Get the tooltip + */ + public String getPromptTooltip(); + + public String getVerbageLabel(); + /** + * Get the list of wrappered filter pool objects to show in the combo. The wrappering allows + * each to be displayed with a different name in the list than just pool.getName() + */ + public ISystemFilterPoolWrapper[] getWrappers(); + /** + * Get the wrapper to preselect in the list. + */ + public ISystemFilterPoolWrapper getPreSelectWrapper(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterReference.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterReference.java new file mode 100644 index 00000000000..8dec7a2c19e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterReference.java @@ -0,0 +1,101 @@ +/******************************************************************************** + * 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.filters; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.model.ISystemContainer; +import org.eclipse.rse.model.ISystemContentsType; +import org.eclipse.rse.references.ISystemReferencingObject; + + +/** + * Represents a shadow or reference to a system filter. + * Such references are only transient, not savable to disk. + */ +/** + * @lastgen interface SystemFilterReference extends SystemReferencingObject, SystemFilterContainerReference {} + */ +public interface ISystemFilterReference extends ISystemReferencingObject, ISystemFilterContainerReference, ISystemContainer +{ + /** + * Return the reference manager which is managing this filter reference + * framework object. + */ + public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager(); + + /** + * Return the object which instantiated the pool reference manager object. + * Makes it easy to get back to the point of origin, given any filter reference + * framework object + */ + public ISystemFilterPoolReferenceManagerProvider getProvider(); + + /** + * Gets the subsystem that contains this reference + * @return the subsystem + */ + public ISubSystem getSubSystem(); + + /** + * Sets the subsystem that contains this reference + * @param subSystem + */ + public void setSubSystem(ISubSystem subSystem); + + /** + * Return the filter to which we reference... + */ + public ISystemFilter getReferencedFilter(); + /** + * Set the filter to which we reference... + */ + public void setReferencedFilter(ISystemFilter filter); + + /** + * Get the parent of this reference. + * It will be either a SystemFilterPoolReference, or + * a SystemFilterReference(if nested). + */ + public ISystemFilterContainerReference getParent(); + /** + * Get parent or super parent filter pool reference. + */ + public ISystemFilterPoolReference getParentSystemFilterReferencePool(); + + // ------------------------------------------------- + // Methods for returning filter string references... + // ------------------------------------------------- + /** + * Return the number of filter strings in the referenced filter + */ + public int getSystemFilterStringCount(); + /** + * Get the filter strings contained by this filter. But get references to each, + * not the masters. + */ + public ISystemFilterStringReference[] getSystemFilterStringReferences(); + /** + * Create a single filter string refererence to a given filter string + */ + public ISystemFilterStringReference getSystemFilterStringReference(ISystemFilterString filterString); + + /* + * Sets the cached contents for this filter reference. If the filter changes or is refreshed, these cached + * items will be removed. + */ + public void setContents(ISystemContentsType type, Object[] cachedContents); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterSavePolicies.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterSavePolicies.java new file mode 100644 index 00000000000..87c215218ca --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterSavePolicies.java @@ -0,0 +1,46 @@ +/******************************************************************************** + * 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.filters; +/** + * A save policy dictates how filter framework artifacts are persisted to disk. + */ +public interface ISystemFilterSavePolicies +{ + /** + * No saving. All save/restoring handled elsewhere. + */ + public static final int SAVE_POLICY_NONE = -1; + /** + * Save all filter pools and all filters in one file, with same name as the manager + */ + public static final int SAVE_POLICY_ONE_FILE_PER_MANAGER = 0; + /** + * Save all filters in each filter pool in one file per pool, with the same name as the pool. + * Each pool also has its own unique folder. + */ + public static final int SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL = 1; + /** + * Save all filters in each filter pool in one file per pool, with the same name as the pool + * All pool files go into the same folder. + */ + public static final int SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER = 2; + /** + * Save each filter in each filter pool in its own file, with the same name as the filter + */ + public static final int SAVE_POLICY_ONE_FILE_PER_FILTER = 3; + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterString.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterString.java new file mode 100644 index 00000000000..387e0a6ffc4 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterString.java @@ -0,0 +1,101 @@ +/******************************************************************************** + * 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.filters; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.rse.model.IRSEModelObject; +import org.eclipse.rse.references.ISystemBaseReferencedObject; + + +/** + * A filter string is a pattern used by the server-side code to know what to return to + * the client. A filter contains one or more filter strings. Basically, its nothing more + * than a string, and its up to each consumer to know what to do with it. Generally, + * a filter string edit pane is designed to prompt the user for the contents of the + * string in a domain-friendly way. + * @see org.eclipse.rse.ui.filters.SystemFilterStringEditPane + * @see org.eclipse.rse.ui.filters.dialogs.SystemChangeFilterDialog and + * @see org.eclipse.rse.ui.filters.actions.SystemChangeFilterAction + * @see org.eclipse.rse.ui.filters.dialogs.SystemNewFilterWizard and + * @see org.eclipse.rse.ui.filters.actions.SystemNewFilterAction + */ +public interface ISystemFilterString extends ISystemBaseReferencedObject, IAdaptable, IRSEModelObject +{ + /** + * Return the caller which instantiated the filter pool manager overseeing this filter framework instance + */ + public ISystemFilterPoolManagerProvider getProvider(); + /** + * Return the filter pool manager managing this collection of filter pools and their filters and their filter strings. + */ + public ISystemFilterPoolManager getSystemFilterPoolManager(); + /** + * Set the transient parent back-pointer. Called by framework at restore/create time. + */ + public void setParentSystemFilter(ISystemFilter filter); + /** + * Get the parent filter that contains this filter string. + */ + public ISystemFilter getParentSystemFilter(); + /** + * Clones this filter string's attributes into the given filter string + */ + public void clone(ISystemFilterString targetString); + /** + * Is this filter string changable? Depends on mof attributes of parent filter + */ + public boolean isChangable(); + + /** + * @generated This field/method will be replaced during code generation + * @return The value of the String attribute + */ + String getString(); + + /** + * @generated This field/method will be replaced during code generation + * @param value The new value of the String attribute + */ + void setString(String value); + + /** + * @generated This field/method will be replaced during code generation + * @return The value of the Type attribute + * Allows tools to have typed filter strings + */ + String getType(); + + /** + * @generated This field/method will be replaced during code generation + * @param value The new value of the Type attribute + */ + void setType(String value); + + /** + * @generated This field/method will be replaced during code generation + * @return The value of the Default attribute + * Is this a vendor-supplied filter string versus a user-defined filter string + */ + boolean isDefault(); + + /** + * @generated This field/method will be replaced during code generation + * @param value The new value of the Default attribute + */ + void setDefault(boolean value); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterStringReference.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterStringReference.java new file mode 100644 index 00000000000..b8c825f9bfa --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterStringReference.java @@ -0,0 +1,58 @@ +/******************************************************************************** + * 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.filters; +import org.eclipse.rse.references.ISystemBaseReferencingObject; + +/** + * Represents a reference to a master filter string. + * Needed so GUI can show the same filter string multiple times. + * This is not modelled in MOF. + */ +public interface ISystemFilterStringReference + extends ISystemBaseReferencingObject +{ + /** + * Return the reference manager which is managing this filter reference + * framework object. + */ + public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager(); + + /** + * Return the object which instantiated the pool reference manager object. + * Makes it easy to get back to the point of origin, given any filter reference + * framework object + */ + public ISystemFilterPoolReferenceManagerProvider getProvider(); + + /** + * Get the master filter string + */ + public ISystemFilterString getReferencedFilterString(); + /** + * Get the referenced filter that contains this filter string reference. + */ + public ISystemFilterReference getParent(); + /** + * Get the actual filter that contain the actual filter string we reference + */ + public ISystemFilter getParentSystemFilter(); + + /** + * Same as getReferencedFilterString().getString() + */ + public String getString(); +} //SystemFilterStringReference \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterPoolWrapper.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterPoolWrapper.java new file mode 100644 index 00000000000..831444386a9 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterPoolWrapper.java @@ -0,0 +1,59 @@ +/******************************************************************************** + * 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.filters; + +/** + * The system filter wizard allows callers to pass a list of wrapper objects + * for the user to select a filter pool. + *

    + * This is a default implementation of the wrapper interface, that allows the + * display name and wrappered filter pool to be set via the constructor. + */ +public class SystemFilterPoolWrapper implements ISystemFilterPoolWrapper +{ + + + private String displayName; + private ISystemFilterPool pool; + + /** + * Constructor for SystemFilterPoolWrapper. + */ + public SystemFilterPoolWrapper(String displayName, ISystemFilterPool poolToWrapper) + { + super(); + this.displayName = displayName; + this.pool = poolToWrapper; + } + + /** + * @see org.eclipse.rse.filters.ISystemFilterPoolWrapper#getDisplayName() + */ + public String getDisplayName() + { + return displayName; + } + + /** + * @see org.eclipse.rse.filters.ISystemFilterPoolWrapper#getSystemFilterPool() + */ + public ISystemFilterPool getSystemFilterPool() + { + return pool; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterPoolWrapperInformation.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterPoolWrapperInformation.java new file mode 100644 index 00000000000..3fc99d96048 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterPoolWrapperInformation.java @@ -0,0 +1,124 @@ +/******************************************************************************** + * 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.filters; + +import java.util.Vector; + +/** + * The system filter wizard allows callers to pass a list of wrapper objects + * for the user to select a filter pool. Effectively, this prompting for + * euphamisms to filter pools. This requires an array of wrapper objects, + * and requires replacement mri for the pool prompt and tooltip text, and + * the verbage above it. + *

    + * This is all encapsulated in this class. The information is set via setters + * or constructor parameters. + */ +public class SystemFilterPoolWrapperInformation + implements ISystemFilterPoolWrapperInformation +{ + private String promptLabel, promptTooltip, verbageLabel; + private Vector wrappers; + private ISystemFilterPoolWrapper[] wrapperArray; + private ISystemFilterPoolWrapper preSelectWrapper; + + /** + * Constructor for SystemFilterPoolWrapperInformation. + */ + public SystemFilterPoolWrapperInformation(String promptLabel, String promptTooltip, String verbageLabel) + { + super(); + this.promptLabel= promptLabel; + this.verbageLabel = verbageLabel; + this.promptLabel= promptTooltip; + wrappers = new Vector(); + } + + /** + * Add a wrapper object + */ + public void addWrapper(ISystemFilterPoolWrapper wrapper) + { + wrappers.add(wrapper); + } + /** + * Add a filter pool, which we will wrapper here by creating a SystemFilterPoolWrapper object for you + */ + public void addWrapper(String displayName, ISystemFilterPool poolToWrap, boolean preSelect) + { + SystemFilterPoolWrapper wrapper = new SystemFilterPoolWrapper(displayName, poolToWrap); + wrappers.add(wrapper); + if (preSelect) + preSelectWrapper = wrapper; + } + /** + * Set the wrapper to preselect + */ + public void setPreSelectWrapper(ISystemFilterPoolWrapper wrapper) + { + this.preSelectWrapper = wrapper; + } + + + + public String getPromptLabel() + { + return promptLabel; + } + + public String getPromptTooltip() + { + return promptTooltip; + } + + public String getVerbageLabel() + { + return verbageLabel; + } + + + /** + * @see org.eclipse.rse.filters.ISystemFilterPoolWrapperInformation#getWrappers() + */ + public ISystemFilterPoolWrapper[] getWrappers() + { + if (wrapperArray == null) + { + wrapperArray = new ISystemFilterPoolWrapper[wrappers.size()]; + for (int idx=0; idx 0) + return (ISystemFilterPoolWrapper)wrappers.elementAt(0); + else + return null; + } + else + return preSelectWrapper; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterReference.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterReference.java new file mode 100644 index 00000000000..b9b9b97a93c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterReference.java @@ -0,0 +1,490 @@ +/******************************************************************************** + * 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.filters; +import java.util.HashMap; +import java.util.Iterator; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.internal.filters.SystemFilterContainerReferenceCommonMethods; +import org.eclipse.rse.internal.filters.SystemFilterStringReference; +import org.eclipse.rse.internal.references.SystemReferencingObject; +import org.eclipse.rse.model.ISystemContainer; +import org.eclipse.rse.model.ISystemContentsType; +import org.eclipse.rse.references.ISystemBaseReferencedObject; +import org.eclipse.rse.references.ISystemReferencingObject; + + + +/** + * Represents a shadow or reference to a system filter. + * Such references are only transient, not savable to disk. + * All major function is inherited. + *

    + * SystemFilter references typically exist for only one reason: + *

      + *
    1. As a simple shadow to enable a unique object in a GUI tree. For example, + * if it is possible for the same filter to show up in different places in + * the tree, then we must create shadows for each place it shows up. + *
    + */ +/** + * @lastgen class SystemFilterReferenceImpl extends SystemReferencingObjectImpl implements IAdaptable, SystemFilterReference, SystemReferencingObject {} + */ +public class SystemFilterReference extends SystemReferencingObject implements IAdaptable, ISystemFilterReference, ISystemReferencingObject +{ + private SystemFilterContainerReferenceCommonMethods containerHelper = null; + private ISystemFilterContainerReference parent = null; + private ISystemFilter referencedFilter = null; + private ISystemFilterStringReference[] referencedFilterStrings = null; + protected boolean persistent; + protected boolean isStale; +// protected Object[] cachedContents; + protected ISubSystem _subSystem; + + protected HashMap cachedContents; + + public static final boolean PERSISTENT_YES = true; + public static final boolean PERSISTENT_NO = false; + /** + * Constructor. Typically called by MOF. + */ + protected SystemFilterReference() + { + super(); + containerHelper = new SystemFilterContainerReferenceCommonMethods(this); + persistent = true; + isStale = true; + cachedContents = new HashMap(); + } + /** + * Create a new instance of this class. + * @param parent The SystemFilterReference or SystemFilterPoolReference object that we are a child of. + * @param filter The master object to be referenced. + * @param persistent Whether we should formally register our reference with the target filter or not. + */ + public static ISystemFilterReference createSystemFilterReference(ISubSystem subSystem, + ISystemFilterContainerReference parent, + ISystemFilter filter, + boolean persistent) + { + //SystemFilterReferenceImpl newRef = (SystemFilterReferenceImpl)SystemFilterImpl.initMOF().createSystemFilterReference(); + SystemFilterReference newRef = new SystemFilterReference(); // more efficient? + newRef.persistent = persistent; + newRef.setSubSystem(subSystem); + newRef.setParent(parent); + newRef.setReferencedFilter(filter); + filter.addReference(newRef); + return newRef; + } + + /** + * Gets the subsystem that contains this reference + * @return the subsystem + */ + public ISubSystem getSubSystem() + { + return _subSystem; + } + + /** + * Sets the subsystem that contains this reference + * @param subSystem + */ + public void setSubSystem(ISubSystem subSystem) + { + _subSystem = subSystem; + } + + /** + * Return the reference manager which is managing this filter reference + * framework object. + */ + public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager() + { + ISystemFilterPoolReference pool = getParentSystemFilterReferencePool(); + if (pool != null) + return pool.getFilterPoolReferenceManager(); + else + return null; + } + + /** + * Return the object which instantiated the pool reference manager object. + * Makes it easy to get back to the point of origin, given any filter reference + * framework object + */ + public ISystemFilterPoolReferenceManagerProvider getProvider() + { + ISystemFilterPoolReferenceManager mgr = getFilterPoolReferenceManager(); + if (mgr != null) + { + ISystemFilterPoolReferenceManagerProvider provider = mgr.getProvider(); + if (provider == null) + { + provider = getSubSystem(); + } + return provider; + } + else + return null; + } + + + /** + * If this is a reference to a nested filter, the parent is the + * reference to the nested filter's parent. Else, it is the + * reference to the parent filter pool + */ + public void setParent(ISystemFilterContainerReference parent) + { + this.parent = parent; + } + /** + * The parent will either by a SystemFilterPoolReference or + * a SystemFilterReference. + */ + public ISystemFilterContainerReference getParent() + { + return parent; + } + + /** + * Return the filter to which we reference... + */ + public ISystemFilter getReferencedFilter() + { + return persistent ? (ISystemFilter)super.getReferencedObject() : referencedFilter; + } + /** + * Set the filter to which we reference... + */ + public void setReferencedFilter(ISystemFilter filter) + { + if (persistent) + super.setReferencedObject(filter); + else + referencedFilter = filter; + } + + /** + * If this is a reference to a nested filter, the parent is the + * reference to the nested filter's parent. Else, it is the + * reference to the parent filter pool + */ + public ISystemFilterPoolReference getParentSystemFilterReferencePool() + { + if (parent instanceof ISystemFilterPoolReference) + return (ISystemFilterPoolReference)parent; + else + return ((ISystemFilterReference)parent).getParentSystemFilterReferencePool(); + } + /** + * 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 common with SystemFilterPoolReferenceImpl, and hence + // abstracted out into SystemFilterContainerReference... + // ------------------------------------------------------------- + /** + * Return the object to which we hold a reference. This is either + * SystemFilter or SystemFilterPool. Since both implement + * SystemFilterContainer, that is what we return. + *

    + * Of course, this is a generic method, and in our case it is always + * true that we only hold a SystemFilter. Hence, this is the same + * as calling getReferenceFilter and casting the result. + */ + public ISystemFilterContainer getReferencedSystemFilterContainer() + { + return getReferencedFilter(); + } + /** + * Build and return an array of SystemFilterReference objects. + * Each object is created new. There is one for each of the filters + * in the reference SystemFilter or SystemFilterPool. + * For performance reasons, we will cache this array and only + * return a fresh one if something changes in the underlying + * filter list. + */ + public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem) + { + return containerHelper.getSystemFilterReferences(subSystem); + } + /** + * Create a single filter refererence to a given filter. + * If there already is a reference to this filter, it is returned. + * If not, a new reference is created and appended to the end of the existing filter reference array. + * @see #getExistingSystemFilterReference(ISystemFilter) + */ + public ISystemFilterReference getSystemFilterReference(ISubSystem subSystem, ISystemFilter filter) + { + //return containerHelper.generateFilterReference(filter); + return containerHelper.generateAndRecordFilterReference(subSystem, filter); + } + /** + * Return an existing reference to a given system filter. + * If no reference currently exists to this filter, returns null. + * @see #getSystemFilterReference(ISystemFilter) + */ + public ISystemFilterReference getExistingSystemFilterReference(ISubSystem subSystem, ISystemFilter filter) + { + return containerHelper.getExistingSystemFilterReference(subSystem, filter); + } + + /** + * Return true if the referenced pool or filter has filters. + */ + public boolean hasFilters() + { + return containerHelper.hasFilters(); + } + + /** + * Return count of the number of filters in the referenced pool or filter + */ + public int getFilterCount() + { + return containerHelper.getFilterCount(); + } + + /** + * Return the name of the SystemFilter or SystemFilterPool that we reference. + * For such objects this is what we show in the GUI. + */ + public String getName() + { + ISystemFilter filter = getReferencedFilter(); + if (filter != null) + return filter.getName(); + else + return ""; + } + + /** + * Override of Object method. Turn this filter in an outputable string + */ + public String toString() + { + return getName(); + } + + // ------------------------------------------------- + // Methods for returning filter string references... + // ------------------------------------------------- + /** + * Return the number of filter strings in the referenced filter + */ + public int getSystemFilterStringCount() + { + int count = 0; + ISystemFilter referencedFilter = getReferencedFilter(); + if (referencedFilter != null) + count = referencedFilter.getFilterStringCount(); + return count; + } + /** + * Get the filter strings contained by this filter. But get references to each, + * not the masters. + */ + public ISystemFilterStringReference[] getSystemFilterStringReferences() + { + // These reference objects are built on the fly, each time, rather than + // maintaining a persisted list of such references. The reason + // is we do no at this time allow users to subset the master list + // of strings maintained by a filter. Hence, we always simply + // return a complete list. However, to save memory we try to only + // re-gen the list if something has changed. + java.util.List mofList = getReferencedFilter().getStrings(); + boolean needToReGen = compareFilterStrings(mofList); + if (needToReGen) + referencedFilterStrings = generateFilterStringReferences(mofList); + return referencedFilterStrings; + } + + /** + * Create a single filter string refererence to a given filter string + */ + public ISystemFilterStringReference getSystemFilterStringReference(ISystemFilterString filterString) + { + return new SystemFilterStringReference((ISystemFilterReference)this, filterString); + } + + + /** + * To save memory, we try to only regenerate the referenced filter list + * if something has changed. + */ + private boolean compareFilterStrings(java.util.List newFilterStrings) + { + boolean mustReGen = false; + if (newFilterStrings == null) + { + if (referencedFilterStrings != null) + return true; + else + return false; + } + else if (referencedFilterStrings == null) + { + return true; // newFilterStrings != null && referencedFilterStrings == null + } + // both old and new are non-null + if (newFilterStrings.size() != referencedFilterStrings.length) + return true; + Iterator i = newFilterStrings.iterator(); + for (int idx=0; !mustReGen && (idx + * This flavour of SystemFilter implementation is for those cases where a simple in-memory + * SystemFilter is needed temporarily, perhaps to populate a GUI widget say, and the filter + * does not need to be savable/restorable. As a result there is no mof, and no need for a + * parent SystemFilterPool or SystemFilterPoolManager. The class is small, simple and + * directly instantiable. + *

    + * This simple implementation does not support: + *

      + *
    • Saving or restoring from disk + *
    • SystemFilterStrings ... only Strings are used for the filter strings + *
    • Nested filters + *
    • Parent filter pool + *
    • The attributes relativeOrder, promptable and default + *
    + */ +public class SystemFilterSimple extends SystemFilter implements ISystemContainer +{ + + private String name = null; + private String type = ISystemFilterConstants.DEFAULT_TYPE; + private boolean caseSensitive = false; + private boolean promptable = false; + private Object parent; + // the following are inherited... + //private String[] filterStringArray = null; + //private SystemFilterString[] filterStringObjectArray = null; + //private Vector filterStringVector = null; + protected boolean isStale; + protected HashMap cachedContents; + + /** + * Constructor for SystemFilterSimpleImpl + */ + public SystemFilterSimple(String name) + { + //super(); + this.name = name; + filterStringVector = new Vector(); + isStale = true; + cachedContents = new HashMap(); + } + + protected void invalidateCache() + { + filterStringArray = null; + filterStringObjectArray = null; + //filterStringVector = null; + } + + /** + * Return true if this a transient or simple filter that is only created temporary "on the fly" + * and not intended to be saved or part of the filter framework. Eg it has no manager or provider. + *

    + * We always return true + */ + public boolean isTransient() + { + return true; + } + + /** + * Clones a given filter to the given target filter. + * All filter strings, and all nested filters, are copied. + * @param targetFilter new filter into which we copy all our data + */ + public void clone(ISystemFilter targetFilter) + { + super.clone(targetFilter); + // hmm, due to polymorphism, we should not have to do anything here! + // well, except for this: + targetFilter.setFilterStrings(getFilterStringsVector()); + } + + // ------------------------------------------------------- + // New methods to simplify life. Often a simple filter + // contains a single filter string so these methods + // make it easier to set/get that filter string + // ------------------------------------------------------- + /** + * Set the single filter string + */ + public void setFilterString(String filterString) + { + filterStringVector.clear(); + filterStringVector.addElement(filterString); + invalidateCache(); + } + /** + * Get the single filter string. + * Returns null if setFilterString has not been called. + */ + public String getFilterString() + { + if (filterStringVector.size() == 0) + return null; + else + return (String)filterStringVector.elementAt(0); + } + + /** + * Set the parent. Since we don't have any filter manager, we need + * some way to store context info for the adapter. Use this. + */ + public void setParent(Object parent) + { + this.parent = parent; + } + + /** + * Get the parent as set in setParent(Object) + */ + public Object getParent() + { + return parent; + } + + // ------------------------------------------------------- + // Functional methods overridden to do something simple... + // ------------------------------------------------------- + + /** + * Set the filter's name + */ + public void setName(String name) + { + this.name = name; + } + /** + * Get the filter's name + */ + public String getName() + { + return name; + } + /** + * Set the filter's type + */ + public void setType(String type) + { + this.type = type; + } + /** + * Get the filter's type + */ + public String getType() + { + return type; + } + /** + * Specify if filter strings in this filter are case sensitive. + * Default is false. + * @param value The new value of the StringsCaseSensitive attribute + */ + public void setStringsCaseSensitive(boolean value) + { + this.caseSensitive = value; + } + + /** + * Are filter strings in this filter case sensitive? + */ + public boolean isStringsCaseSensitive() + { + return caseSensitive; + } + /** + * Are filter strings in this filter case sensitive? + */ + public boolean areStringsCaseSensitive() + { + return caseSensitive; + } + + /** + * Is this a special filter that prompts the user when it is expanded? + */ + public void setPromptable(boolean promptable) + { + this.promptable = promptable; + } + /** + * Is this a special filter that prompts the user when it is expanded? + */ + public boolean isPromptable() + { + return promptable; + } + + /** + * Return filter strings as an array of String objects. + */ + public String[] getFilterStrings() + { + if (filterStringArray == null) + { + filterStringArray = new String[filterStringVector.size()]; + for (int idx=0; idx 0); + } + + // ------------------------------------------------------- + // Non-applicable methods overridden to do nothing... + // ------------------------------------------------------- + + /** + * Get this filter's filter string objects as an array. + * We return null, as we don't support SystemFilterString objects, + * just String objects. + */ + public ISystemFilterString[] getSystemFilterStrings() + { + return null; + } + + /** + * Overridden to do nothing + */ + public void setSupportsNestedFilters(boolean value) {} + /** + * Does this support nested filters? No. Not for simple filtes. + */ + public boolean supportsNestedFilters() {return false;} + /** + * Return true if this filter is a nested filter or not. + * Overridden to return false; + */ + public boolean isNested() { return false; } + /** + * Update a new filter string's string value. + * Overridden to do nothing. + */ + public void updateFilterString(ISystemFilterString filterString, String newValue) {} + /** + * Remove a filter string from this filter's list, given its SystemFilterString object. + * Overridden to do nothing + */ + public boolean removeFilterString(ISystemFilterString filterString) {return false;} + /** + * Move a given filter string to a given zero-based location. + * Overridden to do nothing + */ + public void moveSystemFilterString(int pos, ISystemFilterString filterString) {} + /** + * Overridden to do nothing + */ + public void setRelativeOrder(int value) {} + + /** + * Overridden to return -1 + */ + public int getRelativeOrder() { return -1; } + /** + * Overridden to do nothing + */ + public void setDefault(boolean value) {} + /** + * Overridden to return false + */ + public boolean isDefault() {return false; } + /** + * Overridden to do nothing + */ + public void setParentFilter(ISystemFilter l) {} + /** + * Overridden to return null + */ + public ISystemFilter getParentFilter() {return null;} + /** + * Overridden to return null + */ + public Vector getSystemFilterNames() {return null;} + /** + * Overridden to return null + */ + public java.util.List getNestedFilters() {return null;} + /** + * Overridden to return null + */ + public Vector getSystemFiltersVector() {return null;} + /** + * Overridden to return null + */ + public ISystemFilter[] getSystemFilters() {return null;} + /** + * Overridden to return 0 + */ + public int getSystemFilterCount() {return 0;} + /** + * Overridden to return null + */ + public java.util.List getStrings() {return null;} + /** + * Overridden to return null + */ + public ISystemFilter getSystemFilter(String aliasName) {return null;} + /** + * Overridden to return null + */ + public ISystemFilterPoolManagerProvider getProvider() {return null;} + /** + * Overridden to return null + */ + public ISystemFilterPoolManager getSystemFilterPoolManager() {return null;} + /** + * Overridden to return null + */ + public IFile getSaveFile() {return null;} + /** + * Overridden to return null + */ + public String getSaveFileName() {return null;} + /** + * Overridden to do nothing + */ + public void save() throws Exception {} + + /** + * Cache contents of a certain type. + * @param type the contents type. + * @param cachedContents the contents to cache. + */ + public void setContents(ISystemContentsType type, Object[] cachedContents) { + this.cachedContents.put(type, cachedContents); + isStale = false; + } + + /** + * @see org.eclipse.rse.model.ISystemContainer#getContents(org.eclipse.rse.model.ISystemContentsType) + */ + public Object[] getContents(ISystemContentsType contentsType) { + return (Object[])cachedContents.get(contentsType); + } + + /** + * @see org.eclipse.rse.model.ISystemContainer#hasContents(org.eclipse.rse.model.ISystemContentsType) + */ + public boolean hasContents(ISystemContentsType contentsType) { + + if (cachedContents.containsKey(contentsType)) { + return true; + } + + return false; + } + + /** + * @see org.eclipse.rse.model.ISystemContainer#isStale() + */ + public boolean isStale() { + return isStale; + } + + /** + * @see org.eclipse.rse.model.ISystemContainer#markStale(boolean) + */ + public void markStale(boolean isStale) + { + markStale(isStale, true); + } + + /** + * @see org.eclipse.rse.model.ISystemContainer#markStale(boolean) + */ + public void markStale(boolean isStale, boolean clearCache) + { + this.isStale = isStale; + if (clearCache) + { + cachedContents.clear(); + } + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterStartHere.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterStartHere.java new file mode 100644 index 00000000000..041d099c589 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterStartHere.java @@ -0,0 +1,109 @@ +/******************************************************************************** + * 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.filters; +import org.eclipse.rse.internal.filters.SystemFilterNamingPolicy; +import org.eclipse.rse.internal.filters.SystemFilterPoolManager; +import org.eclipse.rse.internal.filters.SystemFilterPoolReferenceManager; +import org.eclipse.rse.logging.Logger; +import org.eclipse.rse.model.ISystemProfile; + + + +/** + * Static methods for creating and restoring the "front doors" to the filter framework + *

      + *
    • SystemFilterNamingPolicy. This tells the framework what to use for file names when + * saving and restoring to/from disk. + *
    • SystemFilterPoolManager. This manages master lists of filter pools. Use only these + * APIs for creating: + *
        + *
      • SystemFilterPools. + *
      • SystemFilters + *
      + *
    • SystemFilterPoolReferenceManager. This manages a persistable list of filter pool + * references. Use its APIs for creating: + *
        + *
      • SystemFilterPoolReferences. + *
      + *
    + */ +public class SystemFilterStartHere + implements ISystemFilterConstants +{ + /** + * Factory method to return an instance populated with defaults. + * You can then simply override whatever is desired via setXXX methods. + */ + public static ISystemFilterNamingPolicy createSystemFilterNamingPolicy() + { + return SystemFilterNamingPolicy.getNamingPolicy(); + } + + + /** + * Factory to create a filter pool manager, when you do NOT want it to worry about + * saving and restoring the filter data to disk. Rather, you will save and restore + * yourself. + * @param logger A logging object into which to log errors as they happen in the framework + * @param caller Objects which instantiate this class should implement the + * SystemFilterPoolManagerProvider interface, and pass "this" for this parameter. + * Given any filter framework object, it is possible to retrieve the caller's + * object via the getProvider method call. + * @param name the name of the filter pool manager. Not currently used but you may + * find a use for it. + * @param allowNestedFilters true if filters inside filter pools in this manager are + * to allow nested filters. This is the default, but can be overridden at the + * individual filter pool level. + */ + public static ISystemFilterPoolManager + createSystemFilterPoolManager(ISystemProfile profile, + Logger logger, + ISystemFilterPoolManagerProvider caller, + String name, + boolean allowNestedFilters) + { + return SystemFilterPoolManager.createSystemFilterPoolManager(profile, logger, caller, + name, allowNestedFilters, SAVE_POLICY_NONE, null); + } + + + + /** + * Create a SystemFilterPoolReferenceManager instance, when you do NOT want it + * to be saved and restored to its own file. Rather, you will save and restore it + * yourself. + * @param caller Objects which instantiate this class should implement the + * SystemFilterPoolReferenceManagerProvider interface, and pass "this" for this parameter. + * Given any filter framework object, it is possible to retrieve the caller's + * object via the getProvider method call. + * @param relatedPoolManagers The managers that own the master list of filter pools that + * this manager will contain references to. + * @param name the name of the filter pool reference manager. This is not currently + * used, but you may find a use for it. + * @param namingPolicy the naming policy object which will return the name of that one file. + */ + public static ISystemFilterPoolReferenceManager createSystemFilterPoolReferenceManager( + ISystemFilterPoolReferenceManagerProvider caller, + ISystemFilterPoolManagerProvider relatedPoolMgrProvider, + String name, ISystemFilterNamingPolicy namingPolicy) + { + return SystemFilterPoolReferenceManager.createSystemFilterPoolReferenceManager( + caller, relatedPoolMgrProvider, null, name, SAVE_POLICY_NONE, namingPolicy); + } + + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilter.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilter.java new file mode 100644 index 00000000000..8ca46eddaa3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilter.java @@ -0,0 +1,1399 @@ +/******************************************************************************** + * 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.internal.filters; +import java.io.File; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Vector; + +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterConstants; +import org.eclipse.rse.filters.ISystemFilterContainer; +import org.eclipse.rse.filters.ISystemFilterNamingPolicy; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider; +import org.eclipse.rse.filters.ISystemFilterString; +import org.eclipse.rse.filters.SystemFilterSimple; +import org.eclipse.rse.internal.references.SystemReferencedObject; +import org.eclipse.rse.references.ISystemReferencedObject; +import org.eclipse.rse.ui.SystemResources; + + +/** + * A filter is an encapsulation of a unique name, and a list + * of filter strings. + * Filters can be referenced. + */ +/** + * @lastgen class SystemFilterImpl extends SystemReferencedObjectImpl implements SystemFilter, SystemReferencedObject, SystemFilterContainer, IAdaptable {} + */ +public class SystemFilter extends SystemReferencedObject implements ISystemFilter, ISystemReferencedObject, ISystemFilterContainer, IAdaptable +{ + + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + private SystemFilterContainerCommonMethods helpers = null; + private ISystemFilterPool parentPool = null; + protected String[] filterStringArray = null; + protected ISystemFilterString[] filterStringObjectArray = null; + protected Vector filterStringVector = null; + + // persistance + protected boolean _isDirty = true; + protected boolean _wasRestored = false; + + //protected static String SAVEFILE_PREFIX = DEFAULT_FILENAME_PREFIX_FILTER; + //protected static String SAVEFILE_SUFFIX = ".xmi"; + protected static boolean debug = true; + /** + * @generated This field/method will be replaced during code generation. + */ + /** + * @generated This field/method will be replaced during code generation. + */ + protected String name = NAME_EDEFAULT; + /** + * The default value of the '{@link #getType() Type}' attribute. + * + * + * @see #getType() + * @generated + * @ordered + */ + protected static final String TYPE_EDEFAULT = null; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected String type = TYPE_EDEFAULT; + /** + * The default value of the '{@link #isSupportsNestedFilters() Supports Nested Filters}' attribute. + * + * + * @see #isSupportsNestedFilters() + * @generated + * @ordered + */ + protected static final boolean SUPPORTS_NESTED_FILTERS_EDEFAULT = false; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected boolean supportsNestedFilters = SUPPORTS_NESTED_FILTERS_EDEFAULT; + /** + * The default value of the '{@link #getRelativeOrder() Relative Order}' attribute. + * + * + * @see #getRelativeOrder() + * @generated + * @ordered + */ + protected static final int RELATIVE_ORDER_EDEFAULT = 0; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected int relativeOrder = RELATIVE_ORDER_EDEFAULT; + /** + * The default value of the '{@link #isDefault() Default}' attribute. + * + * + * @see #isDefault() + * @generated + * @ordered + */ + protected static final boolean DEFAULT_EDEFAULT = false; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected boolean default_ = DEFAULT_EDEFAULT; + /** + * The default value of the '{@link #isStringsCaseSensitive() Strings Case Sensitive}' attribute. + * + * + * @see #isStringsCaseSensitive() + * @generated + * @ordered + */ + protected static final boolean STRINGS_CASE_SENSITIVE_EDEFAULT = false; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected boolean stringsCaseSensitive = STRINGS_CASE_SENSITIVE_EDEFAULT; + /** + * The default value of the '{@link #isPromptable() Promptable}' attribute. + * + * + * @see #isPromptable() + * @generated + * @ordered + */ + protected static final boolean PROMPTABLE_EDEFAULT = false; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected boolean promptable = PROMPTABLE_EDEFAULT; + /** + * The default value of the '{@link #isSupportsDuplicateFilterStrings() Supports Duplicate Filter Strings}' attribute. + * + * + * @see #isSupportsDuplicateFilterStrings() + * @generated + * @ordered + */ + protected static final boolean SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT = false; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected boolean supportsDuplicateFilterStrings = SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT; + /** + * The default value of the '{@link #isNonDeletable() Non Deletable}' attribute. + * + * + * @see #isNonDeletable() + * @generated + * @ordered + */ + protected static final boolean NON_DELETABLE_EDEFAULT = false; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected boolean nonDeletable = NON_DELETABLE_EDEFAULT; + /** + * The default value of the '{@link #isNonRenamable() Non Renamable}' attribute. + * + * + * @see #isNonRenamable() + * @generated + * @ordered + */ + protected static final boolean NON_RENAMABLE_EDEFAULT = false; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected boolean nonRenamable = NON_RENAMABLE_EDEFAULT; + /** + * The default value of the '{@link #isNonChangable() Non Changable}' attribute. + * + * + * @see #isNonChangable() + * @generated + * @ordered + */ + protected static final boolean NON_CHANGABLE_EDEFAULT = false; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected boolean nonChangable = NON_CHANGABLE_EDEFAULT; + /** + * The default value of the '{@link #isStringsNonChangable() Strings Non Changable}' attribute. + * + * + * @see #isStringsNonChangable() + * @generated + * @ordered + */ + protected static final boolean STRINGS_NON_CHANGABLE_EDEFAULT = false; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected boolean stringsNonChangable = STRINGS_NON_CHANGABLE_EDEFAULT; + /** + * The default value of the '{@link #getRelease() Release}' attribute. + * + * + * @see #getRelease() + * @generated + * @ordered + */ + protected static final int RELEASE_EDEFAULT = 0; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected int release = RELEASE_EDEFAULT; + /** + * The default value of the '{@link #isSingleFilterStringOnly() Single Filter String Only}' attribute. + * + * + * @see #isSingleFilterStringOnly() + * @generated + * @ordered + */ + protected static final boolean SINGLE_FILTER_STRING_ONLY_EDEFAULT = false; + + /** + * The cached value of the '{@link #isSingleFilterStringOnly() Single Filter String Only}' attribute. + * + * + * @see #isSingleFilterStringOnly() + * @generated + * @ordered + */ + protected boolean singleFilterStringOnly = SINGLE_FILTER_STRING_ONLY_EDEFAULT; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected java.util.List nestedFilters = null; + /** + * @generated This field/method will be replaced during code generation. + */ + protected java.util.List strings = null; + + + // FIXME + protected ISystemFilter _parentFilter; + +/** + * Constructor. Do not instantiate directly, let MOF do it! + */ + protected SystemFilter() + { + super(); + helpers = new SystemFilterContainerCommonMethods(); + } + /* + * Private internal way to get filters. Makes it easy to change in future, if we don't use MOF. + */ + protected java.util.List internalGetFilters() + { + return getNestedFilters(); + } + + /** + * Returns the type attribute. Intercepted to return SystemFilterConstants.DEFAULT_TYPE if it is currently null + */ + public String getType() + { + String type = getTypeGen(); + if (type == null) + return ISystemFilterConstants.DEFAULT_TYPE; + else + return type; + } + /** + * Returns the type attribute. Intercepted to return SystemFilterConstants.DEFAULT_TYPE if it is currently null + */ + public String getTypeGen() + { + return type; + } + /* + * Creates a new nested system filter within this filter + * @param parentPool the SystemFilterPool that owns the root filter. + * @param data Optional transient data to be stored in the new filter. Can be null. + * @param aliasName The name to give the new filter. Must be unique for this pool. + * @param filterStrings The list of String objects that represent the filter strings. + * + public SystemFilter createSystemFilter(SystemFilterPool parentPool, Object data, String aliasName, Vector filterStrings) + { + SystemFilter newFilter = helpers.createSystemFilter(internalGetFilters(), parentPool, data, aliasName, filterStrings); + newFilter.setSupportsNestedFilters(true); // presumably it does since it is nested itself. + return newFilter; + }*/ + + /** + * Creates a new nested system filter within this filter. + * This filter will inherit/store the following attributes from this filter: + *
      + *
    • supportsNestedFilters + *
    • supportsDuplicateFilterStrings + *
    • stringsCaseSensitive + *
    • data + *
    + * @param aliasName The name to give the new filter. Must be unique for this pool. + * @param filterStrings The list of String objects that represent the filter strings. + */ + public ISystemFilter createSystemFilter(String aliasName, Vector filterStrings) + { + ISystemFilter newFilter = helpers.createSystemFilter(internalGetFilters(), getParentFilterPool(), aliasName, filterStrings); + newFilter.setSupportsNestedFilters(true); // presumably it does since it is nested itself. + newFilter.setSupportsDuplicateFilterStrings(supportsDuplicateFilterStrings()); + newFilter.setStringsCaseSensitive(areStringsCaseSensitive()); + return newFilter; + } + + /** + * Internal use method + */ + protected void initializeFilterStrings() + { + java.util.List filterStrings = getStrings(); + Iterator i = filterStrings.iterator(); + while (i.hasNext()) + ((ISystemFilterString)i.next()).setParentSystemFilter(this); + } + + /** + * Clones a given filter to the given target filter. + * All filter strings, and all nested filters, are copied. + * @param targetFilter new filter into which we copy all our data + */ + public void clone(ISystemFilter targetFilter) + { + // clone attributes + //targetFilter.setName(getName()); + targetFilter.setDefault(isDefault()); + targetFilter.setType(getType()); + targetFilter.setPromptable(isPromptable()); + targetFilter.setRelativeOrder(getRelativeOrder()); + targetFilter.setSupportsNestedFilters(isSupportsNestedFilters()); + targetFilter.setSupportsDuplicateFilterStrings(isSupportsDuplicateFilterStrings()); + targetFilter.setStringsNonChangable(isStringsNonChangable()); + targetFilter.setNonChangable(isNonChangable()); + targetFilter.setNonDeletable(isNonDeletable()); + targetFilter.setNonRenamable(isNonRenamable()); + if (isSetSingleFilterStringOnly()) + targetFilter.setSingleFilterStringOnly(isSingleFilterStringOnly()); + if (isSetStringsCaseSensitive()) + targetFilter.setStringsCaseSensitive(isStringsCaseSensitive()); + // clone filter strings + ISystemFilterString[] strings = getSystemFilterStrings(); + ISystemFilterString newString = null; + if (strings != null) + for (int idx=0; idx + * We always return false. + * @see SystemFilterSimple + */ + public boolean isTransient() + { + return false; + } + + /** + * Does this support nested filters? Calls mof-generated isSupportsNestedFilters. + */ + public boolean supportsNestedFilters() + { + return isSupportsNestedFilters(); + } + /** + * Does this support duplicate filter strings? Calls mof-generated isSupportsDuplicateFilterStrings. + */ + public boolean supportsDuplicateFilterStrings() + { + return isSupportsDuplicateFilterStrings(); + } + + /** + * Return true if this filter is a nested filter or not. If not, its parent is the filter pool. + */ + public boolean isNested() + { + return (getParentFilter()!=null); + } + /** + * Are filter strings in this filter case sensitive? + * If not set locally, queries the parent filter pool's atttribute. + * @return The value of the StringsCaseSensitive attribute + */ + public boolean isStringsCaseSensitive() + { + if (!isSetStringsCaseSensitive()) + return getParentFilterPool().isStringsCaseSensitive(); + else + return stringsCaseSensitive; + } + /** + * Same as isStringsCaseSensitive() + * @return The value of the StringsCaseSensitive attribute + */ + public boolean areStringsCaseSensitive() + { + return isStringsCaseSensitive(); + } + /** + * Return Vector of String objects: the names of existing filters in this container. + * Needed by name validators for New and Rename actions to verify new name is unique. + */ + public Vector getSystemFilterNames() + { + return helpers.getSystemFilterNames(internalGetFilters()); + } + + /** + * Return the nested filters as a Vector + */ + public Vector getSystemFiltersVector() + { + return helpers.getSystemFiltersVector(internalGetFilters()); + } + /** + * Return the nested filters as an array + */ + public ISystemFilter[] getSystemFilters() + { + return helpers.getSystemFilters(internalGetFilters()); + } + /** + * Return how many filters are defined in this filter container + */ + public int getSystemFilterCount() + { + return internalGetFilters().size(); + } + + /** + * Return a filter object, given its aliasname. + * Can be used to test if an aliasname is already used (non-null return). + * @param aliasName unique aliasName (case insensitive) to search on. + * @return SystemFilter object with unique aliasName, or null if + * no filter object with this name exists. + */ + public ISystemFilter getSystemFilter(String aliasName) + { + return helpers.getSystemFilter(internalGetFilters(), aliasName); + + } + /** + * Adds given filter to the list. + *

    PLEASE NOTE: + *

      + *
    • createSystemFilter calls this method for you! + *
    • this is a no-op if a filter with the same aliasname already exists + *
    + * @param filter SystemFilter object to add + * @return true if added, false if filter with this aliasname already existed. + */ + public boolean addSystemFilter(ISystemFilter filter) + { + return helpers.addSystemFilter(internalGetFilters(),filter); + } + /** + * Removes a given filter from the list. + * @param filter SystemFilter object to remove + */ + public void deleteSystemFilter(ISystemFilter filter) + { + helpers.deleteSystemFilter(internalGetFilters(),filter); + } + /** + * Rename a given filter in the list. + * @param filter SystemFilter object to remove + */ + public void renameSystemFilter(ISystemFilter filter, String newName) + { + helpers.renameSystemFilter(internalGetFilters(),filter, newName); + } + /** + * Updates a given filter in the list. + * @param filter SystemFilter object to update + * @param newName New name to assign it. Assumes unique checking already done. + * @param newStrings New strings to assign it. Replaces current strings. + */ + public void updateSystemFilter(ISystemFilter filter, String newName, String[] newStrings) + { + helpers.updateSystemFilter(internalGetFilters(), filter, newName, newStrings); + } + /** + * Duplicates a given filter in the list. + * @param filter SystemFilter object to clone + * @param alias New, unique, alias name to give this filter. Clone will fail if this is not unique. + */ + public ISystemFilter cloneSystemFilter(ISystemFilter filter, String aliasName) + { + return helpers.cloneSystemFilter(internalGetFilters(), filter, aliasName); + } + /** + * Return a given filter's zero-based location + */ + public int getSystemFilterPosition(ISystemFilter filter) + { + return helpers.getSystemFilterPosition(internalGetFilters(),filter); + } + + /** + * Move a given filter to a given zero-based location + */ + public void moveSystemFilter(int pos, ISystemFilter filter) + { + helpers.moveSystemFilter(internalGetFilters(), pos, filter); + } + /** + * Return the parent pool of this filter. For nested filters, we walk up the parent chain + * until we find the pool. + */ + public ISystemFilterPool getParentFilterPool() + { + return parentPool; + } + /** + * Internal use method to set the parent filter pool. + */ + public void setParentFilterPool(ISystemFilterPool parentPool) + { + this.parentPool = parentPool; + ISystemFilter[] filters = getSystemFilters(); + if (filters != null) + for (int idx=0; idx= strings.size()) + return null; + ISystemFilterString filterString = (ISystemFilterString)strings.get(position); + strings.remove(position); + invalidateCache(); + return filterString; + } + + /** + * Remove a filter string from this filter's list, given its SystemFilterString object. + * @return true if the given string existed and hence was deleted. + */ + public boolean removeFilterString(ISystemFilterString filterString) + { + java.util.List strings = internalGetFilterStrings(); + if (strings.contains(filterString)) + { + strings.remove(filterString); + invalidateCache(); + return true; + } + else + return false; + } + /** + * Move a given filter string to a given zero-based location + */ + public void moveSystemFilterString(int pos, ISystemFilterString filterString) + { + //FIXME internalGetFilterStrings().move(pos,filterString); + invalidateCache(); + } + + /** + * 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 the children of this filter. + * This is all nested filters and all filter strings. + */ + public Object[] getChildren() + { + Vector strings = getFilterStringsVector(); + Vector filters = getSystemFiltersVector(); + Vector vChildren = new Vector(); + + // start with nested filters... + for (int idx=0; idx < filters.size(); idx++) + vChildren.addElement(filters.elementAt(idx)); + // continue with resolved filter string objects... + for (int idx=0; idx < strings.size(); idx++) + { + String filterString = (String)strings.elementAt(idx); + vChildren.addElement(filterString); + } + + // convert whole thing to an array... + Object[] children = new Object[vChildren.size()]; + for (int idx=0; idx 0) + return true; + else + return helpers.hasSystemFilters(internalGetFilters()); + } + + /** + * Return the caller which instantiated the filter pool manager overseeing this filter framework instance + */ + public ISystemFilterPoolManagerProvider getProvider() + { + ISystemFilterPoolManager mgr = getSystemFilterPoolManager(); + if (mgr != null) + return mgr.getProvider(); + else + return null; + } + + /** + * Return the filter pool manager managing this collection of filter pools and their filters. + * To save space, we delegate this query to our parent filter pool. + */ + public ISystemFilterPoolManager getSystemFilterPoolManager() + { + ISystemFilterPool pool = getParentFilterPool(); + if (pool != null) + return pool.getSystemFilterPoolManager(); + else + return null; + } + + // ----------------------- + // SAVE/RESTORE METHODS... + // ----------------------- + + + + + + /** + * Restore specific filter. Used when save policy is SAVE_POLICY_ONE_FILE_PER_FILTER + * @param mofHelpers helper object with routines for saving/restoring using mof. + * @param folder the folder containing the saved file. + * @param name The name of the saved filter. The file name is derived from this. + * @param parentPool the SystemFilterPool that is the parent of this filter. Will be perpetuated to nested filters. + * @param namingPolicy Tells us how to derive file name from filter name. Can be null for default prefix name. + * @return SystemFilter object if restored ok, null if error encountered. If null, call getLastException(). + */ + public static ISystemFilter restore(IFolder folder, String name, ISystemFilterPool parentPool, + ISystemFilterNamingPolicy namingPolicy) + throws Exception + { + /* FIXME + String fileName = getRootSaveFileName(namingPolicy, name); + + java.util.List ext = mofHelpers.restore(folder,fileName); + + // should be exactly one... + Iterator iList = ext.iterator(); + SystemFilter filter = (SystemFilter)iList.next(); + if (parentPool != null) + filter.setParentFilterPool(parentPool); + ((SystemFilterImpl)filter).initializeFilterStrings(); + return filter; + */ + return null; + } + + + /** + * Return the root save file name without the extension .xmi + */ + protected static String getRootSaveFileName(ISystemFilter filter) + { + return getRootSaveFileName(getNamingPolicy(filter), filter.getName()); + } + /** + * Return the root save file name without the extension .xmi + */ + protected static String getRootSaveFileName(ISystemFilterNamingPolicy namingPolicy, String name) + { + return namingPolicy.getFilterSaveFileName(name); + } + + + /** + * Return naming policy + */ + protected static ISystemFilterNamingPolicy getNamingPolicy(ISystemFilter filter) + { + return filter.getParentFilterPool().getNamingPolicy(); + } + + + + /** + * Ensure given path ends with path separator. + */ + public static String addPathTerminator(String path) + { + if (!path.endsWith(File.separator)) + path = path + File.separatorChar; + //else + // path = path; + return path; + } + + /** + * Return string identifying this filter + */ + public String toString() + { + return getName(); + } + /** + * @generated This field/method will be replaced during code generation + */ + public String getName() + { + return name; + } + + public String getDescription() + { + return SystemResources.RESID_MODELOBJECTS_FILTER_DESCRIPTION; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setName(String newName) + { + name = newName; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setType(String newType) + { + type = newType; + _isDirty = true; + } + + /** + * @generated This field/method will be replaced during code generation + */ + public boolean isSupportsNestedFilters() + { + return supportsNestedFilters; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setSupportsNestedFilters(boolean newSupportsNestedFilters) + { + boolean oldSupportsNestedFilters = supportsNestedFilters; + if (oldSupportsNestedFilters != newSupportsNestedFilters) + { + supportsNestedFilters = newSupportsNestedFilters; + setDirty(true); + } + } + + /** + * @generated This field/method will be replaced during code generation + * When saving one filter per file, this captures this filter's relative order + * within the pool, as the file system cannot capture this. + */ + public int getRelativeOrder() + { + return relativeOrder; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setRelativeOrder(int newRelativeOrder) + { + relativeOrder = newRelativeOrder; + } + + /** + * @generated This field/method will be replaced during code generation + * Is this a vendor-supplied filter versus a user-defined filter + */ + public boolean isDefault() + { + return default_; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setDefault(boolean newDefault) + { + default_ = newDefault; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setStringsCaseSensitive(boolean newStringsCaseSensitive) + { + boolean oldStringsCaseSensitive = stringsCaseSensitive; + if (oldStringsCaseSensitive != newStringsCaseSensitive) + { + stringsCaseSensitive = newStringsCaseSensitive; + setDirty(true); + } + + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void unsetStringsCaseSensitive() + { + boolean oldStringsCaseSensitive = stringsCaseSensitive; + if (oldStringsCaseSensitive != STRINGS_CASE_SENSITIVE_EDEFAULT) + { + stringsCaseSensitive = STRINGS_CASE_SENSITIVE_EDEFAULT; + setDirty(true); + } + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public boolean isSetStringsCaseSensitive() + { + return stringsCaseSensitive; + } + + /** + * @generated This field/method will be replaced during code generation + * If true, the user is prompted when this filter is expanded + */ + public boolean isPromptable() + { + return promptable; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setPromptable(boolean newPromptable) + { + promptable = newPromptable; + } + + /** + * @generated This field/method will be replaced during code generation + */ + public ISystemFilter getParentFilter() + { + //FIXME + return _parentFilter; + //if (eContainerFeatureID != FiltersPackage.SYSTEM_FILTER__PARENT_FILTER) return null; + //return (SystemFilter)eContainer; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setParentFilter(ISystemFilter newParentFilter) + { + _parentFilter = newParentFilter; + /* FIXME + if (newParentFilter != eContainer || (eContainerFeatureID != FiltersPackage.SYSTEM_FILTER__PARENT_FILTER && newParentFilter != null)) + { + if (EcoreUtil.isAncestor(this, newParentFilter)) + throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); + NotificationChain msgs = null; + if (eContainer != null) + msgs = eBasicRemoveFromContainer(msgs); + if (newParentFilter != null) + msgs = ((InternalEObject)newParentFilter).eInverseAdd(this, FiltersPackage.SYSTEM_FILTER__NESTED_FILTERS, SystemFilter.class, msgs); + msgs = eBasicSetContainer((InternalEObject)newParentFilter, FiltersPackage.SYSTEM_FILTER__PARENT_FILTER, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FiltersPackage.SYSTEM_FILTER__PARENT_FILTER, newParentFilter, newParentFilter)); + */ + } + + /** + * @generated This field/method will be replaced during code generation + */ + public java.util.List getNestedFilters() + { + if (nestedFilters == null) + { + nestedFilters = new ArrayList(); + //FIXME new EObjectContainmentWithInversejava.util.List(SystemFilter.class, this, FiltersPackage.SYSTEM_FILTER__NESTED_FILTERS, FiltersPackage.SYSTEM_FILTER__PARENT_FILTER); + } + return nestedFilters; + } + + /** + * @generated This field/method will be replaced during code generation + */ + public java.util.List getStrings() + { + if (strings == null) + { + strings = new ArrayList(); + //FIXME new EObjectContainmenteList(SystemFilterString.class, this, FiltersPackage.SYSTEM_FILTER__STRINGS); + } + return strings; + } + + /** + * @generated This field/method will be replaced during code generation + */ + public boolean isSupportsDuplicateFilterStrings() + { + return supportsDuplicateFilterStrings; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setSupportsDuplicateFilterStrings(boolean newSupportsDuplicateFilterStrings) + { + boolean oldSupportsDuplicateFilterStrings = supportsDuplicateFilterStrings; + if (oldSupportsDuplicateFilterStrings != newSupportsDuplicateFilterStrings) + { + supportsDuplicateFilterStrings = newSupportsDuplicateFilterStrings; + setDirty(true); + } + } + + /** + * @generated This field/method will be replaced during code generation + */ + public boolean isNonDeletable() + { + return nonDeletable; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setNonDeletable(boolean newNonDeletable) + { + nonDeletable = newNonDeletable; + } + + /** + * @generated This field/method will be replaced during code generation + */ + public boolean isNonRenamable() + { + return nonRenamable; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setNonRenamable(boolean newNonRenamable) + { + nonRenamable = newNonRenamable; + } + + /** + * @generated This field/method will be replaced during code generation + */ + public boolean isNonChangable() + { + return nonChangable; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setNonChangable(boolean newNonChangable) + { + nonChangable = newNonChangable; + } + + /** + * @generated This field/method will be replaced during code generation + * Are the filter strings within this filter non-changable by the user. If true, + * strings can be deleted, added, edited or reordered. + */ + public boolean isStringsNonChangable() + { + return stringsNonChangable; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setStringsNonChangable(boolean newStringsNonChangable) + { + boolean oldStringsNonChangable = stringsNonChangable; + if (oldStringsNonChangable != newStringsNonChangable) + { + stringsNonChangable = newStringsNonChangable; + setDirty(true); + } + } + + /** + * @generated This field/method will be replaced during code generation + * In what release was this created? Typically, will be the version and release + * times 10, as in 40 or 51. + */ + public int getRelease() + { + return release; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setRelease(int newRelease) + { + release = newRelease; + } + + /** + * Returns true if this filter is limited to a single filter string. If not set here, + * it is queried from the parent pool. + */ + public boolean isSingleFilterStringOnly() + { + if (isSetSingleFilterStringOnly()) + return singleFilterStringOnly; + else + return getSystemFilterPool().isSingleFilterStringOnly(); + } + + public boolean isSingleFilterStringOnlyGen() + { + return singleFilterStringOnly; + } + + public void setSingleFilterStringOnly(boolean newSingleFilterStringOnly) + { + boolean oldSingleFilterStringOnly = singleFilterStringOnly; + if (oldSingleFilterStringOnly != newSingleFilterStringOnly) + { + singleFilterStringOnly = newSingleFilterStringOnly; + setDirty(true); + } + } + + + public void unsetSingleFilterStringOnly() + { + boolean oldSingleFilterStringOnly = singleFilterStringOnly; + if (oldSingleFilterStringOnly != SINGLE_FILTER_STRING_ONLY_EDEFAULT) + { + singleFilterStringOnly = SINGLE_FILTER_STRING_ONLY_EDEFAULT; + setDirty(true); + } + + } + + public boolean isSetSingleFilterStringOnly() + { + return singleFilterStringOnly; + } + + /** + * Inidcates whether this filter needs to be saved + */ + public boolean isDirty() + { + return _isDirty; + } + + public void setDirty(boolean dirtyFlag) + { + _isDirty = dirtyFlag; + } + + public boolean commit() + { + return SystemPlugin.getThePersistenceManager().commit(this); + } + + public boolean wasRestored() + { + return _wasRestored; + } + + public void setWasRestored(boolean flag) + { + _wasRestored = flag; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterContainerCommonMethods.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterContainerCommonMethods.java new file mode 100644 index 00000000000..2af0dba6b78 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterContainerCommonMethods.java @@ -0,0 +1,570 @@ +/******************************************************************************** + * 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.internal.filters; +import java.util.Iterator; +import java.util.Vector; + +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.ui.SystemResources; + + +/** + * This class abstracts out some common code needed by any class that + * implements ISystemFilterContainer. + *

    + * This class supports two overloaded version of each method. One that + * takes a MOF java.util.List for the filter list, and one that takes a Vector for + * the filter list. This is to offer seamless flexibility in how the filters + * are stored internally. + */ +public class SystemFilterContainerCommonMethods + //implements ISystemFilterContainer +{ + private Vector filterNameVector, filterVector; + private ISystemFilter[] filterArray; + + /** + * Constructor + */ + protected SystemFilterContainerCommonMethods() + { + super(); + } + + + /** + * For performance reasons we have decided to store a cache of the + * filters in vector and array form, so each request will not result + * in a new temporary vector or array. However, this cache can get out + * of date, so this method must be called religiously to invalidate it + * after any change in the filters. + */ + public void invalidateCache() + { + filterNameVector = filterVector = null; + filterArray = null; + } + + /** + * Creates a new system filter within this pool or filter. + * @param filters MOF list of filters the new filter is to be added to. + * @param parentPool pool that contains this filter (directly or indirectly). + * @param aliasName The name to give the new filter. Must be unique for this pool. + * @param filterStrings The list of String objects that represent the filter strings. + */ + public ISystemFilter createSystemFilter(java.util.List filters, + ISystemFilterPool parentPool, + String aliasName, Vector filterStrings) + { + ISystemFilter newFilter = null; + + // FIXME - not using error message and null return + // because I want to restore filters while not being hit with conflicts + newFilter = getSystemFilter(filters, aliasName); + if (newFilter != null) + { + return newFilter; + } + /* DKM + boolean exists = getSystemFilter(filters, aliasName) != null; + if (exists) + { + String msg = "Error creating filter: aliasName " + aliasName + " is not unique"; // no need to xlate, internal only + SystemPlugin.logError(msg); + return null; + } + */ + newFilter = internalCreateSystemFilter(parentPool, aliasName, filterStrings); + if (newFilter != null) + internalAddSystemFilter(filters, newFilter); + return newFilter; + } + /** + * Creates a new system filter within this pool or filter. + * @param filters Vector of filters the new filter is to be added to. + * @param parentPool pool that contains this filter (directly or indirectly) + * @param aliasName The name to give the new filter. Must be unique for this pool. + * @param filterStrings The list of String objects that represent the filter strings. + */ + public ISystemFilter createSystemFilter(Vector filters, + ISystemFilterPool parentPool, + String aliasName, Vector filterStrings) + { + ISystemFilter newFilter = null; + boolean exists = getSystemFilter(filters, aliasName) != null; + if (exists) + { + String msg = "Error creating filter: aliasName " + aliasName + " is not unique"; // no need to xlate, internal only + SystemBasePlugin.logError(msg); + return null; + } + newFilter = internalCreateSystemFilter(parentPool, aliasName, filterStrings); + if (newFilter != null) + internalAddSystemFilter(filters, newFilter); + return newFilter; + } + + + /** + * Internal encapsulation of mof effort to create new filter, and setting of + * the core attributes. + */ + private ISystemFilter internalCreateSystemFilter( + ISystemFilterPool parentPool, + String aliasName, Vector filterStrings) + { + ISystemFilter newFilter = null; + try + { + newFilter = new SystemFilter(); + // FIXME getMOFfactory().createSystemFilter(); + newFilter.setRelease(SystemResources.CURRENT_RELEASE); + newFilter.setName(aliasName); + newFilter.setParentFilterPool(parentPool); + if (filterStrings != null) + newFilter.setFilterStrings(filterStrings); + //java.util.List filterStringList = newFilter.getFilterStrings(); + //for (int idx=0; idx0); + } + /** + * Return true if there are system filters + */ + public boolean hasSystemFilters(Vector filters) + { + return (filters!=null) && (filters.size()>0); + } + + + /** + * Return a filter object, given its aliasname. + * Can be used to test if an aliasname is already used (non-null return). + * @param aliasName unique aliasName (case insensitive) to search on. + * @return SystemFilter object with unique aliasName, or null if + * no filter object with this name exists. + */ + public ISystemFilter getSystemFilter(java.util.List filters, String aliasName) + { + ISystemFilter filter = null; + ISystemFilter currFilter = null; + Iterator i = filters.iterator(); + while (i.hasNext() && (filter==null)) + { + currFilter = (ISystemFilter)i.next(); + if (currFilter.getName().equalsIgnoreCase(aliasName)) + filter = currFilter; + } + return filter; + } + /** + * Return a filter object, given its aliasname. + * Can be used to test if an aliasname is already used (non-null return). + * @param aliasName unique aliasName (case insensitive) to search on. + * @return SystemFilter object with unique aliasName, or null if + * no filter object with this name exists. + */ + public ISystemFilter getSystemFilter(Vector filters, String aliasName) + { + if ((filters == null) || (filters.size()==0)) + return null; + ISystemFilter filter = null; + ISystemFilter currFilter = null; + for (int idx=0; (idxPLEASE NOTE: + *

      + *
    • createSystemFilter calls this method for you! + *
    • this is a no-op if a filter with the same aliasname already exists + *
    + * @param filter SystemFilter object to add + * @return true if added, false if filter with this aliasname already existed. + */ + public boolean addSystemFilter(java.util.List filters, ISystemFilter filter) + { + boolean exists = getSystemFilter(filters, filter.getName()) != null; + if (!exists) + return internalAddSystemFilter(filters, filter); + else + return false; + } + /** + * Internally, we can skip the uniqueness checking. + */ + protected boolean internalAddSystemFilter(java.util.List filters, ISystemFilter filter) + { + filters.add(filter); + invalidateCache(); + return true; + } + /** + * Adds given filter to the list. + *

    PLEASE NOTE: + *

      + *
    • createSystemFilter calls this method for you! + *
    • this is a no-op if a filter with the same aliasname already exists + *
    + * @param filter SystemFilter object to add + * @return true if added, false if filter with this aliasname already existed. + */ + public boolean addSystemFilter(Vector filters, ISystemFilter filter) + { + boolean exists = getSystemFilter(filters, filter.getName()) != null; + if (!exists) + return internalAddSystemFilter(filters, filter); + else + return false; + } + /** + * Internally, we can skip the uniqueness checking. + */ + private boolean internalAddSystemFilter(Vector filters, ISystemFilter filter) + { + filters.add(filter); + invalidateCache(); + return true; + } + + + + /** + * Removes a given filter from the list. + * Does NOT follow references to remove them. + * @param filters MOF list to remove from + * @param filter SystemFilter object to remove + */ + public void deleteSystemFilter(java.util.List filters, ISystemFilter filter) + { + filters.remove(filter); + invalidateCache(); + } + /** + * Renames a given filter from the list. + * @param filters java.util.List list + * @param filter SystemFilter object to rename + * @param newName new name to give filter + */ + public void renameSystemFilter(java.util.List filters, ISystemFilter filter, String newName) + { + filter.setName(newName); + invalidateCache(); + } + + /** + * Removes a given filter from the list. + * Does NOT follow references to remove them. + * @param filters Vector list to remove from + * @param filter SystemFilter object to remove + */ + public void deleteSystemFilter(Vector filters, ISystemFilter filter) + { + filters.remove(filter); + invalidateCache(); + } + /** + * Renames a given filter from the list. + * @param filters Vector list + * @param filter SystemFilter object to rename + * @param newName new name to give filter + */ + public void renameSystemFilter(Vector filters, ISystemFilter filter, String newName) + { + filter.setName(newName); + invalidateCache(); + } + /** + * Updates a given filter in the list. + * @param filters Vector list + * @param filter SystemFilter object to update + * @param newName new name to give filter + * @param newString new strings to give filter + */ + public void updateSystemFilter(Vector filters, ISystemFilter filter, String newName, String[] newStrings) + { + filter.setName(newName); + filter.setFilterStrings(newStrings); + invalidateCache(); + } + /** + * Updates a given filter in the list. + * @param filters java.util.List list + * @param filter SystemFilter object to update + * @param newName new name to give filter + * @param newString new strings to give filter + */ + public void updateSystemFilter(java.util.List filters, ISystemFilter filter, String newName, String[] newStrings) + { + filter.setName(newName); + filter.setFilterStrings(newStrings); + invalidateCache(); + } + /** + * Duplicates a given filter in the list. + * @param filters MOF list of filters into which to place the clone + * @param filter SystemFilter object to clone + * @param aliasName New, unique, alias name to give this filter. Clone will fail if this is not unique. + */ + public ISystemFilter cloneSystemFilter(java.util.List filters, ISystemFilter filter, String aliasName) + { + + ISystemFilter copy = + createSystemFilter(filters, filter.getParentFilterPool(), + aliasName, filter.getFilterStringsVector()); + internalAfterCloneSystemFilter(filter, copy); + // now clone nested filters... + ISystemFilter[] nested = filter.getSystemFilters(); + if ((nested!=null) && (nested.length>0)) + for (int idx=0; idx0)) + for (int idx=0; idx 0; + } + + /** + * Return count of the number of filters in the referenced pool or filter + */ + public int getFilterCount() + { + int count = 0; + ISystemFilterContainer parent = parentRef.getReferencedSystemFilterContainer(); + java.util.List mofList = null; + if (parent instanceof ISystemFilterPool) + mofList = ((ISystemFilterPool)parent).getFilters(); + else + mofList = ((ISystemFilter)parent).getNestedFilters(); + if (mofList != null) + count = mofList.size(); + return count; + } + + /** + * Get the list of nested filters referenced by this ISystemFilterContainerReference. + */ + public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem) + { + + // These reference objects are built on the fly, each time, rather than + // maintaining a persisted list of such references. The reason + // is we do not at this time allow users to subset the master list + // of filters maintained by a filterpool. Hence, we always simply + // return a complete list. However, to save memory we try to only + // re-gen the list if something has changed. + ISystemFilterContainer parent = parentRef.getReferencedSystemFilterContainer(); + java.util.List mofList = null; + if (parent instanceof ISystemFilterPool) + mofList = ((ISystemFilterPool)parent).getFilters(); + else + mofList = ((ISystemFilter)parent).getNestedFilters(); + boolean needToReGen = compareFilters(mofList); + //System.out.println("In getSFRefs for " + getName() + ": regen? " + needToReGen); + + if (needToReGen) + { + // first, need remove backward references... + + // second, build new references... + referencedFilters = generateFilterReferences(subSystem, mofList); + } + return referencedFilters; + } + + /** + * To save memory, we try to only regenerate the referenced filter list + * if something has changed. + */ + private boolean compareFilters(java.util.List newFilters) + { + boolean mustReGen = false; + if (newFilters == null) + { + if (referencedFilters != null) + return true; + else + return false; + } + else if (referencedFilters == null) + { + return true; // newFilters != null && referencedFilters == null + } + // both old and new are non-null + if (newFilters.size() != referencedFilters.length) + return true; + Iterator i = newFilters.iterator(); + for (int idx=0; !mustReGen && (idx0)) + { + for (int idx=0; (ref==null) && (idx + * Subclass this and override what you wish to change. + */ +public class SystemFilterNamingPolicy implements ISystemFilterNamingPolicy, ISystemFilterConstants +{ + + protected String managerFileNamePrefix, poolFolderNamePrefix, poolFolderNameSuffix, + poolFileNamePrefix, filterFileNamePrefix, + referenceManagerFileNamePrefix; + /** + * Default prefix for filter pool manager persisted file: "filterPools_" + */ + public static final String DEFAULT_FILENAME_PREFIX_FILTERPOOLMANAGER = "filterPools_"; + /** + * Default prefix for filter pool reference manager persisted file: "filterPoolRefs_" + */ + public static final String DEFAULT_FILENAME_PREFIX_FILTERPOOLREFERENCEMANAGER = "filterPoolRefs_"; + /** + * Default prefix for filter pool persisted file: "filterPool_" + */ + public static final String DEFAULT_FILENAME_PREFIX_FILTERPOOL = "filterPool_"; + /** + * Default prefix for filter persisted file: "filter_" + */ + public static final String DEFAULT_FILENAME_PREFIX_FILTER = "filter_"; + /** + * Default prefix for filter pool folder: "FilterPool_" + */ + public static final String DEFAULT_FOLDERNAME_PREFIX_FILTERPOOL = "FilterPool_"; + + + /** + * Factory method to return an instance populated with defaults. + * Can then simply override whatever is desired. + */ + public static ISystemFilterNamingPolicy getNamingPolicy() + { + return new SystemFilterNamingPolicy(); + } + + /** + * Constructor for SystemFilterNamingPolicyImpl + */ + public SystemFilterNamingPolicy() + { + super(); + } + + /** + * Get the unqualified save file name for the given SystemFilterPoolManager object. + * Do NOT include the extension, as .xmi will be added. + *

    + * Returns "filterPools_"+managerName by default. + */ + public String getManagerSaveFileName(String managerName) + { + return DEFAULT_FILENAME_PREFIX_FILTERPOOLMANAGER+managerName; + } + /** + * Get the unqualified save file name for the given SystemFilterPoolReferenceManager object. + * Do NOT include the extension, as .xmi will be added. + *

    + * Returns "filterPoolRefs_"+managerName by default. + */ + public String getReferenceManagerSaveFileName(String managerName) + { + return DEFAULT_FILENAME_PREFIX_FILTERPOOLREFERENCEMANAGER+managerName; + } + /** + * Get the unqualified save file name for the given SystemFilterPool object. + * Do NOT include the extension, as .xmi will be added. + *

    + * Returns getFilterPoolSaveFileNamePrefix()+poolName by default. + */ + public String getFilterPoolSaveFileName(String poolName) + { + return getFilterPoolSaveFileNamePrefix()+poolName; + } + /** + * Get the file name prefix for all pool files. + * Used to deduce the saved pools by examining the file system + *

    + * By default returns "filterPool_" + */ + public String getFilterPoolSaveFileNamePrefix() + { + return DEFAULT_FILENAME_PREFIX_FILTERPOOL; + } + /** + * Get the folder name for the given SystemFilterPool object. + *

    + * Returns getFilterPoolFolderNamePrefix()+poolName by default. + */ + public String getFilterPoolFolderName(String poolName) + { + return getFilterPoolFolderNamePrefix()+poolName; + } + /** + * Get the folder name prefix for all pool folders. + * Used to deduce the saved pools by examining the file system + *

    + * By default returns "FilterPool_" + */ + public String getFilterPoolFolderNamePrefix() + { + return DEFAULT_FOLDERNAME_PREFIX_FILTERPOOL; + } + /** + * Get the unqualified save file name for the given SystemFilter object. + * Do NOT include the extension, as .xmi will be added. + *

    + * Returns getFilterSaveFileNamePrefix()+filterName by default. + */ + public String getFilterSaveFileName(String filterName) + { + return getFilterSaveFileNamePrefix()+filterName; + } + /** + * Get the file name prefix for all filter files. + * Used to deduce the saved filters by examining the file system + *

    + * Returns "Filter_" by default. + */ + public String getFilterSaveFileNamePrefix() + { + return DEFAULT_FILENAME_PREFIX_FILTER; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterPool.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterPool.java new file mode 100644 index 00000000000..1308fcefda5 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterPool.java @@ -0,0 +1,1397 @@ +/******************************************************************************** + * 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.internal.filters; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Vector; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.SystemResourceHelpers; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterConstants; +import org.eclipse.rse.filters.ISystemFilterContainer; +import org.eclipse.rse.filters.ISystemFilterNamingPolicy; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider; +import org.eclipse.rse.filters.ISystemFilterSavePolicies; +import org.eclipse.rse.internal.references.SystemPersistableReferencedObject; +import org.eclipse.rse.ui.SystemResources; + +/** + * This is a system filter pool, which is a means of grouping filters + * and managing them as a list. + *

    + * To enable filters themselves to be automous and sharable, it is decided + * that no data will be persisted in the filter pool itself. Rather, all + * attributes other than the list of filters are transient and as such it is + * the responsibility of the programmer using a filter pool to set these + * attributes after creating or restoring a filter pool. Typically, this is + * what a filter pool manager (SystemFilterPoolManager) will do for you. + */ +/** + * @lastgen class SystemFilterPoolImpl extends SystemPersistableReferencedObjectImpl implements SystemFilterPool, SystemFilterSavePolicies, SystemFilterConstants, SystemFilterContainer, IAdaptable + */ +public class SystemFilterPool extends SystemPersistableReferencedObject + implements ISystemFilterPool, ISystemFilterSavePolicies, ISystemFilterConstants, ISystemFilterContainer, IAdaptable +{ + + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + private String name; + /** + * The default value of the '{@link #getType() Type}' attribute. + * + * + * @see #getType() + * @generated + * @ordered + */ + protected static final String TYPE_EDEFAULT = null; + + private int savePolicy; + private ISystemFilterNamingPolicy namingPolicy = null; + private ISystemFilterPoolManager mgr; + //private Vector filters = new Vector(); + private SystemFilterContainerCommonMethods helpers = null; + private Object filterPoolData = null; + private boolean initialized = false; + //private boolean isSharable = false; + protected boolean specialCaseNoDataRestored = false; + private boolean debug = false; + protected static final String DELIMITER = SystemFilterPoolReference.DELIMITER; + + // persistance + protected boolean _isDirty = true; + protected boolean _wasRestored = false; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected String type = TYPE_EDEFAULT; + /** + * The default value of the '{@link #isSupportsNestedFilters() Supports Nested Filters}' attribute. + * + * + * @see #isSupportsNestedFilters() + * @generated + * @ordered + */ + protected static final boolean SUPPORTS_NESTED_FILTERS_EDEFAULT = false; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected boolean supportsNestedFilters = SUPPORTS_NESTED_FILTERS_EDEFAULT; + /** + * The default value of the '{@link #isDeletable() Deletable}' attribute. + * + * + * @see #isDeletable() + * @generated + * @ordered + */ + protected static final boolean DELETABLE_EDEFAULT = false; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected boolean deletable = DELETABLE_EDEFAULT; + /** + * The default value of the '{@link #isDefault() Default}' attribute. + * + * + * @see #isDefault() + * @generated + * @ordered + */ + protected static final boolean DEFAULT_EDEFAULT = false; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected boolean default_ = DEFAULT_EDEFAULT; + /** + * The default value of the '{@link #isStringsCaseSensitive() Strings Case Sensitive}' attribute. + * + * + * @see #isStringsCaseSensitive() + * @generated + * @ordered + */ + protected static final boolean STRINGS_CASE_SENSITIVE_EDEFAULT = false; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected boolean stringsCaseSensitive = STRINGS_CASE_SENSITIVE_EDEFAULT; + /** + * This is true if the Strings Case Sensitive attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean stringsCaseSensitiveESet = false; + + /** + * The default value of the '{@link #isSupportsDuplicateFilterStrings() Supports Duplicate Filter Strings}' attribute. + * + * + * @see #isSupportsDuplicateFilterStrings() + * @generated + * @ordered + */ + protected static final boolean SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT = false; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected boolean supportsDuplicateFilterStrings = SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT; + /** + * The default value of the '{@link #getRelease() Release}' attribute. + * + * + * @see #getRelease() + * @generated + * @ordered + */ + protected static final int RELEASE_EDEFAULT = 0; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected int release = RELEASE_EDEFAULT; + /** + * The default value of the '{@link #isSingleFilterStringOnly() Single Filter String Only}' attribute. + * + * + * @see #isSingleFilterStringOnly() + * @generated + * @ordered + */ + protected static final boolean SINGLE_FILTER_STRING_ONLY_EDEFAULT = false; + + /** + * The cached value of the '{@link #isSingleFilterStringOnly() Single Filter String Only}' attribute. + * + * + * @see #isSingleFilterStringOnly() + * @generated + * @ordered + */ + protected boolean singleFilterStringOnly = SINGLE_FILTER_STRING_ONLY_EDEFAULT; + + /** + * This is true if the Single Filter String Only attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean singleFilterStringOnlyESet = false; + + /** + * The default value of the '{@link #getOwningParentName() Owning Parent Name}' attribute. + * + * + * @see #getOwningParentName() + * @generated + * @ordered + */ + protected static final String OWNING_PARENT_NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getOwningParentName() Owning Parent Name}' attribute. + * + * + * @see #getOwningParentName() + * @generated + * @ordered + */ + protected String owningParentName = OWNING_PARENT_NAME_EDEFAULT; + + /** + * The default value of the '{@link #isNonRenamable() Non Renamable}' attribute. + * + * + * @see #isNonRenamable() + * @generated + * @ordered + */ + protected static final boolean NON_RENAMABLE_EDEFAULT = false; + + /** + * The cached value of the '{@link #isNonRenamable() Non Renamable}' attribute. + * + * + * @see #isNonRenamable() + * @generated + * @ordered + */ + protected boolean nonRenamable = NON_RENAMABLE_EDEFAULT; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected java.util.List filters = null; +/** + * Default constructor + */ + protected SystemFilterPool() + { + super(); + helpers = new SystemFilterContainerCommonMethods(); + } + /** + * Static factory method for creating a new filter pool. Will + * first try to restore it, and if that fails will create a new instance and + * return it. + *

    + * Use this method only if you are not using a SystemFilterPoolManager, else + * use the createSystemFilterPool method in that class. + * + * @param mofHelpers SystemMOFHelpers object with helper methods for saving and restoring via mof + * @param poolFolder the folder that will hold the filter pool. + * This folder will be created if it does not already exist. + * @param name the name of the filter pool. Typically this is also the name + * of the given folder, but this is not required. For the save policy of one file + * per pool, the name of the file is derived from this. + * @param allowNestedFilters true if filters inside this filter pool are + * to allow nested filters. + * @param isDeletable true if this filter pool is allowed to be deleted by users. + * @param tryToRestore true to attempt a restore first, false if a pure create operation. + * @param savePolicy The save policy for the filter pool and filters. One of the + * following constants from the SystemFilterConstants interface: + *

      + *
    • SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL - one file and folder per pool + *
    • SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER - one file per pool, all files in one folder + *
    • SAVE_POLICY_ONE_FILE_PER_FILTER - one file per filter, one folder per pool + *
    + * @param namingPolicy The names to use for file and folders when persisting to disk. Pass + * null to just use the defaults. + */ + public static ISystemFilterPool createSystemFilterPool( + String name, + boolean allowNestedFilters, + boolean isDeletable, + boolean tryToRestore) + { + + + SystemFilterPool pool = null; + if (tryToRestore) + { + try + { + pool = (SystemFilterPool)SystemPlugin.getThePersistenceManager().restoreFilterPool(name); + } + catch (Exception exc) // real error trying to restore, versus simply not found. + { + // todo: something? Log the exception somewhere? + } + } + if (pool == null) // not found or some serious error. + { + pool = createPool(); + } + if (pool != null) + { + pool.initialize(name, allowNestedFilters, isDeletable); + } + return pool; + } + + // temporary! + //public boolean isSharable() {return isSharable; } + //public void setIsSharable(boolean is) { isSharable = is; } + + /* + * Private helper method. + * Uses MOF to create an instance of this class. + */ + protected static SystemFilterPool createPool() + { + ISystemFilterPool pool = new SystemFilterPool(); + // FIXME SystemFilterImpl.initMOF().createSystemFilterPool(); + pool.setRelease(SystemResources.CURRENT_RELEASE); + return (SystemFilterPool)pool; + } + + /* + * Private helper method to initialize attributes + */ + protected void initialize(String name, + boolean allowNestedFilters, + boolean isDeletable) + { + if (!initialized) + initialize(name, savePolicy, namingPolicy); + setDeletable(isDeletable); // mof attribute + //System.out.println("In initialize() for filter pool " + getName() + ". isDeletable= " + isDeletable); + setSupportsNestedFilters(allowNestedFilters); // cascades to each filter + } + + /* + * Private helper method to core initialization, from either createXXX or restore. + */ + protected void initialize(String name, + int savePolicy, ISystemFilterNamingPolicy namingPolicy) + { + setName(name); // mof attribute + setSavePolicy(savePolicy); + setNamingPolicy(namingPolicy); + + initialized = true; + } + + + //protected Vector internalGetFilters() + protected java.util.List internalGetFilters() + { + //return filters; + return getFilters(); // mof-supplied in parent class + } + + /** + * Return the caller which instantiated the filter pool manager overseeing this filter framework instance + */ + public ISystemFilterPoolManagerProvider getProvider() + { + ISystemFilterPoolManager mgr = getSystemFilterPoolManager(); + if (mgr != null) + return mgr.getProvider(); + else + return null; + } + + /** + * Set the save file policy. See constants in {@link org.eclipse.rse.filters.ISystemFilterConstants SystemFilterConstants}. + * One of: + *
      + *
    • SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL - one file and folder per pool + *
    • SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER - one file per pool, all files in one folder + *
    • SAVE_POLICY_ONE_FILE_PER_FILTER - one file per filter, one folder per pool + *
    + * This method is called by the SystemFilterPoolManager. + */ + public void setSavePolicy(int policy) + { + if (this.savePolicy != policy) + { + this.savePolicy = policy; + setDirty(true); + } + } + + /** + * Set the naming policy used when saving data to disk. + * @see org.eclipse.rse.filters.ISystemFilterNamingPolicy + */ + public void setNamingPolicy(ISystemFilterNamingPolicy namingPolicy) + { + if (this.namingPolicy != namingPolicy) + { + this.namingPolicy = namingPolicy; + setDirty(true); + } + } + + /** + * Get the naming policy currently used when saving data to disk. + * @see org.eclipse.rse.filters.ISystemFilterNamingPolicy + */ + public ISystemFilterNamingPolicy getNamingPolicy() + { + return namingPolicy; + } + + /** + * Set whether filters in this pool support nested filters. + * Important to note this is stored in every filter as well as this filter pool. + */ + public void setSupportsNestedFilters(boolean supports) + { + this.setSupportsNestedFiltersGen(supports); + ISystemFilter[] filters = getSystemFilters(); + if (filters != null) + for (int idx=0; idx + * + * @generated + */ + public void setSupportsNestedFiltersGen(boolean newSupportsNestedFilters) + { + supportsNestedFilters = newSupportsNestedFilters; + } + + /** + * Set whether filters in this pool support duplicate filter strings. + * Important to note this is stored in every filter as well as this filter pool. + */ + public void setSupportsDuplicateFilterStrings(boolean supports) + { + setSupportsDuplicateFilterStringsGen(supports); + ISystemFilter[] filters = getSystemFilters(); + if (filters != null) + for (int idx=0; idx + * + * @generated + */ + public void setSupportsDuplicateFilterStringsGen(boolean newSupportsDuplicateFilterStrings) + { + supportsDuplicateFilterStrings = newSupportsDuplicateFilterStrings; + } + + /** + * Set whether filters in this pool support case-sensitive filter strings. + * Important to note this is stored in every filter as well as this filter pool. + */ + public void setStringsCaseSensitive(boolean supports) + { + this.setStringsCaseSensitiveGen(supports); + ISystemFilter[] filters = getSystemFilters(); + if (filters != null) + for (int idx=0; idx + * + * @generated + */ + public void setStringsCaseSensitiveGen(boolean newStringsCaseSensitive) + { + stringsCaseSensitive = newStringsCaseSensitive; + stringsCaseSensitiveESet = true; + } + + /** + * Set the filter pool manager. Called by SystemFilterPoolManager + */ + public void setSystemFilterPoolManager(ISystemFilterPoolManager mgr) + { + this.mgr = mgr; + } + /** + * Return the filter pool manager managing this collection of filter pools and their filters. + */ + public ISystemFilterPoolManager getSystemFilterPoolManager() + { + return mgr; + } + + /** + * While setData is for global data to set in all objects in the filter framework, + * this is to set transient data that only the filter pool holds. + */ + public void setSystemFilterPoolData(Object data) + { + this.filterPoolData = data; + } + + /** + * Return transient data set via setFilterPoolData. + */ + public Object getSystemFilterPoolData() + { + return filterPoolData; + } + + public String getId() + { + return getProvider().getId(); + } + + /** + * @see ISystemFilterPool#getName() + */ + public String getName() + { + return name; + } + + public String getDescription() + { + return SystemResources.RESID_MODELOBJECTS_FILTERPOOL_DESCRIPTION; + } + + /** + * Set the name of this filter pool. + */ + public void setName(String name) + { + if (this.name == null || !this.name.equals(name) ) + { + this.name = name; + setDirty(true); + } + } + + /** + * Returns the type attribute. Intercepted to return SystemFilterConstants.DEFAULT_TYPE if it is currently null + * Allows tools to have typed filter pools + */ + public String getType() + { + String type = this.getTypeGen(); + if (type == null) + return ISystemFilterConstants.DEFAULT_TYPE; + else + return type; + } + /** + * @generated This field/method will be replaced during code generation + * Allows tools to have typed filter pools + */ + public String getTypeGen() + { + return type; + } + + /** + * + * + * @generated + */ + public boolean isDeletable() + { + return deletable; + } + + /** + * + * + * @generated + */ + public void setDeletable(boolean newDeletable) + { + deletable = newDeletable; + } + + /** + * + * + * @generated + */ + public boolean isDefault() + { + if (!default_) + { + default_ = (getType().equals(DEFAULT_TYPE)); + } + return default_; + } + + /** + * + * + * @generated + */ + public void setDefault(boolean newDefault) + { + default_ = newDefault; + } + + /** + * Does this support nested filters? Calls mof-generated isSupportsNestedFilters. + */ + public boolean supportsNestedFilters() + { + return isSupportsNestedFilters(); + } + /** + * Does this support duplicate filter strings? Calls mof-generated isSupportsDuplicateFilterStrings. + */ + public boolean supportsDuplicateFilterStrings() + { + return isSupportsDuplicateFilterStrings(); + } + /** + * @return The value of the StringsCaseSensitive attribute + * Are filter strings in this filter case sensitive? + * If not set locally, queries the parent filter pool manager's atttribute. + */ + public boolean isStringsCaseSensitive() + { + if (!isSetStringsCaseSensitive()) + return getSystemFilterPoolManager().isStringsCaseSensitive(); + else + return stringsCaseSensitive; + } + /** + * Same as isStringsCaseSensitive() + * @return The value of the StringsCaseSensitive attribute + */ + public boolean areStringsCaseSensitive() + { + return isStringsCaseSensitive(); + } + /** + * Clone this filter pools' attributes and filters into another filter pool. + * Assumes the core attributes were already set when filter pool was created: + *
      + *
    • Name + *
    • Deletable + *
    • Supports nested filters + *
    • Manager + *
    + * Attributes we clone: + *
      + *
    • Data + *
    • Type + *
    • Default + *
    • Case sensitive + *
    • Supports duplicate filter strings + *
    • Release + *
    + */ + public void cloneSystemFilterPool(ISystemFilterPool targetPool) + throws Exception + { + //System.out.println("In SystemFilterPoolImpl#cloneSystemFilterPool. targetPool null? " + (targetPool == null)); + if (filterPoolData != null) + targetPool.setSystemFilterPoolData(filterPoolData); + + //String ourType = getTypeGen(); + //if (ourType != null) + // targetPool.setType(ourType); + targetPool.setType(getType()); + + targetPool.setDeletable(isDeletable()); + targetPool.setSupportsNestedFilters(isSupportsNestedFilters()); + + //Boolean ourDefault = getDefault(); + //if (ourDefault != null) + // targetPool.setDefault(ourDefault); + targetPool.setDefault(isDefault()); + + targetPool.setSupportsDuplicateFilterStrings(supportsDuplicateFilterStrings()); + targetPool.setRelease(getRelease()); + //targetPool.setNonDeletable(isNonDeletable()); + targetPool.setNonRenamable(isNonRenamable()); + targetPool.setOwningParentName(getOwningParentName()); + if (isSetSingleFilterStringOnly()) + targetPool.setSingleFilterStringOnly(isSingleFilterStringOnly()); + if (isSetStringsCaseSensitive()) + targetPool.setStringsCaseSensitive(isStringsCaseSensitive()); + + + ISystemFilter[] filters = getSystemFilters(); + if ((filters!=null) && (filters.length>0)) + { + for (int idx=0; idx + *
  • supportsNestedFilters + *
  • supportsDuplicateFilterStrings + *
  • stringsCaseSensitive + * + * @param aliasName The name to give the new filter. Must be unique for this pool. + * @param filterStrings The list of String objects that represent the filter strings. + */ + public ISystemFilter createSystemFilter(String aliasName, Vector filterStrings) + { + ISystemFilter newFilter = helpers.createSystemFilter(internalGetFilters(), this, aliasName, filterStrings); + newFilter.setSupportsNestedFilters(supportsNestedFilters()); + newFilter.setStringsCaseSensitive(areStringsCaseSensitive()); + newFilter.setSupportsDuplicateFilterStrings(supportsDuplicateFilterStrings()); + setDirty(true); + return newFilter; + } + + /** + * Return Vector of String objects: the names of existing filters in this container. + * Needed by name validators for New and Rename actions to verify new name is unique. + */ + public Vector getSystemFilterNames() + { + return helpers.getSystemFilterNames(internalGetFilters()); + } + + /** + * Return the nested filters as a Vector + */ + public Vector getSystemFiltersVector() + { + return helpers.getSystemFiltersVector(internalGetFilters()); + } + /** + * Return how many filters are defined in this filter container + */ + public int getSystemFilterCount() + { + return helpers.getSystemFilterCount(internalGetFilters()); + } + /** + * Return a filter object, given its aliasname. + * Can be used to test if an aliasname is already used (non-null return). + * @param aliasName unique aliasName (case insensitive) to search on. + * @return SystemFilter object with unique aliasName, or null if + * no filter object with this name exists. + */ + public ISystemFilter getSystemFilter(String aliasName) + { + return helpers.getSystemFilter(internalGetFilters(), aliasName); + } + /** + * Adds given filter to the list. + *

    PLEASE NOTE: + *

      + *
    • createSystemFilter calls this method for you! + *
    • this is a no-op if a filter with the same aliasname already exists + *
    + * @param filter SystemFilter object to add + * @return true if added, false if filter with this aliasname already existed. + */ + public boolean addSystemFilter(ISystemFilter filter) + { + return helpers.addSystemFilter(internalGetFilters(),filter); + } + /** + * Removes a given filter from the list. + * @param filter SystemFilter object to remove + */ + public void deleteSystemFilter(ISystemFilter filter) + { + helpers.deleteSystemFilter(internalGetFilters(),filter); + } + + /** + * Rename a given filter in the list. + * @param filter SystemFilter object to remove + */ + public void renameSystemFilter(ISystemFilter filter, String newName) + { + helpers.renameSystemFilter(internalGetFilters(),filter, newName); + } + + /** + * Updates a given filter in the list. + * @param filter SystemFilter object to update + * @param newName New name to assign it. Assumes unique checking already done. + * @param newStrings New strings to assign it. Replaces current strings. + */ + public void updateSystemFilter(ISystemFilter filter, String newName, String[] newStrings) + { + helpers.updateSystemFilter(internalGetFilters(), filter, newName, newStrings); + } + + /** + * Duplicates a given filter in the list. + * @param filter SystemFilter object to clone + * @param alias New, unique, alias name to give this filter. Clone will fail if this is not unique. + */ + public ISystemFilter cloneSystemFilter(ISystemFilter filter, String aliasName) + { + return helpers.cloneSystemFilter(internalGetFilters(), filter, aliasName); + } + + /** + * Return a given filter's zero-based location + */ + public int getSystemFilterPosition(ISystemFilter filter) + { + return helpers.getSystemFilterPosition(internalGetFilters(),filter); + } + + /** + * Move a given filter to a given zero-based location + */ + public void moveSystemFilter(int pos, ISystemFilter filter) + { + helpers.moveSystemFilter(internalGetFilters(),pos,filter); + } + + /** + * 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); + } + + /** + * Private helper method to deduce filter names from disk files. + * Will populate and return a list. + * Only makes sense to use if the save policy is one file per filter. + */ + protected static Vector deduceFilterNames(IFolder folder, ISystemFilterNamingPolicy namingPolicy) + { + Vector filterNames = SystemResourceHelpers.getResourceHelpers().convertToVectorAndStrip( + SystemResourceHelpers.getResourceHelpers().listFiles(folder, + namingPolicy.getFilterSaveFileNamePrefix(), + SAVEFILE_SUFFIX), + namingPolicy.getFilterSaveFileNamePrefix(), SAVEFILE_SUFFIX); + return filterNames; + } + + + + /** + * Order filters according to user preferences. + *

    + * While the framework has all the code necessary to arrange filters and save/restore + * that arrangement, you may choose to use preferences instead of this support. + * In this case, call this method and pass in the saved and sorted filter name list. + *

    + * Called by someone after restore. + */ + public void orderSystemFilters(String[] names) + { + java.util.List filterList = internalGetFilters(); + ISystemFilter[] filters = new ISystemFilter[names.length]; + for (int idx=0; idx + *

  • SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL - one file and folder per pool + *
  • SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER - one file per pool, all files in one folder + *
  • SAVE_POLICY_ONE_FILE_PER_FILTER - one file per filter, one folder per pool + * + * @param namingPolicy The names to use for file and folders when persisting to disk. Pass + * null to just use the defaults. + * @return SystemFilterPool object if restored ok, null if error encountered. If null, call getLastException(). + * @see org.eclipse.rse.filters.ISystemFilterConstants + */ + protected static ISystemFilterPool restore(String name, int savePolicy, + ISystemFilterNamingPolicy namingPolicy) + throws Exception + { + if (namingPolicy == null) + namingPolicy = SystemFilterNamingPolicy.getNamingPolicy(); + + // FIXME SystemFilterImpl.initMOF(); // to be safe + + ISystemFilterPool pool = null; + SystemFilterPool poolImpl = null; + /* FIXME + switch(savePolicy) + { + case SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL: + pool = restoreFromOneFile(mofHelpers, folder, name, namingPolicy, true); + poolImpl = (SystemFilterPoolImpl)pool; + break; + + case SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER: + pool = restoreFromOneFile(mofHelpers, folder, name, namingPolicy, true); + poolImpl = (SystemFilterPoolImpl)pool; + break; + + case SAVE_POLICY_ONE_FILE_PER_FILTER: + pool = restoreFromOneFile(mofHelpers, folder, name, namingPolicy, false); // restore data part + poolImpl = (SystemFilterPoolImpl)pool; + //pool = createPool(); + + poolImpl.setFolder(folder); // SystemFilter's restore will query it + pool.setNamingPolicy(namingPolicy); // SystemFilter's restore will query it + Vector filterNames = deduceFilterNames(folder, namingPolicy); + if (filterNames != null) + { + Exception lastException = null; + for (int idx=0; idx + * As required by the {@link org.eclipse.rse.references.ISystemBasePersistableReferencedObject ISystemPersistableReferencedObject} + * interface. + */ + public String getReferenceName() + { + return getSystemFilterPoolManager().getName()+DELIMITER+getName(); + } + + // ----------------------- + // HOUSEKEEPING METHODS... + // ----------------------- + /* */ + public String toString() + { + return getName(); + } + /** + * @generated This field/method will be replaced during code generation. + */ + public void setType(String newType) + { + type = newType; + } + + /** + * @generated This field/method will be replaced during code generation + */ + public boolean isSupportsNestedFilters() + { + return supportsNestedFilters; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void unsetStringsCaseSensitive() + { + stringsCaseSensitive = STRINGS_CASE_SENSITIVE_EDEFAULT; + stringsCaseSensitiveESet = false; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public boolean isSetStringsCaseSensitive() + { + return stringsCaseSensitiveESet; + } + + /** + * @generated This field/method will be replaced during code generation + */ + public java.util.List getFilters() + { + if (filters == null) + { + filters = new ArrayList(); + //FIXME new EObjectContainmenteList(SystemFilter.class, this, FiltersPackage.SYSTEM_FILTER_POOL__FILTERS); + } + return filters; + } + + /** + * @generated This field/method will be replaced during code generation + */ + public boolean isSupportsDuplicateFilterStrings() + { + return supportsDuplicateFilterStrings; + } + + /** + * @generated This field/method will be replaced during code generation + * In what release was this created? Typically, will be the version and release + * times 10, as in 40 or 51. + */ + public int getRelease() + { + return release; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setRelease(int newRelease) + { + release = newRelease; + } + + /** + * Returns true if this filter is limited to a single filter string. If not set here, + * it is queried from the parent manager. + */ + public boolean isSingleFilterStringOnly() + { + if (isSetSingleFilterStringOnly()) + return singleFilterStringOnly; + else + return getSystemFilterPoolManager().isSingleFilterStringOnly(); + } + /** + * + * + * @generated + */ + public boolean isSingleFilterStringOnlyGen() + { + return singleFilterStringOnly; + } + + /** + * + * + * @generated + */ + public void setSingleFilterStringOnly(boolean newSingleFilterStringOnly) + { + singleFilterStringOnly = newSingleFilterStringOnly; + singleFilterStringOnlyESet = true; + } + + /** + * + * + * @generated + */ + public void unsetSingleFilterStringOnly() + { + singleFilterStringOnly = SINGLE_FILTER_STRING_ONLY_EDEFAULT; + singleFilterStringOnlyESet = false; + } + + /** + * + * + * @generated + */ + public boolean isSetSingleFilterStringOnly() + { + return singleFilterStringOnlyESet; + } + + /** + * + * + * @generated + */ + public String getOwningParentName() + { + return owningParentName; + } + + /** + * + * + * @generated + */ + public void setOwningParentName(String newOwningParentName) + { + if (newOwningParentName != owningParentName) + { + owningParentName = newOwningParentName; + setDirty(true); + } + } + + /** + * + * + * @generated + */ + public boolean isNonRenamable() + { + return nonRenamable; + } + + /** + * + * + * @generated + */ + public void setNonRenamable(boolean newNonRenamable) + { + boolean oldNonRenamable = nonRenamable; + if (oldNonRenamable!= newNonRenamable) + { + nonRenamable = newNonRenamable; + setDirty(true); + } + } + + public boolean isDirty() + { + return _isDirty; + } + + public void setDirty(boolean flag) + { + if (_isDirty != flag) + { + _isDirty= flag; + } + } + + public boolean commit() + { + return SystemPlugin.getThePersistenceManager().commit(this); + } + + public boolean wasRestored() + { + return _wasRestored; + } + + public void setWasRestored(boolean flag) + { + _wasRestored = flag; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterPoolManager.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterPoolManager.java new file mode 100644 index 00000000000..66ed061fa31 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterPoolManager.java @@ -0,0 +1,1949 @@ +/******************************************************************************** + * 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.internal.filters; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Vector; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterConstants; +import org.eclipse.rse.filters.ISystemFilterContainer; +import org.eclipse.rse.filters.ISystemFilterNamingPolicy; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; +import org.eclipse.rse.filters.ISystemFilterString; +import org.eclipse.rse.logging.Logger; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.persistence.IRSEPersistenceManager; +import org.eclipse.rse.references.ISystemBaseReferencingObject; + +// +// + +/** + * A filter pool manager manages filter pools. + *

    + * Each filter pool that is managed becomes a folder on disk. + *

    + * To create a filter pool manager instance, use the factory method + * in SystemFilterPoolManagerImpl in the ...impl package. + * You must pass a folder that represents the anchor point for the + * pools managed by this manager instance. + *

    + * Depending on your tools' needs, you have four choices about how + * the filter pools and filters are persisted to disk. The decision is + * made at the time you instantiate the pool manager and is one of the + * following constants from the SystemFilterConstants interface: + *

      + *
    • SAVE_POLICY_ONE_FILE_PER_MANAGER - one file: mgrName.xmi + *
    • SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL - one file and folder per pool + *
    • SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER - one file per pool, all files in one folder + *
    • SAVE_POLICY_ONE_FILE_PER_FILTER - one file per filter, one folder per pool + *
    + *

    + * With the policy of one file per pool, there are two possibilities regarding + * the folder structure: + *

      + *
    • Each pool gets its own subfolder, and the pool's xmi file goes in + * the pool's unique subfolder: SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL + *
    • There are no subfolders per pool, all the xmi pool files go in the + * same folder as specified when creating this manager instance: + * SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER + *
    + *

    + * With the policy of one file per filter, each filter pool must have its own folder. + *

    + * With an instantiated filter pool manager (most tools will only need + * one such instance), you now simply call its methods to work with + * filter pools. For example, use it to: + *

      + *
    • Restore all filter pools from disk + *
    • Save all, or individual, filter pools to disk + *
    • Get a list of existing filter pools + *
    • Create filter pools + *
    • Delete filter pools + *
    • Clone filter pools + *
    • Rename filter pools + *
    • Save all, or individual, filter pools + *
    + * All the underlying file system work is handled for you. + *

    + * Further, this is the front door for working with filters too. By forcing all + * filter related activity through a single point like this, we can ensure that + * all changes are saved to disk, and events are fired properly. + *

    + * The filter framework logs to a {@link com.ibm.etools.systems.logging.Logger Logger} file. + * By default the log in the org.eclipse.rse.core plugin is used, but you can change this + * by calling {@link #setLogger(com.ibm.etools.systems.logging.Logger)}. + */ +/** + * @lastgen class SystemFilterPoolManagerImpl Impl implements SystemFilterPoolManager {} + */ +public class SystemFilterPoolManager implements ISystemFilterPoolManager +{ + private ISystemFilterPool[] poolArray = null; // cache for performance + private ISystemFilterPoolManagerProvider caller = null; + private Object poolMgrData; + private Vector poolNames; + private boolean initialized = false; + + private boolean suspendCallbacks = false; + private boolean suspendSave = false; + private Logger logger = null; + private ISystemProfile _profile; + + // persistance + protected boolean _isDirty = true; + private boolean _wasRestored = false; + + public static boolean debug = true; + + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + + protected String name = NAME_EDEFAULT; + /** + * The default value of the '{@link #isSupportsNestedFilters() Supports Nested Filters}' attribute. + * + * + * @see #isSupportsNestedFilters() + * @generated + * @ordered + */ + protected static final boolean SUPPORTS_NESTED_FILTERS_EDEFAULT = false; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected boolean supportsNestedFilters = SUPPORTS_NESTED_FILTERS_EDEFAULT; + /** + * The default value of the '{@link #isStringsCaseSensitive() Strings Case Sensitive}' attribute. + * + * + * @see #isStringsCaseSensitive() + * @generated + * @ordered + */ + protected static final boolean STRINGS_CASE_SENSITIVE_EDEFAULT = false; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected boolean stringsCaseSensitive = STRINGS_CASE_SENSITIVE_EDEFAULT; + /** + * The default value of the '{@link #isSupportsDuplicateFilterStrings() Supports Duplicate Filter Strings}' attribute. + * + * + * @see #isSupportsDuplicateFilterStrings() + * @generated + * @ordered + */ + protected static final boolean SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT = false; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected boolean supportsDuplicateFilterStrings = SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT; + /** + * This is true if the Supports Duplicate Filter Strings attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean supportsDuplicateFilterStringsESet = false; + + /** + * The default value of the '{@link #isSingleFilterStringOnly() Single Filter String Only}' attribute. + * + * + * @see #isSingleFilterStringOnly() + * @generated + * @ordered + */ + protected static final boolean SINGLE_FILTER_STRING_ONLY_EDEFAULT = false; + + /** + * The cached value of the '{@link #isSingleFilterStringOnly() Single Filter String Only}' attribute. + * + * + * @see #isSingleFilterStringOnly() + * @generated + * @ordered + */ + protected boolean singleFilterStringOnly = SINGLE_FILTER_STRING_ONLY_EDEFAULT; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected java.util.List pools = null; + + + /** + * Constructor + */ + protected SystemFilterPoolManager(ISystemProfile profile) + { + super(); + _profile = profile; + } + + public ISystemProfile getSystemProfile() + { + return _profile; + } + + /** + * Factory to create a filter pool manager. + * @param logger A logging object into which to log errors as they happen in the framework + * @param caller Objects which instantiate this class should implement the + * SystemFilterPoolManagerProvider interface, and pass "this" for this parameter. + * Given any filter framework object, it is possible to retrieve the caller's + * object via the getProvider method call. + * @param mgrFolder the folder that will be the manager folder. This is + * the parent of the filter pool folders the manager folder will hold, or the single + * xmi file for the save policy of one file per manager. This folder will be created + * if it does not already exist. + * @param name the name of the filter pool manager. Typically this is also the name + * of the given folder, but this is not required. For the save policy of one file + * per manager, the name of the file is derived from this. For other save policies, + * the name is not used. + * @param allowNestedFilters true if filters inside filter pools in this manager are + * to allow nested filters. This is the default, but can be overridden at the + * individual filter pool level. + * @param savePolicy The save policy for the filter pools and filters. One of the + * following constants from the + * {@link org.eclipse.rse.filters.ISystemFilterConstants SystemFilterConstants} interface: + *

      + *
    • SAVE_POLICY_NONE - no files, all save/restore handled elsewhere + *
    • SAVE_POLICY_ONE_FILE_PER_MANAGER - one file: mgrName.xmi + *
    • SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL - one file and folder per pool + *
    • SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER - one file per pool, all files in one folder + *
    • SAVE_POLICY_ONE_FILE_PER_FILTER - one file per filter, one folder per pool + *
    + * @param namingPolicy The names to use for file and folders when persisting to disk. Pass + * null to just use the defaults, or if using SAVE_POLICY_NONE. + */ + public static ISystemFilterPoolManager + createSystemFilterPoolManager(ISystemProfile profile, Logger logger, + ISystemFilterPoolManagerProvider caller, + String name, + boolean allowNestedFilters, + int savePolicy, ISystemFilterNamingPolicy namingPolicy) + { + + SystemFilterPoolManager mgr = null; + if (namingPolicy == null) + namingPolicy = SystemFilterNamingPolicy.getNamingPolicy(); + try + { + mgr = (SystemFilterPoolManager)SystemPlugin.getThePersistenceManager().restoreFilterPoolManager(profile, logger, caller, name); + /* + if (savePolicy != SystemFilterConstants.SAVE_POLICY_NONE) + mgr = (SystemFilterPoolManagerImpl)restore(; + */ + } + catch (Exception exc) // real error trying to restore, versus simply not found. + { + // todo: something. Log the exception somewhere? + } + if (mgr == null) // not found or some serious error. + { + mgr = createManager(profile); + } + if (mgr != null) + { + mgr.initialize(logger, caller, name, allowNestedFilters); + } + return mgr; + } + + /* + * Private helper method. + * Uses MOF to create an instance of this class. + */ + public static SystemFilterPoolManager createManager(ISystemProfile profile) + { + ISystemFilterPoolManager mgr = new SystemFilterPoolManager(profile); + + //FIXME SystemFilterImpl.initMOF().createSystemFilterPoolManager(); + return (SystemFilterPoolManager)mgr; + } + + /* + * Private helper method to initialize state + */ + public void initialize(Logger logger, ISystemFilterPoolManagerProvider caller, String name, + boolean allowNestedFilters) + { + if (!initialized) + initialize(logger, caller, name); // core data + + { + java.util.List pools = getPools(); + ISystemFilterPool pool = null; + Vector poolNames = getSystemFilterPoolNamesVector(); + for (int idx=0; idx + * + * @generated + */ + public void setSupportsDuplicateFilterStringsGen(boolean newSupportsDuplicateFilterStrings) + { + supportsDuplicateFilterStrings = newSupportsDuplicateFilterStrings; + supportsDuplicateFilterStringsESet = true; + } + + /** + * + * + * @generated + */ + public boolean isStringsCaseSensitive() + { + return stringsCaseSensitive; + } + + /** + * Same as isStringsCaseSensitive() + * Are filter strings in this filter case sensitive? + * @return The value of the StringsCaseSensitive attribute + */ + public boolean areStringsCaseSensitive() + { + return isStringsCaseSensitive(); + } + /** + * Set attribute indicating if filters managed by this manager support case-sensitive filter strings, by default. + * Cascaded down to all pools, and all filters in all pools. + * Alternatively, just call it on the particular pool or filter it applies to. + */ + public void setStringsCaseSensitive(boolean newStringsCaseSensitive) + { + // as generated by emf... + setStringsCaseSensitiveGen(newStringsCaseSensitive); + // our special code... + ISystemFilterPool[] pools = getSystemFilterPools(); + for (int idx=0; idx + * + * @generated + */ + public void setStringsCaseSensitiveGen(boolean newStringsCaseSensitive) + { + stringsCaseSensitive = newStringsCaseSensitive; + } + + /** + * Set transient variable pointing back to us. Called after restoring. + * Cascaded down to all pools, and all filters in all pools. + */ + protected void setFilterPoolManager() + { + ISystemFilterPool[] pools = getSystemFilterPools(); + for (int idx=0; idx + * Does the following: + *
      + *
    • Removes all references + *
    • Removes pool object from in-memory model + *
    • Removes folder from disk for policies of one folder per pool + *
    • Removes file from disk for policy of one file per pool + *
    • Saves model to disk for policy of one file per manager + *
    • Invalidates in-memory caches + *
    • Calls back to inform caller of this event + *
    + * @param pool The filter pool object to physically delete + */ + public void deleteSystemFilterPool(ISystemFilterPool pool) + throws Exception + { + + + + // remove all references + ISystemBaseReferencingObject[] refs = pool.getReferencingObjects(); + //boolean needsSave = false; + if (refs != null) + { + for (int idx=0; idx < refs.length; idx++) + { + if (refs[idx] instanceof ISystemFilterPoolReference) + { + ISystemFilterPoolReference fpRef = (ISystemFilterPoolReference)refs[idx]; + ISystemFilterPoolReferenceManager fprMgr = fpRef.getFilterPoolReferenceManager(); + if (fprMgr != null) + fprMgr.removeSystemFilterPoolReference(fpRef,false);// false means don't dereference + } + } + } + String poolName = pool.getName(); + + // remove from model + java.util.List pools = getPools(); + pools.remove(pool); + + /* FIXME + // now in EMF, the pools are "owned" by the Resource, and only referenced by this pool manager, + // so I don't think just removing it from the manager is enough... it must also be removed from its + // resource. Phil. + Resource res = pool.eResource(); + if (res != null) + res.getContents().remove(pool); + + // remove from disk + if ( (savePolicy == SystemFilterConstants.SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL) || + (savePolicy == SystemFilterConstants.SAVE_POLICY_ONE_FILE_PER_FILTER) ) + { + String expectedFolderName = derivePoolFolderName(poolName); + if (expectedFolderName.equals(poolFolder.getName())) + { + // folder name equals what we would have named it if left to us. + // assumption is this folder only exists to hold this pool! + if (poolFolder.exists()) + getResourceHelpers().deleteResource(poolFolder); + } + } + else if (savePolicy == SystemFilterConstants.SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER) + { + String poolFileName = SystemFilterPoolImpl.getSaveFileName(getMOFHelpers(),pool); + IFile poolFile = SystemResourceHelpers.getResourceHelpers().getFile(poolFolder,poolFileName); + if (poolFile.exists()) + getResourceHelpers().deleteResource(poolFile); + } + else // all pools in one file per manager. Just save it + { + commit(); + } + invalidatePoolCache(); + // if caller provider, callback to inform them of this event + if ((caller != null) && !suspendCallbacks) + caller.filterEventFilterPoolDeleted(pool); + */ + } + + /** + * Delete all existing filter pools. Call this when you are about to delete this manager, say. + */ + public void deleteAllSystemFilterPools() + { + ISystemFilterPool[] allPools = getSystemFilterPools(); + for (int idx=0; idx + * Does the following: + *
      + *
    • Updates all referencing objects + *
    • Renames pool object in the in-memory model + *
    • Renames folder on disk for policies of one folder per pool + *
    • Renames file on disk for policy of one file per pool + *
    • Saves model to disk for policy of one file per manager + *
    • Invalidates in-memory caches + *
    • Calls back to provider to inform of this event. + *
    + * @param pool The filter pool object to physically rename + * @param newName The new name to give the pool + */ + public void renameSystemFilterPool(ISystemFilterPool pool, String newName) + throws Exception + { + String oldName = pool.getName(); + int oldLen = oldName.length(); + int newLen = newName.length(); + // rename on disk + /* FIXME + if ( (savePolicy == SystemFilterConstants.SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL) || + (savePolicy == SystemFilterConstants.SAVE_POLICY_ONE_FILE_PER_FILTER) ) + { + String expectedFolderName = derivePoolFolderName(pool.getName()); + boolean ourFolderName = expectedFolderName.equals(pool.getFolder().getName()); + // we must rename the old file... + String poolFileName = SystemFilterPoolImpl.getSaveFileName(getMOFHelpers(),pool); + String poolFileNewName = SystemFilterPoolImpl.getSaveFileName(getMOFHelpers(),pool,newName); + IFile poolFile = getResourceHelpers().getFile(pool.getFolder(),poolFileName); + IFolder poolFolder = pool.getFolder(); + + // first, pre-test for file-in-use error: + boolean inUse = poolFile.exists() && SystemResourceHelpers.testIfResourceInUse(poolFile); + if (inUse) + { + SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_FILE_INUSE); + msg.makeSubstitution(poolFile.getFullPath()); + throw new SystemMessageException(msg); + } + // next, pre-test for folder-in-use error: + if (ourFolderName) + { + inUse = poolFolder.exists() && SystemResourceHelpers.testIfResourceInUse(poolFolder); + if (inUse) + { + SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_FOLDER_INUSE); + msg.makeSubstitution(poolFolder.getFullPath()); + throw new SystemMessageException(msg); + } + } + + if (poolFile.exists()) + { + // pre-test if the new name will be too long for MOF (256) + if (nameLenDiff > 0) + { + if (ourFolderName) + nameLenDiff *= 2; // new name affects folder and file + int newNameLen = poolFile.getLocation().toOSString().length() + nameLenDiff; + if (newNameLen > 256) + throw new Exception("Fully qualified filter pool name too long for "+newName+". Exceeds 256 characters"); + } + getResourceHelpers().renameResource(poolFile, poolFileNewName); + } + if (ourFolderName) + { + // folder name equals what we would have named it if left to us. + // assumption is this folder only exists to hold this pool! + if (poolFolder.exists()) + { + String newFolderName = derivePoolFolderName(newName); + getResourceHelpers().renameResource(poolFolder, newFolderName); + // as we now know, the original IFolder still points to the old name! + poolFolder = getResourceHelpers().getRenamedFolder(poolFolder, newFolderName); + pool.setFolder(poolFolder); + } + } + } + else if (savePolicy == SystemFilterConstants.SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER) + { + String poolFileName = SystemFilterPoolImpl.getSaveFileName(getMOFHelpers(),pool); + IFile poolFile = getResourceHelpers().getFile(pool.getFolder(),poolFileName); + // first, pre-test for file-in-use error: + boolean inUse = poolFile.exists() && SystemResourceHelpers.testIfResourceInUse(poolFile); + if (inUse) + { + SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_FILE_INUSE); + msg.makeSubstitution(poolFile.getFullPath()); + throw new SystemMessageException(msg); + } + if (poolFile.exists()) + { + String poolFileNewName = SystemFilterPoolImpl.getSaveFileName(getMOFHelpers(),pool,newName); + getResourceHelpers().renameResource(poolFile, poolFileNewName); + } + } + */ + pool.setName(newName); + invalidatePoolCache(); + + // inform all referencees + ISystemBaseReferencingObject[] refs = pool.getReferencingObjects(); + if (refs != null) + { + for (int idx=0; idx < refs.length; idx++) + { + ISystemBaseReferencingObject ref = refs[idx]; + if (ref instanceof ISystemFilterPoolReference) + { + ISystemFilterPoolReference fpRef = (ISystemFilterPoolReference)ref; + ISystemFilterPoolReferenceManager fprMgr = fpRef.getFilterPoolReferenceManager(); + fprMgr.renameReferenceToSystemFilterPool(pool); + } + } + } + + // if caller provider, callback to inform them of this event + if ((caller != null) && !suspendCallbacks) + caller.filterEventFilterPoolRenamed(pool,oldName); + } + + /** + * Copy the specified filter pool from this manager to this manager or another manager. + *

    + * Does the following: + *

      + *
    • Clones all filters within the pool + *
    • Clones all filter strings within each filter + *
    • Asks target manager to save to disk + *
    • Calls back to target manager provider, unless callbacks are suspended + *
    + * @param targetMgr The target manager to copy our filter pool to. Can be this manager, but target pool name must be unique. + * @param oldPool The filter pool to copy + * @param newName The new name to give the copied pool + * @return the new copy + */ + public ISystemFilterPool copySystemFilterPool(ISystemFilterPoolManager targetMgr, ISystemFilterPool oldPool, String newName) + throws Exception + { + ISystemFilterPool newPool = targetMgr.createSystemFilterPool(newName, oldPool.isDeletable()); + //System.out.println("In SystemFilterPoolManagerImpl#copySystemFilterPool: newPool "+newName+" null? " + (newPool == null)); + oldPool.cloneSystemFilterPool(newPool); + commit(newPool); // save it all to disk + return newPool; + } + + /** + * Move the specified filter pool from this manager to another manager. + *

    + * Does the following: + *

      + *
    • Performs a {@link #copySystemFilterPool(ISystemFilterPoolManager, ISystemFilterPool, String) copySystemFilterPool} operation. + *
    • If copy is successful, updates all references to reference the new copy. + *
    • If copy is successful, deletes original filter pool in this manager + *
    • If this final delete fails, deletes the copied version and restore original references + *
    • Asks target manager to save to disk + *
    • Saves this manager to disk + *
    • Calls back to both targer manager provider and this manager provider, unless callbacks are suspended + *
    + * @param targetMgr The target manager to move our filter pool to. Cannot be this manager. + * @param oldPool The filter pool to move + * @param newName The new name to give the moved pool + * @return the new copy of the moved system filter pool + */ + public ISystemFilterPool moveSystemFilterPool(ISystemFilterPoolManager targetMgr, ISystemFilterPool oldPool, String newName) + throws Exception + { + ISystemFilterPool newPool = copySystemFilterPool(targetMgr, oldPool, newName); + // find all references to original, and reset them to reference the new... + ISystemBaseReferencingObject[] refs = oldPool.getReferencingObjects(); + if (refs != null) + { + for (int idx=0; idx < refs.length; idx++) + { + if (refs[idx] instanceof ISystemFilterPoolReference) + { + ISystemFilterPoolReference fpRef = (ISystemFilterPoolReference)refs[idx]; + //SystemFilterPool fp = fpRef.getReferencedFilterPool(); + ISystemFilterPoolReferenceManager fprMgr = fpRef.getFilterPoolReferenceManager(); + fprMgr.resetSystemFilterPoolReference(fpRef, newPool); // reset the referenced pool + } + } + } + try + { + deleteSystemFilterPool(oldPool); + } + catch (Exception exc) + { + if (refs != null) + { + for (int idx=0; idx < refs.length; idx++) + { + if (refs[idx] instanceof ISystemFilterPoolReference) + { + ISystemFilterPoolReference fpRef = (ISystemFilterPoolReference)refs[idx]; + ISystemFilterPoolReferenceManager fprMgr = fpRef.getFilterPoolReferenceManager(); + fprMgr.resetSystemFilterPoolReference(fpRef, oldPool); // reset the referenced pool + } + } + } + targetMgr.deleteSystemFilterPool(newPool); + throw exc; + } + return newPool; + } + + /** + * Copy all filter pools from this manager to another manager. + *

    + * Does the following: + *

      + *
    • Clones all filter pools + *
    • Clones all filters within each pool + *
    • Clones all filter strings within each filter + *
    • Asks target manager to save to disk + *
    • Does not callback to caller to fire events, assumes caller doesn't want to know + *
    + * @param targetMgr The target manager to copy our filter pools to + */ + public void copySystemFilterPools(ISystemFilterPoolManager targetMgr) + throws Exception + { + targetMgr.setStringsCaseSensitive(areStringsCaseSensitive()); + ISystemFilterPool[] pools = getSystemFilterPools(); + if ((pools!=null) && (pools.length>0)) + { + targetMgr.suspendCallbacks(true); + //boolean oldSuspendCallbacks = suspendCallbacks; + for (int idx=0;idxCalls back to inform provider of this event (filterEventFilterCreated) + * @param parent The parent which is either a SystemFilterPool or a SystemFilter + * @param aliasName The name to give the new filter. Must be unique for this pool. + * @param filterStrings The list of String objects that represent the filter strings. + */ + public ISystemFilter createSystemFilter(ISystemFilterContainer parent, + String aliasName, Vector filterStrings) + throws Exception + { + ISystemFilter newFilter = null; + ISystemFilterPool parentPool = null; + if (parent instanceof ISystemFilterPool) + parentPool = (ISystemFilterPool)parent; + else + parentPool = ((ISystemFilter)parent).getParentFilterPool(); + newFilter = parent.createSystemFilter(aliasName,filterStrings); + if (!suspendSave) + commit(parentPool); + // if caller provider, callback to inform them of this event + if ((caller != null) && !suspendCallbacks) + caller.filterEventFilterCreated(newFilter); + return newFilter; + } + /** + * Creates a new system filter that is typed. + * Same as {@link #createSystemFilter(ISystemFilterContainer, String, Vector)} but + * takes a filter type as an additional parameter. + *

    + * A filter's type is an arbitrary string that is not interpreted or used by the base framework. This + * is for use entirely by tools who wish to support multiple types of filters and be able to launch unique + * actions per type, say. + * + * @param parent The parent which is either a SystemFilterPool or a SystemFilter + * @param aliasName The name to give the new filter. Must be unique for this pool. + * @param filterStrings The list of String objects that represent the filter strings. + * @param type The type of this filter + */ + public ISystemFilter createSystemFilter(ISystemFilterContainer parent, + String aliasName, Vector filterStrings, String type) + throws Exception + { + boolean oldSuspendSave = suspendSave; + boolean oldSuspendCallbacks = suspendCallbacks; + suspendSave = true; + suspendCallbacks = true; + + ISystemFilter newFilter = createSystemFilter(parent, aliasName, filterStrings); + newFilter.setType(type); + + suspendSave = oldSuspendSave; + suspendCallbacks = oldSuspendCallbacks; + + if (!suspendSave) + { + ISystemFilterPool parentPool = null; + if (parent instanceof ISystemFilterPool) + parentPool = (ISystemFilterPool)parent; + else + parentPool = ((ISystemFilter)parent).getParentFilterPool(); + commit(parentPool); + } + // if caller provider, callback to inform them of this event + if ((caller != null) && !suspendCallbacks) + caller.filterEventFilterCreated(newFilter); + return newFilter; + } + /** + * Creates a new system filter that is typed and promptable + * Same as {@link #createSystemFilter(ISystemFilterContainer, String ,Vector, String)} but + * takes a boolean indicating if it is promptable. + *

    + * A promptable filter is one in which the user is prompted for information at expand time. + * There is no base filter framework support for this, but tools can query this attribute and + * do their own thing at expand time. + * + * @param parent The parent which is either a SystemFilterPool or a SystemFilter + * @param aliasName The name to give the new filter. Must be unique for this pool. + * @param filterStrings The list of String objects that represent the filter strings. + * @param type The type of this filter + * @param promptable Pass true if this is a promptable filter + */ + public ISystemFilter createSystemFilter(ISystemFilterContainer parent, + String aliasName, Vector filterStrings, String type, boolean promptable) + throws Exception + { + boolean oldSuspendSave = suspendSave; + boolean oldSuspendCallbacks = suspendCallbacks; + suspendSave = true; + suspendCallbacks = true; + + ISystemFilter newFilter = createSystemFilter(parent, aliasName, filterStrings, type); + newFilter.setPromptable(promptable); + + suspendSave = oldSuspendSave; + suspendCallbacks = oldSuspendCallbacks; + + if (!suspendSave) + { + ISystemFilterPool parentPool = null; + if (parent instanceof ISystemFilterPool) + parentPool = (ISystemFilterPool)parent; + else + parentPool = ((ISystemFilter)parent).getParentFilterPool(); + commit(parentPool); + } + // if caller provider, callback to inform them of this event + if ((caller != null) && !suspendCallbacks) + caller.filterEventFilterCreated(newFilter); + return newFilter; + } + + /** + * Delete an existing system filter. + * Does the following: + *

      + *
    • Removes filter from its parent in memory. + *
    • If appropriate for the save policy, deletes the filter's file from disk. + *
    • Save the SystemFilterPool which direct or indirectly contains the filter. + *
    • Calls back to provider to inform it of this event (filterEventFilterDeleted) + *
    + */ + public boolean deleteSystemFilter(ISystemFilter filter) + throws Exception + { + + // ok to proceed... + boolean ok = true; + ISystemFilterContainer parent = filter.getParentFilterContainer(); + parent.deleteSystemFilter(filter); + commit(filter.getParentFilterPool()); + + // if caller provider, callback to inform them of this event + if ((caller != null) && !suspendCallbacks) + caller.filterEventFilterDeleted(filter); + return ok; + } + /** + * Renames a filter. This is better than filter.setName(String newName) as it + * saves the parent pool to disk. + *

    + * Does the following: + *

      + *
    • Renames the object in the in-memory cache + *
    • If appropriate for the save policy, rename's the filter's file on disk. + *
    • Save parent filter pool's in-memory object to disk. + *
    • Calls back to provider to inform it of this event (filterEventFilterRenamed) + *
    + * Does fire an event. + */ + public void renameSystemFilter(ISystemFilter filter, String newName) + throws Exception + { + + // ok to proceed + ISystemFilterContainer parent = filter.getParentFilterContainer(); + String oldName = filter.getName(); + parent.renameSystemFilter(filter, newName); + // rename on disk + try + { + + commit(filter.getParentFilterPool()); + } + catch (Exception exc) + { + parent.renameSystemFilter(filter, oldName); // rollback name change + throw exc; + } + // if caller provider, callback to inform them of this event + if ((caller != null) && !suspendCallbacks) + caller.filterEventFilterRenamed(filter,oldName); + } + + /** + * Updates a filter. This is better than doing it directly as it saves it to disk. + *

    + * Does the following: + *

      + *
    • Updates the object in the in-memory cache + *
    • Save parent filter pool's in-memory object to disk. + *
    • Calls back to provider to inform it of this event (filterEventFilterUpdated). + *
    + */ + public void updateSystemFilter(ISystemFilter filter, String newName, String[] strings) + throws Exception + { + + // ok to proceed... + ISystemFilterContainer parent = filter.getParentFilterContainer(); + String oldName = filter.getName(); + boolean rename = !oldName.equals(newName); + if (rename) + { + renameSystemFilter(filter, newName); + } + parent.updateSystemFilter(filter, newName, strings); + ISystemFilterPool parentPool = filter.getParentFilterPool(); + commit(parentPool); + if ((caller != null) && !suspendCallbacks) + caller.filterEventFilterUpdated(filter); + } + + /** + * Sets a filter's type. This is better than calling filter.setType(String) directly as it saves the filter to disk after. + *

    + * A filter's type is an arbitrary string that is not interpreted or used by the base framework. This + * is for use entirely by tools who wish to support multiple types of filters and be able to launch unique + * actions per type, say. + * @param parent The parent which is either a SystemFilterPool or a SystemFilter + * @param type The type of this filter + */ + public void setSystemFilterType(ISystemFilter filter, String newType) + throws Exception + { + filter.setType(newType); + commit(filter.getParentFilterPool()); + } + + /** + * Copy a system filter to a pool in this or another filter manager. + */ + public ISystemFilter copySystemFilter(ISystemFilterPool targetPool, ISystemFilter oldFilter, String newName) + throws Exception + { + ISystemFilterPoolManager targetMgr = targetPool.getSystemFilterPoolManager(); + ISystemFilterPool oldPool = oldFilter.getParentFilterPool(); + + targetMgr.suspendCallbacks(true); + + ISystemFilter newFilter = oldPool.copySystemFilter(targetPool, oldFilter, newName); // creates it in memory + commit(targetPool); // save updated pool to disk + + targetMgr.suspendCallbacks(false); + + targetMgr.getProvider().filterEventFilterCreated(newFilter); + return newFilter; + } + /** + * Move a system filter to a pool in this or another filter manager. + * Does this by first copying the filter, and only if successful, deleting the old copy. + */ + public ISystemFilter moveSystemFilter(ISystemFilterPool targetPool, ISystemFilter oldFilter, String newName) + throws Exception + { + ISystemFilter newFilter = copySystemFilter(targetPool, oldFilter, newName); + if (newFilter != null) + { + deleteSystemFilter(oldFilter); + } + return newFilter; + } + + /** + * Return the zero-based position of a SystemFilter object within its container + */ + public int getSystemFilterPosition(ISystemFilter filter) + { + ISystemFilterContainer container = filter.getParentFilterContainer(); + int position = -1; + boolean match = false; + ISystemFilter[] filters = container.getSystemFilters(); + + for (int idx = 0; !match && (idx + *

    + * Does the following: + *

      + *
    • After the move, the pool containing the filter is saved to disk. + *
    • Calls back to provider to inform of this event + *
    + * @param filters Array of SystemFilters to move. + * @param newPosition new zero-based position for the filters (filterEventFiltersRePositioned) + */ + public void moveSystemFilters(ISystemFilter filters[], int delta) + throws Exception + { + ISystemFilterContainer container = filters[0].getParentFilterContainer(); + int[] oldPositions = new int[filters.length]; + for (int idx=0; idx 0) // moving down, process backwards + for (int idx=filters.length-1; idx>=0; idx--) + moveFilter(filters[idx], oldPositions[idx]+delta); + else + for (int idx=0; idx + * While the framework has all the code necessary to arrange filters and save/restore + * that arrangement, you may choose to use preferences instead of this support. + * In this case, call this method and pass in the saved and sorted filter name list. + *

    + * Called by someone after restore. + */ + public void orderSystemFilters(ISystemFilterPool pool, String[] names) throws Exception + { + pool.orderSystemFilters(names); + commit(pool); + } + + // ------------------------------- + // SYSTEM FILTER STRING METHODS... + // ------------------------------- + /** + * Append a new filter string to the given filter's list + *

    + * Does the following: + *

      + *
    • Adds the filter string to the in-memory cache + *
    • Saves parent filter pool to disk. + *
    • Calls back to provider to inform it of this event (filterEventFilterStringCreated) + *
    + */ + public ISystemFilterString addSystemFilterString(ISystemFilter filter, String newString) throws Exception + { + ISystemFilterString newFilterString = filter.addFilterString(newString); + ISystemFilterPool parentPool = filter.getParentFilterPool(); + commit(parentPool); + if ((caller != null) && !suspendCallbacks) + caller.filterEventFilterStringCreated(newFilterString); + return newFilterString; + } + /** + * Insert a new filter string to the its filters' list, at the given zero-based position + *

    + * Does the following: + *

      + *
    • Adds the filter string to the in-memory cache + *
    • Saves parent filter pool to disk. + *
    • Calls back to provider to inform it of this event (filterEventFilterStringCreated) + *
    + */ + public ISystemFilterString addSystemFilterString(ISystemFilter filter, String newString, int position) throws Exception + { + ISystemFilterString newFilterString = filter.addFilterString(newString, position); + ISystemFilterPool parentPool = filter.getParentFilterPool(); + commit(parentPool); + if ((caller != null) && !suspendCallbacks) + caller.filterEventFilterStringCreated(newFilterString); + return newFilterString; + } + /** + * Delete a filter string from the given filter's list + *

    + * Does the following: + *

      + *
    • Removes the filter string from the in-memory cache + *
    • Saves parent filter pool to disk. + *
    • Calls back to provider to inform it of this event (filterEventFilterStringDeleted) + *
    + * @return true if given string was found and hence was deleted. + */ + public boolean removeSystemFilterString(ISystemFilter filter, String oldString) throws Exception + { + ISystemFilterString oldFilterString = filter.removeFilterString(oldString); + if (oldFilterString == null) + return false; + ISystemFilterPool parentPool = filter.getParentFilterPool(); + commit(parentPool); + if ((caller != null) && !suspendCallbacks) + caller.filterEventFilterStringDeleted(oldFilterString); + return true; + } + /** + * Remove a filter string from this filter's list, given its SystemFilterString object. + *

    + * Does the following: + *

      + *
    • Removes the filter string from the in-memory cache + *
    • Saves parent filter pool to disk. + *
    • Calls back to provider to inform it of this event (filterEventFilterStringDeleted) + *
    + * @return true if the given string existed and hence was deleted. + */ + public boolean removeSystemFilterString(ISystemFilter filter, ISystemFilterString filterString) throws Exception + { + boolean ok = filter.removeFilterString(filterString); + if (!ok) + return false; + ISystemFilterPool parentPool = filter.getParentFilterPool(); + commit(parentPool); + if ((caller != null) && !suspendCallbacks) + caller.filterEventFilterStringDeleted(filterString); + return ok; + } + /** + * Remove a filter string from the given filter's list, given its zero-based position + *

    + * Does the following: + *

      + *
    • Removes the filter string from the in-memory cache + *
    • Saves parent filter pool to disk. + *
    • Calls back to provider to inform it of this event (filterEventFilterStringDeleted) + *
    + * @return true if a string existed at the given position and hence was deleted. + */ + public boolean removeSystemFilterString(ISystemFilter filter, int position) throws Exception + { + ISystemFilterString oldFilterString = filter.removeFilterString(position); + if (oldFilterString == null) + return false; + ISystemFilterPool parentPool = filter.getParentFilterPool(); + commit(parentPool); + if ((caller != null) && !suspendCallbacks) + caller.filterEventFilterStringDeleted(oldFilterString); + return true; + } + /** + * Update a filter string's string vale + *

    + * Does the following: + *

      + *
    • Update the filter string in the in-memory cache + *
    • Saves parent filter pool to disk. + *
    • Calls back to provider to inform it of this event (filterEventFilterStringUpdated) + *
    + */ + public void updateSystemFilterString(ISystemFilterString filterString, String newValue) throws Exception + { + if (newValue.equals(filterString.getString())) + return; + ISystemFilter filter = filterString.getParentSystemFilter(); + filter.updateFilterString(filterString, newValue); + ISystemFilterPool parentPool = filter.getParentFilterPool(); + commit(parentPool); + if ((caller != null) && !suspendCallbacks) + caller.filterEventFilterStringUpdated(filterString); + } + /** + * Return the zero-based position of a SystemFilterString object within its filter + */ + public int getSystemFilterStringPosition(ISystemFilterString filterString) + { + ISystemFilter filter = filterString.getParentSystemFilter(); + int position = -1; + boolean match = false; + ISystemFilterString[] filterStrings = filter.getSystemFilterStrings(); + + String matchString = filterString.getString(); + for (int idx = 0; !match && (idx + *

    + * Does the following: + *

      + *
    • After the move, the filter pool containing the filter containing the filter strings is saved to disk. + *
    • Calls back to provider to inform of the event (filterEventFilterStringsRePositioned) + *
    + * @param filterStrings Array of SystemFilterStrings to move. + * @param newPosition new zero-based position for the filter strings + */ + public void moveSystemFilterStrings(ISystemFilterString filterStrings[], int delta) + throws Exception + { + ISystemFilter filter = filterStrings[0].getParentSystemFilter(); + int[] oldPositions = new int[filterStrings.length]; + for (int idx=0; idx 0) // moving down, process backwards + for (int idx=filterStrings.length-1; idx>=0; idx--) + moveFilterString(filter, filterStrings[idx], oldPositions[idx]+delta); + else + for (int idx=0; idx + * + * @generated + */ + public boolean isSingleFilterStringOnly() + { + return singleFilterStringOnly; + } + + /** + * + * + * @generated + */ + public void setSingleFilterStringOnly(boolean newSingleFilterStringOnly) + { + boolean oldSingleFilterStringOnly = singleFilterStringOnly; + if (oldSingleFilterStringOnly != newSingleFilterStringOnly) + { + singleFilterStringOnly = newSingleFilterStringOnly; + setDirty(true); + } + } + + public boolean isDirty() + { + return _isDirty; + } + + public void setDirty(boolean flag) + { + if (_isDirty != flag) + { + _isDirty = flag; + } + } + + public boolean wasRestored() + { + return _wasRestored; + } + + public void setWasRestored(boolean flag) + { + _wasRestored = flag; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterPoolReference.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterPoolReference.java new file mode 100644 index 00000000000..2d315feef2a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterPoolReference.java @@ -0,0 +1,235 @@ +/******************************************************************************** + * 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.internal.filters; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterContainer; +import org.eclipse.rse.filters.ISystemFilterContainerReference; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.internal.references.SystemPersistableReferencingObject; +import org.eclipse.rse.references.ISystemPersistableReferencedObject; + + +/** + * A shadow object of a master filter pool + */ +/** + * @lastgen class SystemFilterPoolReferenceImpl extends SystemPersistableReferencingObjectImpl implements SystemFilterPoolReference, SystemFilterContainerReference, IAdaptable {} + */ +public class SystemFilterPoolReference extends SystemPersistableReferencingObject + implements ISystemFilterPoolReference, ISystemFilterContainerReference, IAdaptable +{ + private SystemFilterContainerReferenceCommonMethods containerHelper = null; + protected static final String DELIMITER = "___"; + protected static final int DELIMITER_LENGTH = 3; + +/** + * Default constructor. Typically called by MOF factory method. + */ + protected SystemFilterPoolReference() + { + super(); + containerHelper = new SystemFilterContainerReferenceCommonMethods(this); + } + /** + * Return the reference manager which is managing this filter reference + * framework object. + */ + public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager() + { + return (ISystemFilterPoolReferenceManager)getParentReferenceManager(); + } + + /** + * Return the object which instantiated the pool reference manager object. + * Makes it easy to get back to the point of origin, given any filter reference + * framework object + */ + public ISystemFilterPoolReferenceManagerProvider getProvider() + { + ISystemFilterPoolReferenceManager mgr = getFilterPoolReferenceManager(); + if (mgr != null) + return mgr.getProvider(); + else + return null; + } + + /** + * 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 name of the filter pool we reference + * The name is stored qualified by the manager name, + * so we first have to strip that off. + */ + public String getReferencedFilterPoolName() + { + String savedName = super.getReferencedObjectName(); + String poolName = null; + int idx = savedName.indexOf(DELIMITER); + if (idx >= 0) + poolName = savedName.substring(idx+DELIMITER_LENGTH); + else + poolName = savedName; + return poolName; + } + /** + * Return name of the filter pool manager containing the pool we reference. + * The pool name is stored qualified by the manager name, + * so we get it from there. + */ + public String getReferencedFilterPoolManagerName() + { + String savedName = super.getReferencedObjectName(); + String mgrName = null; + int idx = savedName.indexOf(DELIMITER); + if (idx >= 0) + mgrName = savedName.substring(0,idx); + else + mgrName = savedName; + return mgrName; + } + + + /** + * Reset the name of the filter pool we reference. + * Called on filter pool rename operations + */ + public void resetReferencedFilterPoolName(String newName) + { + super.setReferencedObjectName(newName); + } + + /** + * Set the filter pool that we reference. + * This also calls addReference(this) on that pool! + */ + public void setReferenceToFilterPool(ISystemFilterPool pool) + { + super.setReferencedObject((ISystemPersistableReferencedObject)pool); + } + + /** + * Return referenced filter pool object + */ + public ISystemFilterPool getReferencedFilterPool() + { + return (ISystemFilterPool)getReferencedObject(); + } + + // ------------------------------------------------------------- + // Methods common with SystemFilterPoolReferenceImpl, and hence + // abstracted out into SystemFilterContainerReference... + // ------------------------------------------------------------- + /** + * Return the object to which we hold a reference. This is either + * SystemFilter or SystemFilterPool. Since both implement + * SystemFilterContainer, that is what we return. + *

    + * Of course, this is a generic method, and in our case it is always + * true that we only hold a SystemFilter. Hence, this is the same + * as calling getReferenceFilter and casting the result. + */ + public ISystemFilterContainer getReferencedSystemFilterContainer() + { + return getReferencedFilterPool(); + } + /** + * Build and return an array of SystemFilterReference objects. + * Each object is created new. There is one for each of the filters + * in the reference SystemFilter or SystemFilterPool. + * For performance reasons, we will cache this array and only + * return a fresh one if something changes in the underlying + * filter list. + */ + public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem) + { + return containerHelper.getSystemFilterReferences(subSystem); + } + /** + * Create a single filter refererence to a given filter. + * If there already is a reference to this filter, it is returned. + * If not, a new reference is created and appended to the end of the existing filter reference array. + * @see #getExistingSystemFilterReference(ISystemFilter) + */ + public ISystemFilterReference getSystemFilterReference(ISubSystem subSystem, ISystemFilter filter) + { + //return containerHelper.generateFilterReference(filter); + return containerHelper.generateAndRecordFilterReference(subSystem, filter); + } + /** + * Return an existing reference to a given system filter. + * If no reference currently exists to this filter, returns null. + * @see #getSystemFilterReference(ISystemFilter) + */ + public ISystemFilterReference getExistingSystemFilterReference(ISubSystem subSystem, ISystemFilter filter) + { + return containerHelper.getExistingSystemFilterReference(subSystem, filter); + } + + /** + * Return true if the referenced pool or filter has filters. + */ + public boolean hasFilters() + { + return containerHelper.hasFilters(); + } + + /** + * Return count of the number of filters in the referenced pool or filter + */ + public int getFilterCount() + { + return containerHelper.getFilterCount(); + } + + /** + * Return the name of the SystemFilter or SystemFilterPool that we reference. + * For such objects this is what we show in the GUI. + */ + public String getName() + { + return getReferencedFilterPoolName(); + } + + /** + * Return fully qualified name that includes the filter pool managers name + */ + public String getFullName() + { + return super.getReferencedObjectName(); + } + + public boolean commit() + { + return false; + // return SystemPlugin.getThePersistenceManager().commit(getProvider().); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterPoolReferenceManager.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterPoolReferenceManager.java new file mode 100644 index 00000000000..b56e3b61867 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterPoolReferenceManager.java @@ -0,0 +1,1099 @@ +/******************************************************************************** + * 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.internal.filters; +import java.util.Vector; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.rse.core.SystemResourceHelpers; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterConstants; +import org.eclipse.rse.filters.ISystemFilterNamingPolicy; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.filters.ISystemFilterSavePolicies; +import org.eclipse.rse.internal.references.SystemPersistableReferenceManager; +import org.eclipse.rse.references.ISystemBasePersistableReferenceManager; +import org.eclipse.rse.references.ISystemBasePersistableReferencingObject; +import org.eclipse.rse.references.ISystemPersistableReferencedObject; + + +/** + * This class manages a persistable list of objects each of which reference + * a filter pool. This class builds on the parent class SystemPersistableReferenceManager, + * offering convenience versions of the parent methods that are typed to the + * classes in the filters framework. + */ +/** + * @lastgen class SystemFilterPoolReferenceManagerImpl extends SystemPersistableReferenceManagerImpl implements SystemFilterPoolReferenceManager, SystemPersistableReferenceManager {} + */ +public class SystemFilterPoolReferenceManager extends SystemPersistableReferenceManager implements ISystemFilterPoolReferenceManager, ISystemBasePersistableReferenceManager +{ + //private SystemFilterPoolManager[] poolMgrs = null; + private ISystemFilterPoolManagerProvider poolMgrProvider = null; + private ISystemFilterPoolManager defaultPoolMgr = null; + private ISystemFilterPoolReferenceManagerProvider caller = null; + private ISystemFilterNamingPolicy namingPolicy = null; + private int savePolicy = ISystemFilterSavePolicies.SAVE_POLICY_NONE; + private Object mgrData = null; + private IFolder mgrFolder = null; + private boolean initialized = false; + private boolean noSave; + private boolean noEvents; + private boolean fireEvents = true; + private ISystemFilterPoolReference[] fpRefsArray = null; + private static final ISystemFilterPoolReference[] emptyFilterPoolRefArray = new ISystemFilterPoolReference[0]; + +/** + * Default constructor. Typically called by MOF factory methods. + */ + public SystemFilterPoolReferenceManager() + { + super(); + } + /** + * Create a SystemFilterPoolReferenceManager instance. + * @param caller Objects which instantiate this class should implement the + * SystemFilterPoolReferenceManagerProvider interface, and pass "this" for this parameter. + * Given any filter framework object, it is possible to retrieve the caller's + * object via the getProvider method call. + * @param relatedPoolManagers The managers that owns the master list of filter pools that + * this manager will contain references to. + * @param mgrFolder the folder that will hold the persisted file. This is used when + * the save policy is SAVE_POLICY_ONE_FILE_PER_MANAGER. For SAVE_POLICY_NONE, this + * is not used. If it is used, it is created if it does not already exist. + * @param name the name of the filter pool reference manager. This is used when + * the save policy is SAVE_POLICY_ONE_FILE_PER_MANAGER, to deduce the file name. + * @param savePolicy The save policy for the filter pool references list. One of the + * following from the {@link org.eclipse.rse.filters.ISystemFilterConstants SystemFilterConstants} + * interface: + *

      + *
    • SAVE_POLICY_NONE - no files, all save/restore handled elsewhere + *
    • SAVE_POLICY_ONE_FILE_PER_MANAGER - one file: mgrName.xmi + *
    + * @param namingPolicy The names to use for file and folders when persisting to disk. Pass + * null to just use the defaults, or if using SAVE_POLICY_NONE. + */ + public static ISystemFilterPoolReferenceManager createSystemFilterPoolReferenceManager( + ISystemFilterPoolReferenceManagerProvider caller, + ISystemFilterPoolManagerProvider relatedPoolManagerProvider, + IFolder mgrFolder, + String name, + int savePolicy, + ISystemFilterNamingPolicy namingPolicy) + { + SystemFilterPoolReferenceManager mgr = null; + + if (mgrFolder != null) + SystemResourceHelpers.getResourceHelpers().ensureFolderExists(mgrFolder); + if (namingPolicy == null) + namingPolicy = SystemFilterNamingPolicy.getNamingPolicy(); + try + { + if (savePolicy != ISystemFilterSavePolicies.SAVE_POLICY_NONE) + mgr = (SystemFilterPoolReferenceManager)restore(caller, mgrFolder, name, namingPolicy); + } + catch (Exception exc) // real error trying to restore, versus simply not found. + { + // todo: something. Log the exception somewhere? + } + if (mgr == null) // not found or some serious error. + { + mgr = createManager(); + } + if (mgr != null) + { + mgr.initialize(caller, mgrFolder, name, savePolicy, namingPolicy, relatedPoolManagerProvider); + } + + return mgr; + } + + /* + * Private helper method. + * Uses MOF to create an instance of this class. + */ + protected static SystemFilterPoolReferenceManager createManager() + { + ISystemFilterPoolReferenceManager mgr = new SystemFilterPoolReferenceManager(); + // FIXME SystemFilterImpl.initMOF().createSystemFilterPoolReferenceManager(); + return (SystemFilterPoolReferenceManager)mgr; + } + + + + /* + * Private helper method to initialize state + */ + protected void initialize(ISystemFilterPoolReferenceManagerProvider caller, + IFolder folder, + String name, + int savePolicy, + ISystemFilterNamingPolicy namingPolicy, + ISystemFilterPoolManagerProvider relatedPoolManagerProvider) + { + if (!initialized) + initialize(caller, folder, name, savePolicy, namingPolicy); // core data + //setSystemFilterPoolManagers(relatedPoolManagers); + setSystemFilterPoolManagerProvider(relatedPoolManagerProvider); + } + + /* + * Private helper method to do core initialization. + * Might be called from either the static factory method or the static restore method. + */ + protected void initialize(ISystemFilterPoolReferenceManagerProvider caller, + IFolder folder, + String name, + int savePolicy, + ISystemFilterNamingPolicy namingPolicy) + { + this.mgrFolder = folder; + setProvider(caller); + setName(name); + this.savePolicy = savePolicy; + setNamingPolicy(namingPolicy); + initialized = true; + } + + private void invalidateFilterPoolReferencesCache() + { + fpRefsArray = null; + invalidateCache(); + } + + // ------------------------------------------------------------ + // Methods for setting and querying attributes + // ------------------------------------------------------------ + /** + * Set the associated master pool manager provider. Note the provider + * typically manages multiple pool managers and we manage references + * across those. + */ + public void setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider poolMgrProvider) + { + this.poolMgrProvider = poolMgrProvider; + } + /** + * Get the associated master pool manager provider. Note the provider + * typically manages multiple pool managers and we manage references + * across those. + */ + public ISystemFilterPoolManagerProvider getSystemFilterPoolManagerProvider() + { + return poolMgrProvider; + } + /* + * Set the managers of the master list of filter pools, from which + * objects in this list reference. + * + public void setSystemFilterPoolManagers(SystemFilterPoolManager[] mgrs) + { + this.poolMgrs = mgrs; + }*/ + + /** + * Get the managers of the master list of filter pools, from which + * objects in this list reference. + */ + public ISystemFilterPoolManager[] getSystemFilterPoolManagers() + { + //return poolMgrs; + return poolMgrProvider.getSystemFilterPoolManagers(); + } + /** + * Get the managers of the master list of filter pools, from which + * objects in this list reference, but which are not in the list of + * managers our pool manager supplier gives us. That is, these are + * references to filter pools outside the expected list. + */ + public ISystemFilterPoolManager[] getAdditionalSystemFilterPoolManagers() + { + ISystemFilterPoolManager[] poolMgrs = getSystemFilterPoolManagers(); + Vector v = new Vector(); + + ISystemFilterPoolReference[] fpRefs = getSystemFilterPoolReferences(); + for (int idx=0; idx 0) + { + additionalMgrs = new ISystemFilterPoolManager[v.size()]; + for (int idx=0; idxCalls back to inform provider + * @param array of filter pool reference objects to set the list to. + * @param deReference true to first de-reference all objects in the existing list. + */ + public void setSystemFilterPoolReferences(ISystemFilterPoolReference[] filterPoolReferences, + boolean deReference) + { + super.setReferencingObjects(filterPoolReferences, deReference); + invalidateFilterPoolReferencesCache(); + // callback to provider so they can fire events in their GUI + if (fireEvents && (caller != null)) + caller.filterEventFilterPoolReferencesReset(); + quietSave(); + } + + /** + * Create a filter pool referencing object, but do NOT add it to the list, do NOT call back. + */ + public ISystemFilterPoolReference createSystemFilterPoolReference(ISystemFilterPool filterPool) + { + ISystemFilterPoolReference filterPoolReference = new SystemFilterPoolReference(); + // FIXME SystemFilterImpl.initMOF().createSystemFilterPoolReference(); + invalidateFilterPoolReferencesCache(); + filterPoolReference.setReferencedObject((ISystemPersistableReferencedObject)filterPool); + return filterPoolReference; + } + /** + * Add a filter pool referencing object to the list. + * @return the new count of referencing objects + */ + public int addSystemFilterPoolReference(ISystemFilterPoolReference filterPoolReference) + { + int count = addReferencingObject(filterPoolReference); + invalidateFilterPoolReferencesCache(); + quietSave(); + return count; + } + /** + * Reset the filter pool a reference points to. Called on a move-filter-pool operation + */ + public void resetSystemFilterPoolReference(ISystemFilterPoolReference filterPoolReference, ISystemFilterPool newPool) + { + filterPoolReference.removeReference(); + filterPoolReference.setReferencedObject(newPool); + if (fireEvents && (caller != null)) + caller.filterEventFilterPoolReferenceReset(filterPoolReference); + quietSave(); + // don't think we need to invalidate the cache + } + /** + * Remove a filter pool referencing object from the list. + * @param filterPool Reference the reference to remove + * @param deReference true if we want to dereference the referenced object (call removeReference on it) + * @return the new count of referencing objects + */ + public int removeSystemFilterPoolReference(ISystemFilterPoolReference filterPoolReference, + boolean deReference) + { + int count = 0; + if (!deReference) + count = super.removeReferencingObject(filterPoolReference); + else + count = super.removeAndDeReferenceReferencingObject(filterPoolReference); + invalidateFilterPoolReferencesCache(); + // callback to provider so they can fire events in their GUI + if (fireEvents && (caller != null)) + caller.filterEventFilterPoolReferenceDeleted(filterPoolReference); + quietSave(); + return count; + } + /** + * Return count of referenced filter pools + */ + public int getSystemFilterPoolReferenceCount() + { + return super.getReferencingObjectCount(); + } + + /** + * Return the zero-based position of a SystemFilterPoolReference object within this list + */ + public int getSystemFilterPoolReferencePosition(ISystemFilterPoolReference filterPoolRef) + { + return super.getReferencingObjectPosition(filterPoolRef); + } + + /** + * Move a given filter pool reference to a given zero-based location + * Calls back to inform provider of the event + */ + public void moveSystemFilterPoolReference(ISystemFilterPoolReference filterPoolRef, int pos) + { + int oldPos = super.getReferencingObjectPosition(filterPoolRef); + super.moveReferencingObjectPosition(pos, filterPoolRef); + invalidateFilterPoolReferencesCache(); + // callback to provider so they can fire events in their GUI + if (!noSave) + quietSave(); + if (fireEvents && (caller != null) && !noEvents) + { + ISystemFilterPoolReference[] refs = new ISystemFilterPoolReference[1]; + refs[0] = filterPoolRef; + caller.filterEventFilterPoolReferencesRePositioned(refs, pos-oldPos); + } + } + /** + * Move existing filter pool references a given number of positions. + * 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.

    + *

    + * Calls back to inform provider + * @param filterPoolRefs Array of SystemFilterPoolReferences to move. + * @param newPosition new zero-based position for the filter pool references. + */ + public void moveSystemFilterPoolReferences(ISystemFilterPoolReference[] filterPoolRefs, int delta) + { + int[] oldPositions = new int[filterPoolRefs.length]; + noEvents = noSave = true; + for (int idx=0; idx 0) // moving down, process backwards + for (int idx=filterPoolRefs.length-1; idx>=0; idx--) + moveSystemFilterPoolReference(filterPoolRefs[idx], oldPositions[idx]+delta); + else + for (int idx=0; idx Calls back to inform provider + */ + public void renameReferenceToSystemFilterPool(ISystemFilterPool pool) + { + ISystemFilterPoolReference poolRef = null; + ISystemBasePersistableReferencingObject[] refs = getReferencingObjects(); + for (int idx=0; (poolRef==null) && (idx + * This method is called after restore and for each restored object in the list must: + *

      + *
    1. Do what is necessary to find the referenced object, and set the internal reference pointer. + *
    2. Call addReference(this) on that object so it can maintain it's in-memory list + * of all referencing objects. + *
    3. Set the important transient variables + *
    + * @param relatedManagers the filter pool managers that hold filter pools we reference + * @param provider the host of this reference manager, so you can later call getProvider + * @return A Vector of SystemFilterPoolReferences that were not successfully resolved, or null if all + * were resolved. + */ + public Vector resolveReferencesAfterRestore(ISystemFilterPoolManagerProvider relatedPoolMgrProvider, + ISystemFilterPoolReferenceManagerProvider provider) + { + setSystemFilterPoolManagerProvider(relatedPoolMgrProvider); // sets poolMgrs = relatedManagers + setProvider(provider); + //com.ibm.etools.systems.subsystems.SubSystem ss = (com.ibm.etools.systems.subsystems.SubSystem)provider; + //System.out.println("Inside resolveReferencesAfterRestore for subsys " +getName() + " in conn " + ss.getSystemProfile() + "." + ss.getSystemConnection()); + ISystemFilterPoolManager[] relatedManagers = getSystemFilterPoolManagers(); + if (relatedManagers != null) + { + Vector badRefs = new Vector(); + ISystemFilterPoolReference[] poolRefs = getSystemFilterPoolReferences(); + if (poolRefs != null) + { + for (int idx=0; idx + * @param mgrs The list of filter pool managers to scan for the given filter pool. + * @param mgrName The name of the manager to restrict the search to + * @param poolReferenceName The name of the filter pool as stored on disk. It may be qualified somehow + * to incorporate the manager name too. + */ + public static ISystemFilterPool getFilterPool(ISystemFilterPoolManager[] mgrs, String mgrName, String poolName) + { + ISystemFilterPoolManager mgr = getFilterPoolManager(mgrs, mgrName); + if (mgr == null) + return null; + return mgr.getSystemFilterPool(poolName); + } + /** + * Utility method to scan across all filter pool managers for a match on a give name. + *

    + * @param mgrs The list of filter pool managers to scan for the given name + * @param mgrName The name of the manager to restrict the search to + */ + public static ISystemFilterPoolManager getFilterPoolManager(ISystemFilterPoolManager[] mgrs, String mgrName) + { + ISystemFilterPoolManager mgr = null; + for (int idx=0; (mgr==null)&&(idxString}' attribute. + * + * + * @see #getString() + * @generated + * @ordered + */ + protected static final String STRING_EDEFAULT = null; + + /** + * @generated This field/method will be replaced during code generation. + */ + /** + * @generated This field/method will be replaced during code generation. + */ + protected String string = STRING_EDEFAULT; + /** + * The default value of the '{@link #getType() Type}' attribute. + * + * + * @see #getType() + * @generated + * @ordered + */ + protected static final String TYPE_EDEFAULT = null; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected String type = TYPE_EDEFAULT; + /** + * The default value of the '{@link #isDefault() Default}' attribute. + * + * + * @see #isDefault() + * @generated + * @ordered + */ + protected static final boolean DEFAULT_EDEFAULT = false; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected boolean default_ = DEFAULT_EDEFAULT; +/** + * Constructor. Do not instantiate yourself! Let MOF do it! + */ + protected SystemFilterString() + { + super(); + helper = new SystemReferencedObjectHelper(); + } + /** + * 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); + } + + /** + * Set the transient parent back-pointer. Called by framework at restore/create time. + */ + public void setParentSystemFilter(ISystemFilter filter) + { + this.parentFilter = filter; + } + /** + * Get the parent filter that contains this filter string. + */ + public ISystemFilter getParentSystemFilter() + { + return parentFilter; + } + /** + * Return the caller which instantiated the filter pool manager overseeing this filter framework instance + */ + public ISystemFilterPoolManagerProvider getProvider() + { + if (parentFilter != null) + return parentFilter.getProvider(); + else + return null; + } + /** + * Return the filter pool manager managing this collection of filter pools and their filters and their filter strings. + */ + public ISystemFilterPoolManager getSystemFilterPoolManager() + { + if (parentFilter != null) + return parentFilter.getSystemFilterPoolManager(); + else + return null; + } + /** + * Returns the type attribute. Intercepted to return SystemFilterConstants.DEFAULT_TYPE if it is currently null + */ + public String getType() + { + String type = this.getTypeGen(); + if (type == null) + return ISystemFilterConstants.DEFAULT_TYPE; + else + return type; + } + /** + * Clones this filter string's attributes into the given filter string + */ + public void clone(ISystemFilterString targetString) + { + String ourString = getString(); + if (ourString != null) + targetString.setString(new String(ourString)); + targetString.setType(getTypeGen()); + targetString.setDefault(isDefault()); + } + + /** + * Is this filter string changable? Depends on mof attributes of parent filter + */ + public boolean isChangable() + { + boolean enable = !getParentSystemFilter().isNonChangable() && + !getParentSystemFilter().isStringsNonChangable(); + return enable; + } + + // ---------------------------------- + // ISystemReferencedObject methods... + // ---------------------------------- + /** + * Add a reference, increment reference count, return new count + * @return new count of how many referencing objects reference this object. + */ + public int addReference(ISystemBaseReferencingObject ref) + { + return helper.addReference(ref); + } + /** + * Remove a reference, decrement reference count, return new count + * @return new count of how many referencing objects reference this object. + */ + public int removeReference(ISystemBaseReferencingObject ref) + { + return helper.removeReference(ref); + } + /** + * Return a count of how many referencing objects reference this object. + */ + public int getReferenceCount() + { + return helper.getReferenceCount(); + } + /** + * Clear the list of referenced objects. + */ + public void removeAllReferences() + { + helper.removeAllReferences(); + } + /** + * Return a list of all referencing objects of this object + */ + public ISystemBaseReferencingObject[] getReferencingObjects() + { + return helper.getReferencingObjects(); + } + + + public String getName() + { + return getString(); + } + + public String getDescription() + { + return SystemResources.RESID_MODELOBJECTS_FILTERSTRING_DESCRIPTION; + } + + public String getString() + { + return string; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setString(String newString) + { + string = newString; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setType(String newType) + { + type = newType; + } + + /** + * @generated This field/method will be replaced during code generation + * Is this a vendor-supplied filter string versus a user-defined filter string + */ + public boolean isDefault() + { + return default_; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setDefault(boolean newDefault) + { + default_ = newDefault; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public String toString() + { + + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (string: "); + result.append(string); + result.append(", type: "); + result.append(type); + result.append(", default: "); + result.append(default_); + result.append(')'); + return result.toString(); + } + + /** + * @generated This field/method will be replaced during code generation + * Allows tools to have typed filter strings + */ + public String getTypeGen() + { + return type; + } + + public boolean commit() + { + return SystemPlugin.getThePersistenceManager().commit(getParentSystemFilter()); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterStringReference.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterStringReference.java new file mode 100644 index 00000000000..99a5614e0ab --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterStringReference.java @@ -0,0 +1,189 @@ +/******************************************************************************** + * 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.internal.filters; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.filters.ISystemFilterString; +import org.eclipse.rse.filters.ISystemFilterStringReference; +import org.eclipse.rse.internal.references.SystemReferencingObjectHelper; +import org.eclipse.rse.references.ISystemBaseReferencedObject; + + + +/** + * A reference to a system filter string. + */ +public class SystemFilterStringReference + implements ISystemFilterStringReference, IAdaptable +{ + protected ISystemFilterReference parent; + protected ISystemFilter parentFilter; + protected SystemReferencingObjectHelper helper = null; + protected boolean referenceBroken = false; + + /** + * Constructor for SystemFilterStringReferenceImpl + * @param parentRef The parent filter reference for this filter string reference. + * @param referencedString The filter string we reference + */ + public SystemFilterStringReference(ISystemFilterReference parentRef, ISystemFilterString referencedString) + { + super(); + parent = parentRef; + helper = new SystemReferencingObjectHelper(this); + setReferencedObject(referencedString); + } + /** + * Constructor for SystemFilterStringReferenceImpl when starting with filter vs filter reference parent + *

    + * we are not yet ready to make this available. + * @param parentFilter The parent filter for this filter string reference. + * @param referencedString The filter string we reference + */ + protected SystemFilterStringReference(ISystemFilter parentFilter, ISystemFilterString referencedString) + { + super(); + this.parentFilter = parentFilter; + helper = new SystemReferencingObjectHelper(this); + setReferencedObject(referencedString); + } + + + /** + * Return the reference manager which is managing this filter reference + * framework object. + */ + public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager() + { + ISystemFilterReference filter = getParent(); + if (parent != null) + return parent.getFilterPoolReferenceManager(); + return null; + } + + /** + * Return the object which instantiated the pool reference manager object. + * Makes it easy to get back to the point of origin, given any filter reference + * framework object + */ + public ISystemFilterPoolReferenceManagerProvider getProvider() + { + ISystemFilterPoolReferenceManager mgr = getFilterPoolReferenceManager(); + if (mgr != null) + return mgr.getProvider(); + else + return null; + } + + /** + * @see ISystemFilterStringReference#getReferencedFilterString() + */ + public ISystemFilterString getReferencedFilterString() + { + return (ISystemFilterString)getReferencedObject(); + } + + /** + * Same as getReferencedFilterString().getString() + */ + public String getString() + { + return getReferencedFilterString().getString(); + } + + + /** + * @see ISystemFilterStringReference#getParent() + */ + public ISystemFilterReference getParent() + { + return parent; + } + /** + * @see ISystemFilterStringReference#getParentSystemFilter() + */ + public ISystemFilter getParentSystemFilter() + { + if (parentFilter != null) + return parentFilter; + else if (parent != null) + return parent.getReferencedFilter(); + else + return null; + } + + + /** + * 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. + * By default this returns Platform.getAdapterManager().getAdapter(this, adapterType); + * This in turn results in the default subsystem adapter SystemViewSubSystemAdapter, + * in package org.eclipse.rse.ui.view. + */ + public Object getAdapter(Class adapterType) + { + return Platform.getAdapterManager().getAdapter(this, adapterType); + } + // ---------------------------------------------- + // ISystemReferencingObject methods... + // ---------------------------------------------- + + /** + * @see org.eclipse.rse.references.ISystemBaseReferencingObject#setReferencedObject(ISystemBaseReferencedObject) + */ + public void setReferencedObject(ISystemBaseReferencedObject obj) + { + helper.setReferencedObject(obj); + } + + /** + * @see org.eclipse.rse.references.ISystemBaseReferencingObject#getReferencedObject() + */ + public ISystemBaseReferencedObject getReferencedObject() + { + return helper.getReferencedObject(); + } + + /** + * @see org.eclipse.rse.references.ISystemBaseReferencingObject#removeReference() + */ + public int removeReference() + { + return helper.removeReference(); + } + + /** + * Set to true if this reference is currently broken/unresolved + */ + public void setReferenceBroken(boolean broken) + { + referenceBroken = broken; + } + + /** + * Return true if this reference is currently broken/unresolved + */ + public boolean isReferenceBroken() + { + return referenceBroken; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/ctool16/new.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/ctool16/new.gif new file mode 100644 index 0000000000000000000000000000000000000000..7aea894d0b603a02aed2a7f706bcb3170988774d GIT binary patch literal 612 zcmZ{h>q}E%9Dt8G)5LOgQI2^@7e=H}5t7*jq~=si${U5|rU_+M-j`oOU#sb&i!)6! zQj1L2<%^C`(3Frs!zQH!M$LxHZR)0;HP3s_`~J#5py%WBe0&lT<%eQbQbx*H7)D;+ zC9mj8tL`~bsh6u?DXLzlp`Oc4!$r+QwcX=`U*-e?sC#^9(mL|ZR{74{H@%DrT- zV)#}6;rDanLRp{LGx3fOqC^RS3vNq|)X-(A$o!#sus3{C+!5o{Rj7~JHa zq?m$3AWMR=N;c$n#X>#8pgrH*sO=7AfY*vOt}fICx=Rq;>*}tJq5D zJOzs&S}52kF^hQm&roD!pv_wX{I_nC2C7b_o=HnlsqcF+ z>%ILpZc-}G=AK7a*@3|wd!lmkaw^a@Hhgq+cl5#IStlz|F}po7cvo=5fta}bq!M(A z4UvV+$@aw_y%1lD%Gl7ITxjV2!wCgP%26SkA9VL}>?w1J7eN*3kUXk(DEU6m(EdKjHN)jkv7c;{Jb4a3C!1>qfFng9R* literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/ctool16/newconnection_wiz.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/ctool16/newconnection_wiz.gif new file mode 100644 index 0000000000000000000000000000000000000000..9f2b4acc733d73b2b6570ee603b53d7be7621d3c GIT binary patch literal 328 zcmZ?wbhEHb6krfwxXQq=e#QEgi&idQxO~Cv1v974oHlvdguV$kuixzL>FsFmxNzad zn>X(TG8`ldJPaBlDmD~!9BBCQpB(<(f{`cMHnI*y-icKd>n9$MD(a_LPP*9MNknsQie+KFS#h)yU3=C=vIv^uK zeqvxtb(mb>p(E8lT{&n{2%olC=g~zhI#!c8Ta8}IFn2L`G~dja!pwSb%Ey#BtgVhe z3TFv)wZy)7@x7O+v5}8ofS-?{vr~<$x0jb+ke|1&S4~k#MOAe|8?UO0va*sJ&$4CJ LD_5yGGFSru?E-B@ literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/ctool16/newfile_wiz.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/ctool16/newfile_wiz.gif new file mode 100644 index 0000000000000000000000000000000000000000..9d050885be6d125c6f3a8ee61f770af463945b9d GIT binary patch literal 353 zcmZ?wbhEHb6krfwxXQrr>Fe)rKmPps{rBguKlfhzc=G1w^LIbre)@Ii`S<%Te>{Bk z12|TpyR{>mrI{2JXHL%C7O09Mu>554H9&1sF`=rV`q@7GGB8G zKfk`Pt2BF0FFPY+r;7~t)M?XXTxEIZ%$>s~>nhH=Wa(0IS4pnbYt~4*N^x%5yop81 WRg`1b?%krUA_op05^-{5um%7kHK6(c literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/ctool16/newfilter_wiz.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/ctool16/newfilter_wiz.gif new file mode 100644 index 0000000000000000000000000000000000000000..8f0d32338c9c2239a4056e8d1222baed06b4a1ae GIT binary patch literal 227 zcmV<90382ENk%w1VGsZi0K@ zV@c9935=&e2n2Eh(d8nsRB$4I2Qr~-D5Vz(a+q*bkZ}0WJ!KFG1p~2AC^V;zTpo#Z dOxjV$emX`yawbGZNGc06RghZ;QjxV`$ar2|~4QF>xx?1nJH^pSN zg-dLHSxb0IO?k_#wfoN-#<#^cFHrQ(@$27Px&BpB(<(f{`cMHnI*#i|Nm#8 z3@H9&VPs&?V$cB@1M(9CTcyL)0uLP_NoRJ$l$4wnuf&eSB7RCd%U3D>X|PbZ@Ns3- z3ctC1$1hv*PIR5@8KNY}$mz sJ4c6rh^V-LYeiL!lz@c1Zjz+Ilcd3PiKtXA0Zh;6p@k?CL0_Z zCPWoEoSYO+5;_f|H=jxoC@G^SrbiGR4I>RDtwszD8W?QukUPcxVg3N+QynI8>&A%Jbi9O>7_N5Cl(hUnU{ZHR?eR3 zS^IiJc1_9n4+adR1I3>#j0_BV3_2jKAU`p%RXa>C@X(R!?|htLDW%5X`Dm4E?%Ei3 z7KTQNCZ@(FmdA}eY;1=alz2Gr6&!lJu)xH_>0;9P_!0?09(g4vHR1M-b}11lVKpaJ z(MgjhOHNXCQWu{+XYOouCk?U1OO`IyaMF}ny=LudO(!ks&0Dr^)^gU_wR_Jl_x%SB II5JoR0MLz@eE-$|rN4 zPh{ct!#56|eRTN5#hjk~1^ov~CLOAsaja?1iPYSxCF}NIx&LwAl66y8pFVcw<;knh zx9>f6wWhtWj!Nlho2CsdZiQzwb8BED^qO za?yVK}G@h1x-1A`BP4#;-O_61)8W|BA+4ihHbG3g)26FOj+aGf zwh*_ygN=hj4?l;fkoQV=TU$FjTX&yU?G@f?vTklpt}Z=%7M5F;O|_goyo7qx85p-J z8OsQJdY|0XvSp>3l%(3qtI|9?0xQ%MjWnh1-dAPgTA^UBZ>S-0rAJjzWQDxBiLRdb uo0D3K3XIE}=e!e@I3RFriK~FQjDq9DM{FGeJm=_=KmtbaOum%88dYK!wBBy9aOw^8;pdHq$o3r)z-~WyK-gX^+H|^BNr5C?!x%K1Fqu&=^ z{r&#u|L5QT-~al5_4EJNKmWh`_5bD1|8IW%fB*ac=Rf~{|NH;z-~Y4c&t@msbr%~q z=b2V#S`?>Pr^VPOMmkQb)SpylFsaP2r`V_^&$K4f;{X5u47h>fPZmZ71~Ud7kP?ue z7}zQtX8ST#8i;VVEL6zh;uby4I{9MG48MgcP8k+z-OOg(zh|76j|h|a-Eptr=B;H# z?C;*+ob!#5m4#7RS-V(AUap)`QN^@aS6)?>aiXk7r=O<0j7(=|gP)$fnh2wax(M@h eU;Q-^f78}2yEi#9SOWlu>Xowq literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/cview16/editor.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/cview16/editor.gif new file mode 100644 index 0000000000000000000000000000000000000000..007e98dc702996ae8614878e2048b0c884b4a3d7 GIT binary patch literal 591 zcmZ?wbhEHb6krfwc*el+_wT=tpMU-M`RD8RKW{$#Y@f2WXWFXgZ-0LN1{C@I>-XOu zKYz!SEzWIO8(%yvp?F$h(}M14tM0$}@#xjhN3VW-`0~49%9h3{Tbd@Wn!fzNjO7QG zZ@<(xd&Bx&XV&dHGilbcPat!CO`5$-$vOS^pTDaQUO9I1^vwAS7cQBza^w2Vho@KdXIk`S zTJ-1G_2=46C~%%o;Bs_U;-nI zVrb&;>);?DB`GN-;N{@!uWx8w^Je?aI(A%~inlnmoLX#kb#0iW&+#y7y0lnYS-UASvwULFaBlHX zQ&3jsc*d^o!6Ez8V4)K$7l&Y%g_DLS3#WjxlgWgZ3zL{6jI&~#PH;}{S8%q9bSVl@ HV6X-N3G>&j literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/cview16/errorlist_view.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/cview16/errorlist_view.gif new file mode 100644 index 0000000000000000000000000000000000000000..cc87d38aa0a1b26e02c85a621d6ce447e9dbf97c GIT binary patch literal 604 zcmZ?wbhEHb6krfwc*ekRP*ifisKkH&p#KTU|H~_`ib-D)lfEOR@ZUfDe{j@C|Iq)T zQ6GcDKZQpAk4^laSNzh{?tg6B|E$8lfB)q*uPf=?bn4QhZ$JM0{`2qWuRlM2{;ulZ z);i}%$D9N2KmTf&w!3TLi3!V3Pg{GjZ_$y7OOMapbZzO*+h?vmxpeFK(>Fh!zx%o7 z;KR+wpY_gI`Rc>Z2d{oSdj0*)r(a*b|9<@D`}6ldKYsiD{ny{0zyHpfIbrVX-UV~J zmoDg>J+uGz&GY*Yt0?n7Kj(jL?*FAr|F2l_9}E}<2T=UU!pOi7#GnIm4k%6-*mpJrH3fNj`gnOb zcXc~A`}q5M`}+t>PMg*n)F0^YKWEBxNtYl2UcY&B{Fns9L`9@rgBS%lI06H=3NlKF z@3jkJ=jL4D&&kccR>a6{3D>;2bGQV|O|RNFvGE58@dfa+s!Okvb7*GeVP@fBH8Xto z&b@gFJA;6Rto$PpJ;zVBCR!OBG8zT#Hj0`a6C^GwwmP?4J$c$-$lT^Cq3BT1FwuG5 e6fu3LeFBCY?EL*f5o-(rnUm1RU=08!bm#>D literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/cview16/resourceRef_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/cview16/resourceRef_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..f84a67a3559c96fffa4f5c1bb63c5ac844e49f5e GIT binary patch literal 365 zcmV-z0h0blNk%w1VGsZi0M!5htGU$j_51ny{P6Vq7cyNeMQ)O$!IPxH-st$`?D^;J z`R(%h^Y;66iKyJ?_uuLG;p+J6@cC42kLK?AQ*Dm$_4^`2XEs!K+tgP^zifZ@bmNW$HuvPbWeJ7PkVDudvj2SdQ5|NO@DMwk$*^y zeM+5$MVEp`(#y8`_wKNdKCFyDr;0+Si$bD^L*U4dw2(d2vS`$@Y1+Mf)v{^-`R)7m z?*IS)A^8LW002J#EC2ui01yBW000Jxz@PAkD;kT#BvHU@>TpV-j6<#Ncu?hR!|mR7 zxtWp{D4WZSn$lKjyW0bs(zU4D?JgxO!teKALl%OA788aO3M@kxJ&lbP36YU4LlQm& zm@yU*oSZ2`4I(3$Ar=p(4+ttl2Ob0;1Rxd;w6rTj00bQx7#S8MB_<^(Cqo4Q1`QM! L7E#X6LO}pK0am{a literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/cview16/system_persp.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/cview16/system_persp.gif new file mode 100644 index 0000000000000000000000000000000000000000..592d46f7b72fac5d4d2879c7c248c99d4d167f7e GIT binary patch literal 606 zcmZ?wbhEHb6krfwc*ekR)G2e#x~-*EU6n11YTB1{O<7adI<2y{edWf(>$e`>zW3D1 zHJe)|tgNi-@QExueBxqiZq<@?`{ylLw{Y3I=B_D6PF>cHoT?o@Vb#I=n)yexl2>RY zEYgl&s1-9?8;GK&YDY}a4(nZc@c!iE9~<|*?Kt#){<+U=`~Ua9|9}7c|MAcNuYdpl`uG3GzyDo*eSiM{ z@1H)kXnu2adVEYq{H%GCkDWZYW&5g$lRB3!n^=?|x^Z3q-fcZKReANLPG?SRe);rb zYlXv!z1??jp6IKwTfLxkMw9iL9@E9`7EL97oBB=u|NqZ0a6s`V3nK$V7=sST37|M( zVBg&krl=q$D=j7A$k*ND7$&Krs;s82#V0yr1|wgSxV)T)70&E}Q~D=X_dd?E`EpSYNsTeW1} z{&`E*EnK#4``%+mPF)tsb`i~X7R_;%DfEyj^i(PL*RBawDfiQ^2{CAhD4O3~u%V!0 zL&1U*4aZI%+_HVu|KI2S|NqZGG*JA>!pOj2$e;t#0rC?ATl;|-1sWxZeIDWyJAPWs zM9N(=M}v^#4~o-83PHbZP8JG+{Wu8s!B;>COuxwzD|4YXBPtl;LK$jGQXUq^+J biJ6U4YNC^(g3=Lvx#M!~`Y~q=9T}_vHj0Sg literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/cview16/team_view.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/cview16/team_view.gif new file mode 100644 index 0000000000000000000000000000000000000000..88c056795d56a510d7ea3dcd2b5b11f3db11384e GIT binary patch literal 139 zcmZ?wbhEHb6krfw*v!BnlDS$SwCmuD|Ns9V|Nn8t|I3v-n!S$n`mZQ;UQyyaC(8~f z!GHu5f3h$#FmN;IfW$y%FtAt@ob+71*W&u&tv1d#QrQxPjw!8q(;`wZQO7aY-)miU g(1%`$157GbEX+%TSA|v{P21j;cYJkJr67Yf0B0C8{r~^~ literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/cancelshell.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/cancelshell.gif new file mode 100644 index 0000000000000000000000000000000000000000..7667d04db83f26f5310023344eabc436b8a3628b GIT binary patch literal 151 zcmZ?wbhEHb6krfw*v!CiX!V-on>L@^vh~#V9s8HBymRjSi~IM^?Amqz^5qxz?j1UK z@c;k+3`junCkrD312=;XNDO2K1B*++Nzc`LEy9oP4xg>qr|hA5Y~i~0M86jb=bNRu wD)ersGyQR3c%&LA!f`@np+k&D&B6NyA}gYpZ6cCRKQ*&Y=&jJ{WMHrc0F%c(HUIzs literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/clear.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/clear.gif new file mode 100644 index 0000000000000000000000000000000000000000..9ff6416063dbf6ddbe251d741830505ad6c54007 GIT binary patch literal 328 zcmZ?wbhEHb6krfwxXQrr>(|e(U%%YHcl+MmTPKbkdT{^ll}qOzJ-GYu{+%1wE?>KH z@xb1l&!0Yi`uO3KM-Lu9y#MIIy$AR1eEa(4>zB`8K7acB>EpwDcV0Yu`serW-@ktS z`2PL-H=yK~LkAE3|NsBrzkh%K{{8dk50K438=&};g^__li9rWsJjhQBY^e?t3p{kB zTIVkL)bYh)zHHia=2cBLfywM5T!~H*nj8*nBAbr-d2GI!!SbTS&1pW*qr-g9g$xD6 zDk>RyT6j1cm1Ko^`Fh%eMEEE1b9Kmy3a|?ZObrs{;1J`O>+ZFzbD5`)k0XOM0N1~S AaR2}S literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/clearall.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/clearall.gif new file mode 100644 index 0000000000000000000000000000000000000000..ecd1be5681503e61dad33db001934298624edddd GIT binary patch literal 187 zcmV;s07U;sNk%w1VGsZi0J8u9y1Kcxwza~+!RYAd%gf8g#>T6*6 p&5U4BfoP92mqubfZ|ElS#Gi0I}eMb=?0hv=!;iZy|UTOS9Ern3j>2S03Llh A4*&oF literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/combine_tsk.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/combine_tsk.gif new file mode 100644 index 0000000000000000000000000000000000000000..19c801ccce7db5f63d947ba168f5351d4e433101 GIT binary patch literal 220 zcmZ?wbhEHb6krfwIKsg2^XIPxi&t&gzIWBy%~!AA{_yeh%U5rnJ%2fO;qv9HH!fPX z=H7$H$4{Mm^yJxxkDuPYdw=`(%@xZRE?u%<>&E4GZk&Jr?#;8u_YNIA`0wApKY#xG z|Nox>6)65>VPs&CV$cBzgY0Brja;DCm!cV$ku_<0K;)EywacAjJPj^iH;$it_f^u5 zR0GYcFF$BAu;|TrbLEGt0+X~~dDI<|j%ohPcVgLiL@&-TdLR!^nh(jmpf>^7Hla^7P~6 z=GE5Ny}-q~y~4J+zO}f$v$ng)%g@Hi&BVvc!Nkb-`1$qr_w@Dl^Yr!1$iK_SzS-8# z($2=h!NL6e{Qv*|A^8LW0018VEC2ui01yBW000GU;3tk`Id*88nqTL=u%~sV>j5yp zWi;6V2T7sv0BkrjUtq~>_Cy`QAu^#b8V-oy*&2AiU~Z>EE}O-cg@Irp7!+y4vtxN1 rEQ)tsF~8U^c?y1fCm41Zfrf-o2yO%jfsJw}36++YVk(*_A|U`fJez{g literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/convertarchive_tsk.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/convertarchive_tsk.gif new file mode 100644 index 0000000000000000000000000000000000000000..7f94599eefa93f16eba6977545b29b61c5751990 GIT binary patch literal 332 zcmZ?wbhEHb6krfwxXQrr^XIPxi&t&gzIWBy%~!AA{_yeh%U5rnJ%2fO;qv9HH!fPX z=H7$H$4{Mm^yJxxkDuPYdw=`(%@xZRE?u(V?VFcdH!fedYT=z5=O5j_ar4^wS1+Et zfA{9zt;^3I-&-_q=JY8O4;?&s@W6q8|Ni~?^XLEn{|qz$ia%Kx85ooqbUm%L<}QfZR1yi6`@eAX24cp;(5KGHRH3w-42Jwlun MmL|_qc4V*y0JqhJ{{R30 literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/deletereference.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/deletereference.gif new file mode 100644 index 0000000000000000000000000000000000000000..59a2eaa653877d86894eb9378cc7736e30f43709 GIT binary patch literal 205 zcmZ?wbhEHb6krfwIKseiWZn9$3m0u!u<+{PBUg_cJ+p1cxt+UD?cM+7%h#6n-p^mY zegfie-@bhP`t#?HUq65BUcGAfs#P~no;-B$;P>y}|NsBbfEOtKWMO1r5M|H-sRG%_ z!0MHt+Lw|!Ps4KUn<;+&GP^bA+~KSB6DbY0y38^$K}G7|C6$E{CZ%gmy}A(9t0p9F iwz5k=jhQ2y)qvsHb%(?tfdxyme^^WT-gH-Fum%8{L07~8 literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/down.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/down.gif new file mode 100644 index 0000000000000000000000000000000000000000..8aacf959dc4474f2f1c499c89117a29d76df9086 GIT binary patch literal 152 zcmV;J0B8S4Nk%w1VGsZi0J8u9`T6$w`Sgwp=^z-lJ;n(2Y(dOgZ?d#?D_Vf1j z@~Wko;@;Hp@9M(A!TtzxR)a|IBhvdkLVK3Vn7@$G@XNT$<#Rt&?pp$VOX!!pkZssP8?frM~s?8 G002Ap2~9}= literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/editfilter.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/editfilter.gif new file mode 100644 index 0000000000000000000000000000000000000000..e2a2e5d763af6abb7fcb94ac00cc9122d1320b9a GIT binary patch literal 203 zcmZ?wbhEHb6krfwIKsft)i-(F`VBvSe*5+7$L(8JPMtjR?D6f7?_WKAbm#rsmp^}e zTep1H%0<&|Tt2;Q(VXRr<{UbB@c;k+3`7IPpDc_F41x?gARQn(8CX3MRQgghoiaFQ z3bv@cmRNn(`uvvKP3gXC9OkSE*umSPew>*#lBZ9rk%1vVW?i`A%@5`1$kn z_44!d@9^>V`1$ek^ziic*V);=z`*+8tK#LUaZ-rLo}!NL9g{rvp= z`T6<(|Nj6000000A^8LW0012TEC2ui01yBW000GVU?+}bDQ0M@qGZNFS}a3c)&|iu z0TTs80oy1eh&YbOh(LH+L@>~3WWnrY7>9^%-n3;|%oEaeiJBRmz*#H0l literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/exportshelloutput.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/exportshelloutput.gif new file mode 100644 index 0000000000000000000000000000000000000000..b6df7b27c52687e8892e8eb8b7a1f4e3b3356d43 GIT binary patch literal 377 zcmV-<0fzoZNk%w1VGsZi0M!5h`T6?z`1$wu`1bbq^z`-M;pD2Uu%)M~$jZ*g$<4dH z!MeP_>g@3A?C$94>)_$zvbDOYtFEM`smIC8xx2pN%@5`1$hl^zZQT z@$>Z8+1b9p!1($3_xSkb=H}eo%-r0~-`~;V;??5f*5>Bi>+9q0?&$IH?Dh5X+S$p? z%eK?ezQw|-z`UxwxT&R}l(n#?-rLpj@b0Camcqfo|NsB}{r&v>{QLX+`T6<(|Nj60 z00000A^8LW002DzEC2ui01yBW000J-z@BhOEDCSPq!LNI@jAJvw8OhK2cFL-@Bsxp z1MBcc@Nmu?03fszA2lADyjGjpXUX1ebMg2?GAn|ERyPfY4FWPaHY$#eg$|Ms5Dzjb z2nq%VDTNpq5IQ-FHYld1g%uSL3=A1ECkYD?5+{Wg77#Qwq$MRLzJ*H#G9(ie5iBll XO^hQWEif_6O(NDW(?(57LO}pKcXicg literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/lock.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/lock.gif new file mode 100644 index 0000000000000000000000000000000000000000..877953859811a60d6bf51c91e50386e2cf403636 GIT binary patch literal 322 zcmZ?wbhEHb6krfwxXQqA>db}pn|FTx^!C%oHy=N|zH;f*hBfofoj&;Z!L|E$F74a3 zZtA4Yr;l#lyM5{TlRM8I-#&l#_`5gHUOs=ga>+Z^fkBZ$2V?`tPYi7F2PPDF=t$XnEdIp& zqh-Pcm5;&&TK(6T3e2iiV)k7hn)6i5o~z&8&`!!sA>g=xt-pd4Z^|J?>z(o(Osqo8 o{Gw^j@?zo=B7%Im!7P&8+>-p0x_Eim*?Bl;MF)1eI5JoR0RNA5Q2+n{ literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/makeProfileActive.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/makeProfileActive.gif new file mode 100644 index 0000000000000000000000000000000000000000..af79ce2c5201f5e8f4c50bdbc6198f0f03a4c5e8 GIT binary patch literal 596 zcmZ?wbhEHb6krfwc*el6ckQNU&t5!!{B+Z%E$`odc>DIZrgd_$nmp>j-KAWW7n(KZ!ccDa{j`l^_zFC zTDNt@n$62rZQOI<*zWyDZ{K}z>(2d)S8kj+fBE3iQ~M4bKYQ`&i8B{=?Ar6@-G`^o zU*3QCc*V+9PoF)1{N(BV2M_Pve{kdGt?M^#Ub%Yh#K}{eHgDOwYkS|!Nek92xpL#m z{YUrTynFNg$M=t)KK}Xh`{~0Q5AR(1^6A}=?_Xa%yZ`>p^Fs#@{s#kwp#v0uvM@3* zxH0H}oD7N+2KJ2&ZZ6F&&2H@-?JjyfJsd6_6DH~#O*Jx^_;prw zM@L}=Wr5p^BzSol)g2r}+Fu~nduON7JX r;bLZfQAL-W4~nY}b&0b3{rPZ!xusJ`rmjQFWm3wb$r`;ZObpflG)e2p literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/makeprofileinactive.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/makeprofileinactive.gif new file mode 100644 index 0000000000000000000000000000000000000000..5299480398ba88aac62d3b7fffd1483b7458d84b GIT binary patch literal 388 zcmZ?wbhEHb6krfwxXQqA=-|P>fB*jZ^XK>P-@ktS`u_dYb z{>_^=FJHcV`t<3OCr=(ddi3z&!~6H|-@AA3?%lh0?%cU~^X82kH?Cj5e(l<|%a<=- zx^(H{#fuj%TsU{`+}X2dPoF-0>eQ(dCr%tVaA5!b{rmRq+p}lS_U+rZZQHhW>())1 zHf`Lval?iU>({Sew{G3qwQE3>C&Zh=FFKrd-n9{)Bpef&wv9c z{$ycfU@&LU0m*~>#K5-j!0ZAK9WKTbDwisHEau8Gd}f=FVKURl>l8~x$b+d~tDZ1r zy*SOfm|>6Fl#|^xlD#5p#9kXtUYlZ+qG+HmsK>#<-qD?sVJfc6#K^BCYQo5vA~Ty? zmxWnfOkI?PB}G<6g;$T2b+MV|+7vleRlat1{tf)>Y|Aw?1oXK0)dhC(b1qj?=hx-d f*eS1I#+{;WWGJG`qs}g^CU3@*lKRZkk--`Oy<53a literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/monitor_view.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/monitor_view.gif new file mode 100644 index 0000000000000000000000000000000000000000..ba6a24bba7aa0f82adef4f5f88516631232f0a5c GIT binary patch literal 334 zcmZ?wbhEHb6krfwxXQrr=g;3?zkdJx`RnMhlY93a+`VW2&Ru(V?A&wU(DD5TkL})j zXy@(&+ji{Tv}NbU%{$hv-*V*G>9rfT@7%p_+m799H|;oj{N#~iCk`Jye(>)$i6{ zbTWp|cJhi6tB*GPbJv7bZ{V_RJD2{4k>Qk({)ylh4np0>lpXX}*tYZ~oWC#pPBKq` zgNuicUrMrELRPx3zfYoETvld6zgW5GY*FUfVspy9MV2h_ahDTZmF4QY&SQguBZD;n DdT@I^ literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/move.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/move.gif new file mode 100644 index 0000000000000000000000000000000000000000..d906a0579c246cf6730133a02b073e9fecc75964 GIT binary patch literal 111 zcmV-#0FeJjNk%w1VGsZi0HOc@sI0T6tFpPh!??V{yT8Q3!NLFk{{R30A^8LW000I6 zEC2ui01yBW0009tXu90K<-HQ3gdy8o3g{QJO(;GVvu5?`)k~Ky{r~?z166_IPZmZ722} literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/rename.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/rename.gif new file mode 100644 index 0000000000000000000000000000000000000000..68ca27ad46c18710e50128d4b6b488ccc324ce1e GIT binary patch literal 211 zcmZ?wbhEHb6krfwIKsg2`}dz;zkdJt@$=K?uOB~sS-yJH^;`EIKYRJ(=dZ8dzTbQF z^wzzHZ$Er`@#fu!FJBKGJox|re+E*3;!hSv2B1|sAWa}U8CU}pRQggZ?KHC1oqx6M zU8h)PtaJZH5%n!VE}p$)-LmByRxDb* zc;52)Q|C_GvUls6t!o#pT|9OEwAoAN%v?Nc$-1QrRxOylboQF9Yc}rOIB)5^T?cnv zy?OQaz1yodtvY!8z=rMX_8r-?bN}|^XO8YYylelFJtxi_-FJA``W;IyT|ar~;KBc3 zz(5&L{K>+|z@WvT12P8WCkD0_hp7b~I%0t*R4%P>lJ!|8u(FtQL0@yfW~$ayx5WoT zU$AtVX|BuAwdx7v>}Q{AcJgU{-@Lf%>GvcWr7~O8CF)anx|&<0yO{C?CiQ4aP2%Ru zXXE1Pk(wjS$&k;&Dbg$@C@3P#$CB*J$|ofyB+4(w$GRbfg@ccmmyct;kC&IvNmoY( FYXJA&h)Mte literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/searchremovealll.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/searchremovealll.gif new file mode 100644 index 0000000000000000000000000000000000000000..ecd1be5681503e61dad33db001934298624edddd GIT binary patch literal 187 zcmV;s07U;sNk%w1VGsZi0J8u9y1Kcxwza~+!RYAd%gf8g#>T6*6 p&5U4BfoP92mqubfZ|ElS#Gi0I}eMb=?0hv=!;iZy|UTOS9Ern3j>2S03Llh A4*&oF literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/selectpool.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/selectpool.gif new file mode 100644 index 0000000000000000000000000000000000000000..d67529a487a1877b7018436942c6009819c09b28 GIT binary patch literal 209 zcmZ?wbhEHb6krfwIKsei`sld_cOG3nckRf&6F0BkId$~h<{f)~{`&pn=dT&_m(E+d zdiJ6fyY?U6zURQLdk@cDx&HmYW| zia%Kx85lGfbU-G7{KUYPcVJ3^hYpwji6xgRoGj;`6TTcN$)j~qv+F=tPWG`j|LrWlp_a;k~*@-fIsC@bgqa;fo%2s6s6PE$?t@)A-} gQBv@5b5>W9N?erdAym3(=JFM}@@qCMbY!pw020oQNdN!< literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/stop.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/stop.gif new file mode 100644 index 0000000000000000000000000000000000000000..0810f49845b2712483418f6b13fcc3f14cc9fadf GIT binary patch literal 148 zcmZ?wbhEHb6krfw*v!Ci|KZbphfW?mdiw7DN85HEI(zZj=A8!)9X$B||9=K-K=CIF zBLf2mgAPa%WCjC^qrgee)q5?jAKq;*tDIB{*Fm)39IwQAkg6>Byx zTeWe|fn&S(AH99|!L2*@FJ8HE=KSS@M^EiLbo}hat0&G}*s*KRn|B|cK7V=t;o}u6 zS3Q09{PB~g_a8jGcmKhSo42mtxOwI3wG$^#ZQ8tL>#pq|KYcuO@Zf(iV88(sf3h$# zFqkvwfaF1bVqj}OFuTA*hb#Mp%B6}F%efs=pTn{bt}~c9CDNN`-~F{4k7?{b_bBPC z>1;u-g49V;%nUrLv+LGRpLDj;Oie&Qtu{ooleJM$PLaReRE(FGu~A5tUwon%AD>pE z8oxxFS)CX+w|1qPl88Eg+j1^0rb=lO4S5C0Wg)_vn(UP_CUPpuQu~U|csVjy0{}2{ Bw`~9b literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/up.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/up.gif new file mode 100644 index 0000000000000000000000000000000000000000..38841abe9bbc7f2c4b412ff2e7368b95582d4389 GIT binary patch literal 152 zcmV;J0B8S4Nk%w1VGsZi0J8u9`1tku`uOke==AgNv8|u$>Ei0>;o{%b;M~#XF@36>*(S5_w~ZT!Tdni?7mn||aBS!KqdVWcc>MbLqw`00 zo;$qb+#w*^`TE(Tvj=wU-?DDc#x=XvtvYn@;Q#;s83+NzpDc_F3?d9VAcY`18CU}p zRQpmg{U)#UJ3VpLlO;PoSU4JgITUQ-zFRaojANdJZnGhqq#W0zr7Ny0xK;MIDK{#3 l1Zp@W7$`13u(b1mjK%uP?>%QPGQ0Njb2X3a^JZrTYXE?4TCV^A literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/workwithfilterpools.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/workwithfilterpools.gif new file mode 100644 index 0000000000000000000000000000000000000000..5a6564319b5fbf8a421fd8a0f4b109edf6b7189d GIT binary patch literal 217 zcmV;~04D!ONk%w1VGsZi0K@*nI-;@{1{xW&1$zO${uwy?pqulM!z zys@mp!NLFk{{R30A^8LW0015UEC2ui01yBW000G6peK%GNp@#?q9WU}U6&;AJG=4d zdb!SLbsEYBQn_|GmI>j2IG|!^9{M0C1kR3zqSyhn T&x<&HU=W-cd30!JgCPJrK&W>O literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/workwithnamedtypes.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/workwithnamedtypes.gif new file mode 100644 index 0000000000000000000000000000000000000000..3541e3da38311a1dbbe7c38be05a0b71aa41bcc1 GIT binary patch literal 217 zcmZ?wbhEHb6krfwIKsftIb&k~+-X;DUEhCf|BKfzp1yc`{OqxFm(N_ee(}xA#}|(8 zyl`yi`J+4EymB=ML>ScWCF?13UI_S@-z<-8~!E>{_>K_xja` z4j%mf|33o~Q2fcl$iN`YpaT*E*~!2f_CT#KB{OT*$}EA&tCoD*@nJ=1@z+DQOyhS? zO(M)R+jv@88&)XIna+7p$fAPZuj|@H4-O8N=7(2Z67Rh~bRZ-6hOy7R RB!B%(rG{EVUlm0LYXEHKZ+QR! literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/workwithuseractions.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/workwithuseractions.gif new file mode 100644 index 0000000000000000000000000000000000000000..f485bbe5b1a97a0bd1a4d446d45ec97e2ab8219c GIT binary patch literal 207 zcmZ?wbhEHb6krfwIKsfNb=!_xx9^@kcj3Un!|T>>xNv;ug=0I{_?#(7}WM|Nmzo8Yuo`VPs$sWY7WW0NKgF>XV?-my+o;VWrc_ ziK|pvc6{J4E&hCHg0b~(kAM|3M4OyD7NtrYlRE1BaHF%8nAzEtJZE_xn|SV>$h*-zJKk;oev*Bzk2=l`HNSJmaVya|IvX%N4|Xh_Wr}ix9{G! zP3@bxbpH9Pm+n8hd*%AYckkbxI(hWYjq^9JoxgPM*tHACo;|*I=-|OWfByXc|DS;x zK=CIFBLjm5gAT|rke?XXN*$&Yc+2H!$g&(DX3#ggp@CHyXV3TnKiD$X_-uo z2OjeLERmXcQSD@vVo|zEtJZE_xn|SV>$h*-zJKk;oev*Bzk2=l`HNSJmaVya|IvX%N4|Xh_Wr}ix9{G! zP3@bxbpH9Pm+n8hd*%AYckkbxI(hWYjq^9JoxgPM*tHACo;|*I=-|OWfByXc|DS;x zK=CIFBLjm5gAT|rke?XX${nT@c+2H!$g&(DX3#ggp@CHyXV3TnKiD$X_-uo z2OjeLERmXcQSD@vVo|n$Bm(RX=`S{a^H&55)Q2fcl$iN`YpaT*E*~!3~{6MWQ#WQV1W?IzjmC0=iT`dbUXUf*x->=?YV8L=s zXex_Pn$Bm(RX=`S{a^H&55)Q2fcl$iN`YpaT*E*~!3~`arEOB{MIwYTC?aX{%=_b|@vTJSA6i|L~HYWDgZ4 z_n9uL3sb_h+;66M&DC49;`HN1PxCg;>`2Y&bWspUP&1H7VPI=e6_4c)Xj`#B&OwyH biixFEgO`^_gsH1Zt;C@zLc3a8k--`O=Fe~_ literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/new.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/new.gif new file mode 100644 index 0000000000000000000000000000000000000000..f656481e0de3c071578e1c2d323e2f544bc3c3c4 GIT binary patch literal 354 zcmV-o0iFIwNk%w1VGsZi0M!5hy1&K7%Fn2-w5P4JuC%(TueIgp>H7Qp`TG0#`TE)3 z;^OA%&ehuE=IF=I)Wgit#m>|B`TFwo_44)h@bvZh`}_F%`u+a?{Qdp={QUa+`}z9% z{Qdm<{QLL!^Y-@g_4V=k`uF+y_W1bq_xJSs`}z9%`1$$w`1tnw`}*|r?(_2P^YZSn zte&i>o2aCh=HuDn-O}LP(c<3I=;hq#<=v#8lc=MYYmVO%hYP>9uNmZv5>e} zEEQ{&)Cmd$0wB;Zyk51Nl|rviEE}85HjnuIcp4}%Abk-DhzS}UCNUp#2nh(2iYX^E zBXb88n+FFPB_25^a~Y7TY>_Tf{9b{^RA@#C9czkYoF^!DwW7aP{h zTfKbFgF6>rJiWVO@$^Fn4?ceU`2YX^3`7IPpDc_F41x?gARQn(8CcyDRQggf=bi7A zTWMu?YT=e=$?6_`7oG?^G`Jo<_?k6{-|ga!D5Kc*jU}0@`M6pREy(Kr!Ia>5FhHQ; UpvO83?FT_SFYK5j!o*+=0L{Ws#sB~S literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/newfile_wiz.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/newfile_wiz.gif new file mode 100644 index 0000000000000000000000000000000000000000..8c682c0d49606423eed20baa8815289c0defe381 GIT binary patch literal 219 zcmZ?wbhEHb6krfwIKsg2=g;5YzyJLD_50_~U!OjI{rKt2hmW7X|M>a!+xIVDzy134 zzHx!b1_eeC`m>evz`>$l^6o{KaezwopOdMi zn5d(d@$c&3-r2&z!T19s+@-@O&z`$- z{oRL;zkdDr{ORq6HS<<1nZ9uD#0PgSzIb|f$^6MH7EeEP@ZkUd{~2%t#h)yU3=Con zIv^z=I~iEL7O3{6c!nv@nl*J*l<4Pe#~XL?J>Ii{+uY$n&({e76>C+_7<7I}U~+n} pEW%-)sKb}G6-n%@2X!wVRm*>V>2k@Zjn!LkTR)x0e^Zgc8UQ{;VJiRt literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/newfilterpoolref_wiz.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/newfilterpoolref_wiz.gif new file mode 100644 index 0000000000000000000000000000000000000000..089f1c5980aef2c8046a489bcdfa2862db81d403 GIT binary patch literal 220 zcmV<203-iLNk%w1VGsZi0K@gVgr#m?Z|;_d71)6Uk})!gUh>GbsVgollaj+55d z+Vk}F^7Hh_&eFrl&Cb-ktZpRObQFU}(O;QQ2TZeFnfl>8L_GiEx<5BXu}v^wrEkxGC$G$K&?I WMV$j8f{@&O2n!5?e`IARApkqpY=QIu literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/newfolder_wiz.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/newfolder_wiz.gif new file mode 100644 index 0000000000000000000000000000000000000000..da261845f18d41b4301a6b0add98ecdbb25647ed GIT binary patch literal 225 zcmZ?wbhEHb6krfwIKsg2>(`Grub+JW^!C%oHyhT>d;0j!n^%uty?D4{$@GPDCqB4y z@#V97FP`50@b1Nu`IA>Hp8n|Gl?S&kJbQHW;l1m>ety4q`Kpaaj-Ner^z`-}yI#G1d-2kh^A|3y zTDNt@n$62rZQOI<*zWyDZ{K}z>(2d)S8kj+e|g`b<7Y2kJ#ps3j$M1+y!-I%#jB^! zU*3QCc*V+9A3lD1`t14RCr|G`czEyrgBv$*UB7Yj%GGNpPM&)B_|eu~+dqE#`0Lk? z&!66ISTk?UirFicOkX&6;)6REUp&3LWd7t8i>KeddF9Z-ga7~kfAi)IkYpG-K=CIF zBLjmQgAT~apg3V*pVi>z+}zUa*6!Tip|8){=i1q1F|o&~N5%8MhanVD8!5RPryyBt& literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/rmotejar_expt.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/rmotejar_expt.gif new file mode 100644 index 0000000000000000000000000000000000000000..b09005c5469f511872efefd0d6a43fb7079f66bb GIT binary patch literal 331 zcmZ?wbhEHb6krfwxXQrr`}dz;zkdJx`Rm}JqaQzgdH>~Ni`~KtWx9?xQdH3@5+ZV6iJb(H6+xH(|zkPrE?*03ZpWeKCKV#OcKY#x| zeDvt%t((7o{rK?V-G>kFzkc~}?aJ8)cP>7Cbo1@&r(eH(T)Se?{1)F%gJFI%y4b@p0E25SH&aHH-3 literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/rmotejar_impt.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/rmotejar_impt.gif new file mode 100644 index 0000000000000000000000000000000000000000..647f3d8e0b7a0aaf6c156ceaa719db86866d7bc2 GIT binary patch literal 332 zcmZ?wbhEHb6krfwxXQrr`}dz;zkdJx`Rm}JqaQzgdH>{r3H$mT3-@SkT@za}k?`O=K_2=*3hmRiJ zymj-}uOA;iy!-Is{nsxau3b6%;LgRTk8Zww{q*aXk84-Vxpw*Np@Rqi|NsBz&!6AF zfB*XR3&>`m04V-sVPs&?X3znd0rC?ATjqhO1s*zlz9*JU%(&Izq;UC@$Erz7f`cCw z9Fh@=Sj@@ju#%~x;3CV!B`m@nvvz6-aI|?v2&NhT;}vA~(B=}4P?Hqn;}?-+mRIGP kEbgQxB_}JREalZ!>)GO56TGx|*>Z0WuBGm3lN}kX0k_|uNdN!< literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/rmtarchv_exp.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/rmtarchv_exp.gif new file mode 100644 index 0000000000000000000000000000000000000000..4668049eebe9c6d9dd44c592a7967c71eba20981 GIT binary patch literal 221 zcmV<303!cKNk%w1VGsZi0K@2G?B?g`#K+8?p{J*- zv7)A|-r(cM%Fdsrt>Wb7@bU8P?(dkIny9CtrKF(J(8|!x$hEPj+}O|7)6MVh?B?U% z!ok7({QUp_{{R30A^8LW0015UEC2ui01yBW000GApeK%GX>w?4lANGzn82+f2N9eC z%rqCxoC|NoF#tQAVTp49779w%12~~XM;r!jk+@<94FrmY4JaK~PGCLuI3y{Dqh_&G XGIF`ZgPQYGJa0U0D`+faBOw4gb+2!| literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/rmtarchv_imp.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/rmtarchv_imp.gif new file mode 100644 index 0000000000000000000000000000000000000000..49851c4c336e7476ed77a46aa15949ca7e528f2b GIT binary patch literal 218 zcmV<0044uNNk%w1VGsZi0K@2G?B?g`#K+8?p{J*- zv7)A|-r(cM%Fdsrt>Wb7@bU8P?(dkIny9CtrKF(J(8|!x$hEPj+}O|7)6MVh?B?U% z!ok7({QUp_{{R30A^8LW0015UEC2ui01yBW000G7peK%GDRO9PlANGzn82+kL~sf) z(_A!jm)(kE_;otM66f$M6q2mRZ$g2NIE>pOVZ9C-2o&uaNII;XfLiQvNYEBbCF7{O Uucy?`y<@M=c@AS&9CaZ8J86b?$p8QV literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/rmtexp.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/rmtexp.gif new file mode 100644 index 0000000000000000000000000000000000000000..263f72181009bba7962fdd51bb3a311defbccc45 GIT binary patch literal 130 zcmZ?wbhEHb6krfw*v!Ci@X*ou%ht}AHS6q|V`okuy>{j7r3{j7r3Azx~R6-rXPBPS_E6ll9D8VXpNAFZq Y7k9SWDgVQ_YnbLJZ#ulhg@M5u03a$eod5s; literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/systemshowintable.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/systemshowintable.gif new file mode 100644 index 0000000000000000000000000000000000000000..6550bc12797d1d1d5779529b707e00aa866236ea GIT binary patch literal 338 zcmZ?wbhEHb6krfwxXQrr=g;5u8#e#^_4~)qU*CWH+_-7;_n*JMe*f|L+xPdMzx?_8 z_xGPaTefc5wr$JqU7L69+_H1W<{jHNpFXsl(%Dm&&YpJY;K9Ft|Nj5~pMgq1@h1x- z1A{t)4#+%^pBUKk4@@rb(2?ptI;rSn44?OGKKIE7W3;ApF8QJ|(Pgo~i_aft>^u~d z^fp5MR`wUqTmy?&WqbB~X|VZMD^SN@&B4qf#=^`j*u~t+#KhY@X-YNEjG41|s@b_2 eSh={kSs511Ra0YJxoShmhbqaZ-0IJ^!vxxKfiwb`}^na$!!lV9Q^wB z*~gcUzP)|+_097iAK!j^^Zf76@BjY%{`>papPxVe{rU6%-@pH0z%X=x;!hSv1_n0< z9gvejal*h}*WlLF+|t_C#M{}`-r?HU&)dW0;@~V`=E~L1XJ%?@@8rtgBkX9r+*p*m zoyW=6NXb@&r-#GD#@fzOnxmalSyNF#QiijKO-rkP#C*lC&X!LwxVz&)al#c-qnqcDm}#WIy(BLW0V%N5`2M zYBi)fD)t0U*`nI(nzTRThYA-TS95cdU1Kv3A5Uwk5NlIM^h7?h?zV>Mb~Eg!3Nly& E026Ie7ytkO literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/clearselected.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/clearselected.gif new file mode 100644 index 0000000000000000000000000000000000000000..2cd9c544436c47a57f20b348b3fb024bb50701a7 GIT binary patch literal 163 zcmZ?wbhEHb6krfw*v!DNV#SID3l_|nF=N7n2^}3B4Gj$y6%_>q1sNF`2?+`R|Nmz| z1&Tje7#SG27<53wATtBYuHJj2L#xNM)vQ#JRl<>hDKU#-N&yE`p}?0M(Gw4T zcQCOfDoF5h^e6?|s2Q}nBw9^by`v;FMPUw>>OdR!By_-4-WNuM5^ zw;(uwK~V1eu!4onvkray`X{1vX=>xTw5Ii~a}IYcIJ)!1!-MA@pSt?&&hzh=?!0>V z{Qa#*Z>mfDPaWUcUgh0Z<pTqNtJh@V-bN0Y&dRcbQrt6aYM znIuhOYzQ%0EAdf-xzcU<`;)GJ7%SIBM#sjBF>-UTvnC{^sJioritzKsXJ}=ysX1|R q`4wsvODbv2nd4klqadpoD%{%6&J@QuVbYYiC3APoUh3k=U=09tj(wp3 literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/compile.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/compile.gif new file mode 100644 index 0000000000000000000000000000000000000000..c88993a295131e9977d91da823e82a61e2b81a8b GIT binary patch literal 366 zcmV-!0g?VkNk%w1VGsZi0M!5h^!EJt`TWSv-SzkU^!EF&x5;OHscL|$^7Z@n`26|$ z{P_9%ZG)|JinDWxvU-oVfR(#}mb;3c!jYb}@ALW>GF^w9z>T8Bk)_A7z0cn0`1AJr z-stz`?fL5P`SiF#P`t~m4QdGk3Oo4K&6R7q=-VGhD6}VkF=0Iu8cpfjX%_~Xw40dL@y$bkdZD#FdhXJ z6CM*40+yIVEG3*3B?6qHrb8+nqaCIKtf@jPB%>s+wX!}bA)6B+uf3l_CmhDd#~K+# MD9z5#%|bx{J80m%djJ3c literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/convertarchive_tsk.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/convertarchive_tsk.gif new file mode 100644 index 0000000000000000000000000000000000000000..caeae140aa567f3d36866762066fb1eb72fc6cf5 GIT binary patch literal 359 zcmZ?wbhEHb6krfwxXQrr_wT=DTd$e~bUMULTC@G^&tHFRB6?gCr}$>h@kyT^oVOr2 ze?d_0{IG(B&9e@D{Q4)NbZKhiy0oVCt#b}{EjYUK#KVK<9-q4U?9TJ=m+riJ`278? zM{lZ2{7)U<**$l)BgVa z#CJE>zq^0n{pI=Z9-nJTG0*Ta4zV!!|NlP&5kT=L3nK%AF@p|BEyzy{Y%K?77I^4z zF;7~elAz+Hq%ke)rihmbBS(_LigPNnkDYP(=4JFKkTIZZXY$g8Pn5(G<=(B}%G=su zs~~Hrp{k~7U>GLK$i>daVyJJBoNCO-Eh5avV{E89S%sBV-HDUa#ZYH*nS`S8vSrSO gdXwd4wuc&Ox3+hN<{BK_7iVM?=W_I@iz9&O`TP%)RT#Ymxal*jEjez Yhq=$4gQt{_hqIk~!P2QKoE#af0XOU{n{QGiwL#M*} zPK9j~lz-oC{&TL$6>&2p=nlc9) literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/editfilter.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/editfilter.gif new file mode 100644 index 0000000000000000000000000000000000000000..b8eaf34c8f268e49dd4587aba1285a8cf939a35c GIT binary patch literal 337 zcmZ?wbhEHb6krfwxXQp_;S!r)))JmlQ{FO5$vHi>c1ld^(va@WzEQFN{=UC`dExFY zU4K6v`}ga`-;c-semws7)A2vg=KcHmVsDGshZ`%lR15EF5Z%=%y0by_<&nC_XBIv@ zwebFl1>c^XSeY-lzEo&^sqnfI;mI}OQ|e>yA760)_`+q`0+TBO`!g;2GA;UZ?D})< zCKNbNC~%on;?8_vakpV@bL5T yiMpz)$jGQD$_olAB)Z56%K0)nXQ-(qGIGTGva_)=u3j3oc&Wj8pCDuiSs?Zes1K-WjW&y!@Ebu%dUy%41hv9KZ77 z?9EpP&)j+W@$a)YUsD@bWVbBebolncvv<$kdUf^w+pG8AWVJ3Y=vaF8)~mZu-#>Z% z<^1Ivuikym?^wF?=;bG`K9=?@DeYPO;p?yWpT1U2SX@0}(Y@E-X3Sgs{_C&%Z@zu_ z`m=uW!h3JN-GB3S`n<)>(-wUG{r|(apP#>eYneX(>gWH@fBb*{?Ptf#`Jey%@0dAn z`{84S&23$?=WX1(|MtWCOP9@Bx@_j=^%J(NpRj*h$G^Y7o}8ci|Nno6p#v0uvM@3* zxH0H}oD7N+2KLnrZcWWCtxeK4HrBR1w$`1}EjC70F4Lx48QHX$E8A#jDH)n6*(h7K z7|Ymbs%dKK=-SBWw`jB3xbE6*Bd^_}Dk<1`#70n3rA0whMD(1<*$av-vceJ)>^IrD zg}KFB1h_ca8J@bbb8?Bb@bmHU@P4%8c_-AuBIW$+_n+Txa?DK^Bs?}K@G3UfU088& k!$N0;X1@yu7@66Qc1gtY2puqFXkw7zW)X-~5MZzd0Bz*jF#rGn literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/exportshelloutput.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/exportshelloutput.gif new file mode 100644 index 0000000000000000000000000000000000000000..dae1880fcc0aa97f624506ecd592cf382b755ddd GIT binary patch literal 613 zcmZ?wbhEHb6krfwc*el+{@oWF7yRp@)W2;xiRj*2{T~*bydcxvEyH7uP z^73O!!-}xX*7%~ns-6`S7VkfC=hw+QKM$OLcI?WF<5ylBJagye$G@qKE3#Xbhh;X! z7j;+lES<1;&!)q-cb|E3;KH+Ww_aVn|Mu$rH)n6Xy8HC~`O7!nefs|D-RJy{r8|#a zF6~+J;p?yWpT1U4Sak38xA$Lv-GB4#)A!#WzW%JAyzuPRn;*XY{QUJ>%k=s0zy0i( zIlp7(yzPgN6*jkZ&7QY$@BRzdZ~XjO@$+ZZ&!5dde@^`QbJEYBi+}#y`t#?JpFhw4 z`0?P!hk_q3EPgzY`0*m(!2yj68w~#a{k5P%V(SEp6&)5&&d>ew=El}uv#ovRTl>wo zcAIYPG2Pl`Ff&>4KNv937%2W^VPs&4XV3xJ1Bw#{_CpQvP0cN>O=@;_w)Q>tww-D% zcIGyL)27>)+qGEf+8G$@m|5!B=~}l~XxJI*8yXrJIWU>Fm~h*L?g|SF-nTzEUQbo7 z)6OBt>(uFpcx`1RWo7lCxLD5{HzMOT6;)Jtc*KG{I63%uJ%GX;Re;)S#c{1zIvw44>&HwXk!P5ulH+Cy-=~q5D&th4p#qlMs zJ7&7v*qi&|df&|>?N2XGeRyg4o%3rdqJ@{&$*gOWU)?N!bVKc>15*yIDn7Zb^V;c6 zH!tjYasTw&XV*W!efS>?7)Sw%KUo+V7z`M6K$<{)VqnX2m{H)NBgN>kSjd3k0M7*` zM*$6`xu=rLH235shA%6Q5?y96Bg{O~B{N3vZ072smbmp(7e7*+<)*2orm3uxWRPMY yF2F0t!7i*&>nz62B`M7*A{ME_Bd??+FQgKwDk~@>Bgn5BS+Bftqnei^gEasig^No7 literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/makeProfileActive.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/makeProfileActive.gif new file mode 100644 index 0000000000000000000000000000000000000000..da0f78267262fc1fe2a411c5573e751b24815c3f GIT binary patch literal 608 zcmZ?wbhEHb6krfwc*ekR)G2e#x~-Khi%y@ved5%Gn)W4KQ`XeAPOGeKKY8xfg)8?? zpTD_smEIQRXP30)YYet zU3s~E@3AANE_basGkL?MJ!kG8JbG&Gj%ye1z1?v1_U04!HXXbD=;@26?_SB(I2X-t zwwfD#>&2ZzH;$}1weHr7+qYlb{_yR?v6Bb4Y+v>N@$&y4F8sgN^8b3v|2tFuKU(qs z<(~f^F8=@av`>ILFTKfB6l;*iFAmrntY@#Xi_^v7&8<&u` ztCFdNq@VXIK|v8AFE2F-ai1^2>JAP}oSr@{Gd40cb1J>!5|L0~e;hrPoF-0^5n^b2M_MwzkmDo?JHNVT)K4W{Q2|e&Ye4Z_Ux%sr%s+cdE&&0964~{!2bRF_wC!ackkXkd-m+!y?fiXZCkf)-LhrNrcIkRZrr$G!-jS1 z)~#K;cFmeKD^{#nzI^%O#fzs+n>Kao)X9@4_xJa=x3{;owY9dkwzRa=*Vot8)z#M4 z*3{HgS65e7R#sG0l$Vzm7Z(>573JpUW@l$-Wo2b%W=2ItMMg$OL_~y#hX(}(1qKHG z|Noz15Cg@ZEQ|~c-V8b*H-h4Xf&F5GcT;mqYmbhh$rmhnTqdWG(jz-fj}A zswyfL9y8svEtgqY&ahs+x~bF6T~SeqhsRz@TGF0pmV$u+uZ^vZu#2;`v$Ke|yPku+ zm>m}v=jCg5v(_uxGBJwi%egWz+Io9vsH^kavND^>o651UJayADG!(RBV>6NUH0P69 zvE8YShx3w9KtNHm6BEnR2`e@vE^gvy6UhphF`?y9Q-@~Sg#{N5H}-_DCSl_UmBxTPmqihFRUEQvSJ?X<7_0%s>feO` literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/monitor_view.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/monitor_view.gif new file mode 100644 index 0000000000000000000000000000000000000000..e3ecc5535cd4d72cbb9cce9843f054714992babe GIT binary patch literal 572 zcmZ?wbhEHb6krfwc*el+^XH!*KmY#t`6sb(R%Yd*uiyWqS1ibDSW(=%wxVle!=#$il~ZV0ViA6l~}v}$E&<+9MqrP=*^t7qTaBgaDX>Dt7 zvr_Nw=~cIC*5H{uWh#$GvnH?8oVjy(HJi1BoE(`LnB*9l7zMPObp@UHxj9&v9n@F_ zb(-~son#LkJ|wKyEHAN{pNo^7jagj8pxIE;Nyg4j=BA9jsA02_l9MW*m>AzHF)5>F x6J=!;Woa8_TkDU;&6cMB{wrj$teN;Ypie+CN5rIp+1ID6%Z_^IE%GT?>|3zJw_tH>-G;dO^(n2}Qd+mBwr)#p z-I~?4E311~cGs@_zP+*a>$AFd{{R1lmA;hBzJrx) zPOJJF6qwgbupEx<58&M)#M;%CbyGqwEXd73L5cr3lhXv<$-Ua1>Rt;PmLEPRrcn^D N^E$$E+gv9GYXGc?K1%=q literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/removeshell.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/removeshell.gif new file mode 100644 index 0000000000000000000000000000000000000000..6f6296256e4f6eae3cf6cdd6a60aabdfcef2cb0b GIT binary patch literal 580 zcmZ?wbhEHb6krfwc*el+EI034ckiF`7oIC=KhrXLZsqXI+2gpI*N5cv7cK2~>zlu> zTKinX=!L$;D=X(0PF|lvVt?)4_gqH%g|gvsE%P&aR%c8cPn$Y^U9#%+y3MD}U0gww3>}+dmYiVg|Y;3HrudlAIuB@!AsHi9{EiEZ2 zDK0K9Dk>^0EX>c(&&|!v%*_1%|3AYJ1d2ad7#SFx8FWBy2gL~k`@#n2re)^6g;F5E@f~;-J7J;V^*%!*oeae&(;b5=^ E0IO1-NdN!< literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/rename.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/rename.gif new file mode 100644 index 0000000000000000000000000000000000000000..aeccbfd8c143b83c3ade695cb69fbf1cf969fc17 GIT binary patch literal 346 zcmZ?wbhEHb6krfwxXQrLF?HRyAAfphtlo9}{=3h=zyA2^owq2ZWoz%u)em3&c=+o3 zi}ybtzW(w43sCCMgV#TvzyJCE%dZEozrXwPd+FhaQ|B)I`t$F%pMO@Je7gD4tFJ%* z?7jWr_|xylpME?4_V?A#|K~5BH-FK*6)R_~STSScx`{hCcW(lcn|k(d>-hiwKLf=; z@h1x-1A``m4#*^spBUK64@@cW(Bb24KX@=9$7r^nhM=oy!1{=+S1t!7%w+q2IIB$$ zQt3IgAVKAx(8~V5rum%9~ij#r> literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/run.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/run.gif new file mode 100644 index 0000000000000000000000000000000000000000..57f410224cf0e125fefdfbfd424b34ca32650ac4 GIT binary patch literal 379 zcmZ?wbhEHb6krfwxXQqw(BP;BL>-Qf6T{aP*iM?lCLeYNChZ zME|t4Kq*J#ax2FU508od{@|VOltj+J(UOww!N5}U3iQCI3ZqHwGu%qFO+M$;f|G|KP zbfEZ?g^__lk3k2d733!dwiyo73p{kh9NV1~0xTMO)-@+?HCpL1C+*_|jkQs$L%3SK zWZD#%Uw+AK^#3sVq2$yax7_cq>g;#(C^lABHOjI%u}OEy<@M@F%Q8AK@K5dOm7mJO z;KV30f4Z*Rd;#G}fjokO)8$r)3o+Lza0p5E$no(>iVJg;1ab?@$%#scNeOe;IkR(c Y3G?y_b8(z@@nG_1@(Z}@>d0UX09ibCp#T5? literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/searchremoveall.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/searchremoveall.gif new file mode 100644 index 0000000000000000000000000000000000000000..28a3785aaca7c24373e69a73b2307fdb4331b725 GIT binary patch literal 204 zcmZ?wbhEHb6krfw*v!Dt(a|trLdS{~3vS%Fv0=l86+qU41v6&Mm;e+7$~81pR8$lc z6l7#%BqSvK|Nmd{CkrD313!Zf0}z1BU|^~IuvcM;=)qeJFP_d6<6(9$NpZ+va*#XV z$Tanv0@q6Ij$F;fM->-rkP#C*lC&X!LwxVz&)al#c-qnqcDm}#WIy(BLW0V%N5`2M zYBi)fD)t0U*`nI(nzTRThYA-TS95cdU1Kv3A5Uwk5NlIM^h7?h?zV>Mb~Eg!3Nly& E026Ie7ytkO literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/searchremoveselected.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/searchremoveselected.gif new file mode 100644 index 0000000000000000000000000000000000000000..2cd9c544436c47a57f20b348b3fb024bb50701a7 GIT binary patch literal 163 zcmZ?wbhEHb6krfw*v!DNV#SID3l_|nF=N7n2^}3B4Gj$y6%_>q1sNF`2?+`R|Nmz| z1&Tje7#SG27<53wATtBYuHJj2L#xNM)vQ#JRl<>hDKU#-N&yE`p}?0M(Gw4T zcQCOfDoF5h^e6?|s2Q}nBw9^hZ;QjxV`$ar2|~4QF>xx?1nJH^pSN zM$$C1oVk{H^Bjs7c~`Fps9zPI|HkTbk51lyeeTiQn=e1zeEIRium5j;{=fS9|Bt`_U;h06 z;rIV9fBtVidiwRR|6l+92Lc9CfZ|UUMg|501|5(lke?XXavf$Ac<4y=yE-^cWH=Bt z*ME7a4-Z!x%Nk~-Rx8)m1c!hFc8gtK2J^}Y-0JJtd_!gW+2?HwqZGRN)b;A>o%q$X zwOi^1b@X*~y4{5}H8n&8c>;-QIrqj&I&7pUim?W$RO$wx>01&*|A;(0`z0 z(xKWJ$C~DxxN`qv<@6&{SD!w1aq+#T00-g~>@=1k|qzYhIh!y(zJ0Q|82N*^_rX0;Gx6Cd}7HZi4B(X&oNwnX`vuEfLTt*(6G*z(^OJOm`TCN#K@?~%acJ#UtdpIUdGK?RZmJv ebFquMl%8VUsv>PEl~t~KY8$qhYh*bxSOWn2ADo2% literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/stop.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/stop.gif new file mode 100644 index 0000000000000000000000000000000000000000..8583717aa0aa2d294c883c17e702330c06bf4062 GIT binary patch literal 215 zcmZ?wbhEHb6krfwIKsfNG`^ zjsprYGk8NLi$zRj4VuUnG?6!S3PZqziXA)t|NqZG2q^w!VPs$sVbB371lh^J8ls@u zmy$UzBTCKn^)AmyhLTuuRU?iXeV&#}iO(PN@~IwGIFQ4})+MBzxFU*|)9vKMh>HE) nEsL)#h+Ez1!MUl#h`oPOio^Qrs!Kal&Oi4LX=qeZWUvMRo8U$l literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/systemprofile.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/systemprofile.gif new file mode 100644 index 0000000000000000000000000000000000000000..c09179981a94e6774cd7d79f9b515907575c95c0 GIT binary patch literal 367 zcmZ?wbhEHb6krfwxXQqA)G2e#x~-Khi%y@ved5%Gn)W4KQ`XeAPOGeKKY8xfg)8?~ zZalnx>*4KtPpw?D`R;?~EfZGObj+`;>o|A$u3P#NudL<1d8>Rf=S7sQPi@+s*0kLx zvheVUi#a{}3;GX~OgdCM<5<(26REjXOV;hba{uGJCF>qNeN{RA$kf%Rk6n4Weeba& zr!IG`I5T;}r9EfvA3S<$?v860@4ek{^!DZx_ck57{q)_dqWR6oP9EH{ebs+3U_b?m zKUo+V7_1m{K*AtDF|hSG%q{TH;mV)ARO-UGyZM_Hjnu_ErIp#(xSAD=#U&;y z3kV1|tB8wrSk_NrV&be)kvG&7?^vnK%F0|NXR2qQA-W=rT}es5O4igwM_1&aMPuZ~|9k)Q|Mx%t-~asg z`|rQ|U;n@U@$br~f0sZ0z4!J1I)+!7lcX83znW6AUnrbZnn4lEKm7a?h60^|7RG)K=CIF zBLjmsgAT}zpg3V*pVi>q)ZEhA*52yn>EZ6?>f-F^U~gyJ>|||YWnpP$*krD- z88&P4aBxU-adAjJ9nemrivxmou4Gave%?w&H VCWb3o4z~-)E6wuw7@)vl4FI!YxQqY* literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/up.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/up.gif new file mode 100644 index 0000000000000000000000000000000000000000..4d6db172e6f64e05cfab005012dab3b9634ab156 GIT binary patch literal 320 zcmZ?wbhEHb6krfwxXQrr@9+D6zn=X4cJ<${r+>d*`SW-}{dqd~_mjE5pU(aJYW<&A>;Jym@aNTr z^&JZ9I~6u|D{k&n+T5qSW3uY+yUl+d^sQ}^U(+hTwoT#x|Njis1ByRc7#SGU7<52J zg8an57V9v%z(Yr>Rp7)$4n~G4-YE+OBpmuDv^XqK5LoAOBC*Fn;#h*P%jAP8H)eUu zoXN0In%dR+Dd9)If|9V1l0u*ww_=wfce`A-qI|pT1le}!2{O}XwyUYCs3^~!>&RdY E08MUrI{*Lx literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/workwithcompilecmds.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/workwithcompilecmds.gif new file mode 100644 index 0000000000000000000000000000000000000000..9f48bb796cbf784cd923035d63812866b04f4ada GIT binary patch literal 332 zcmZ?wbhEHb6krfwxXQqA;@sW!+fUwq^m5|7t(R{+6gP^!e}Dh|{q_GJZ~ndB;rDvS z-y0nN-rxLViQ|u@K;-o2_U4~U9Dgox`Zf!QoWIU;{(Wup=LycACpv$b=<<1@%cm}v z`}OuWD(uha+aFD{-yd)PbpNLR|Nk@41}OeyVPs%XV$cB@5AqWOTc*Rr0uLQ2ONGUg zf-?)I9OYBJ)X2vx*L5U$Ll>X?smH}1iu8n!D`mb-n8meCs9I3nAy(DGc;cGV-qKQH z0z4f4ZVFwBOsp&lEUXMljI7MAlUS7)CMnIFF=zJN`7ZP4OkU#5JZ;hB)y$3z)&MJN BZYKZ$ literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/workwithfilterpools.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/workwithfilterpools.gif new file mode 100644 index 0000000000000000000000000000000000000000..c0df17ecec8032d3503dc4addd8510042d98aa72 GIT binary patch literal 353 zcmZ?wbhEHb6krfwxXQqAWAF22MaMQYp4l_$>hZ;QjxV`$ar2|~4QF>xx?1nJH^pRi zep!okK%QN6wPR+#V^+Ume49(fVny$q%Jt`3wqI`DetFXV8w-x#TX6jD>T{1aA3g0G z6?^~w{`>pue=T$TdwcV@*-qc)IRAbB@Y`(XFB6@AU*7WT@|I6sF8Ay0-=Excz1;p% zk^PxG`=e?0`{V7O?%#AU*5&{I{|rO}#h)yU3=D=0Iv^b&KQXY?9hgzzp(7;ja%|&{ z8$8nP={*l4Oj`LBuWI$iwoZH@l=ej`P%&iZiNMydIbSy%W?E?VNrK%~s`5&athSnx zykz*%Ljf^yNdZ?bCT12cLm^Qy2_aWbMs|*c U0>UC<%U${=Oqw!H%8|hu0MNsSEC2ui literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/workwithnamedtypes.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/workwithnamedtypes.gif new file mode 100644 index 0000000000000000000000000000000000000000..5219514570ab82a0e6f620f4f20102a690691de3 GIT binary patch literal 345 zcmZ?wbhEHb6krfwxXQr5+~C38;>+FaBheKs(G{XLA$rB-y{6NXo#te1zJAzgPG;SX zx-*YYUw(dJ^1-ev&o3-HGj;iysmo4J-EwK}{rmgx@2~&2!{Ptq&A-<>{9f<)dxPWO z`fD_P46+Z&cV{F1A0PZ+|-5{%D&0;S~G*@%B&mZ~FiLKLZY+_>+Z^fx(f!PHfI#SW5i#L_N+A`(nbj>eKe42)nHQYAd(=xuC9`BGGh@E6cA!|*45EgQIHmA)2GL2bFi~A dbGot@EYjv?VPoW)#mmgZz%z?)(=1{q8>(!56e(QKN8T++%PF?f!*B_h6KG(!4KIzkg^A-f> zF9^z=ACx;UIB$M%?!54##bE^tBTJUVRxD4dT@zQfc<-r)0l9MnbLR%<&krqJ7+$<6 zs(e{w>5{0jr7;!D6KdDQ*Q}1KTA5J0I=*^UV(psb`n9Qz>(ZLmFWq@_+0L75_uuK9 zwr1Vl40N%qHsQ?qX-ZwMp1e&fCe9$zsdFLrpRU zLf+QqqPC7VZ`pXuiV1j|89lan>fmt4TUuApTjxFNdz%-{Qre7Md|VtX4Bk&$m~=cA jK4Lw{Go6Pu=1}Po+p}!z)sJ6(>v%L7`?YpXUGwwTADhTN*TgA4>C=Pr z76j)n2+ExwlshjtZ+>v@yzrvMVFe2#OP0h|EKjOk6IZr)@2Q6YxpM<^=LYA`4=r36 zUc4x(d|71alBlw!F%`=bYS+Zqtd6T%nNYhrzIs(+?V9BJwW*Ek(wf#U-Fb7_&YNrZ z-|3vTX6w=Ww;sM-w(I7Ri%(8pdw%En_se%)J$Uy1!zn{JS`1<|l zISUuCHhRuJyG?g;+{3pwwp^Nf^4^YR%V%s@H)-SANjo?9JUG#RYj4fR!`bi8w730=qoQ{XZKiXZ{MP7qTu7gF6QpxYVWYMNyJFr$Jvb8a?8O( zO|pizA}zH>1_o;YZCS=H literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/etool16/archive_export.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/etool16/archive_export.gif new file mode 100644 index 0000000000000000000000000000000000000000..f08164b673a96d956cc3d06107df432d52bd5b08 GIT binary patch literal 343 zcmZ?wbhEHb6krfwxXQq=Z0l8huSS!APKTID9aGokm$m%-^~WZn$2D<^Z{{4I^y$HQ z3xe|(1m(^TD_Gb(>rh1L($vOvX-(@}=N#@@aCGO1hX>C+K7aN8sjJWKJpZ0s(SGU9 ztB23u-+J^Wy=Ibe!4l(w#SZ1md1GezM#bL0zrVV~zrD)4t;*-*?(X(V?=yS5XEeD@ zZ*sf1zh`B)!|kJeTPE1v+FSGX+4c8l+TYz=|NsAg2E0J=CkrD3gDHa!NEOIW3~VI_ zW)*noNHI=Y!jhokrDSv~=cb641%pSD!isAuvhKWY-@MF{rXLho?PZV@rnb2#`pB|i z&8O=a#5mX);~02Eg!y^noVd8eU07AzdV9rLoLH4r6y=qaoWwP>boJ$=SZA8fnQzLn UZrzMoPKpX~6I~R$og5jg0Uf!AGXMYp literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/etool16/archive_import.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/etool16/archive_import.gif new file mode 100644 index 0000000000000000000000000000000000000000..db388005a8c4eac22bd2e16574790d6ea8f5e011 GIT binary patch literal 342 zcmZ?wbhEHb6krfwxXQq=Z0l8huSS!APKTID9aGokm$m%-^~WZn$2D<^Z{{4I^y$HQ z3xe|(1m(^TD_Gb(>rh1L($vOvX-(@}=N#@@aCGO1hX>C+K7aN8sjJWKJpZ0s(SGU9 ztB23u-+J^Wy=Ibe!4l(w#SZ1md1GezM#bL0zrVV~zrD)4t;*-*?(X(V?=yS5XEeD@ zZ*sf1zh`B)!|kJeTPE1v+FSGX+4c8l+TYz=|NsAg2E0J=CkrD3gDHa!NEOIW3~a>* zW)*noa4}9=!jhokrDSv~=cb641%pSD!isAuvhKWY-@MF{rXLho?PZV@rnb2#`pB|i z&8O=a#5mX);~02Eg!y^noVd8eU07AzdV9rLoLH47xr%FO>FUc#vCec>bYfY#a>gtt UMftdi>*STX*C{9|IWkxS0I4L0UjP6A literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/etool16/export_wiz.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/etool16/export_wiz.gif new file mode 100644 index 0000000000000000000000000000000000000000..130ec819080e39d5d236cf9df177dbbf98e46a7a GIT binary patch literal 356 zcmZ?wbhEHb6krfwxXQrLH*sFa)OGn~E$6S^&#h=rubE_Au*A4vu|xTC-k4dwQL*>$ z??1Go^ViFHM|X7|+}82`>zR|gyZ?VY`0f6*Gkd%Le>n923)4CdcFs+vs}HVSAK<#g)sev(0EFq6=l}o! literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/etool16/import_wiz.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/etool16/import_wiz.gif new file mode 100644 index 0000000000000000000000000000000000000000..d3886945bcc84ba3e49de36af27f2a815c75bdd9 GIT binary patch literal 357 zcmZ?wbhEHb6krfwxXQqA>GF+^sq6B~T5>De(`zOf7c4O@SnN=~oHu5cZ&d94`}+^= z==}9^-qBs12e)!pJ9Uq?>zwY^JK3dos6}UY zt;YUFt-bYHn`+HhHu*m}z4FnimAlIn=C@~0>uviF1`N1?;!hSv1_m<*9gq@`pBUJh z9A+1I=t$+Rc(PGrwPmWeV&}mL4Q`r3nyDtX`w|LPRxAq9NGnk-(pqI8&J$C&b4Ayh zp1Sq#H+1Pr%Sbo1$SCT%8ptd4D#^>s$!R;WvvP14GV(Dpm>BEpxlH3QW8`LZVd7fM kwv3l?qZ1S78fW%p0>WZaEX+(>+%_KGyftvu8b=0e0PY`}uK)l5 literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/etool16/jar_export.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/etool16/jar_export.gif new file mode 100644 index 0000000000000000000000000000000000000000..46301af6864537dfb370442529d73ffe598303a3 GIT binary patch literal 552 zcmZ?wbhEHb6krfwc*el+_1n*msq6B~T0VdMdHunM75g4sc=Y%3!>@fy5BD!Uym;%` zTTj2d{`j+O(zfO~duFdavgP=_t;g@J-E(f!!OIsPemQ^d_2<7ed(Pc> z_U-E9&o`fadG+yUdd;MB_uikr{pR%T*H@o>e(?I+m!JRo7j2ogV#kf=UyTcv7#A#d zC|^Ep#r7MI-|)uFy8if$Z&d8b%U4cbzWnq5{~y18?mM#o)$99j-rl)?fB)~_zyAGw z|M$m@zu&L_dAoDhbhUFk^8Y-Ud1i0-hHk~*cbjh<>AQWj?>`tY3>~2OlZBCi!Hq!& zEgS(!MTId{QLNL5=+RkGz^la_|A?$p+=KYq4oY5x7f%EQ874FD2>&}IMt literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/etool16/jar_import.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/etool16/jar_import.gif new file mode 100644 index 0000000000000000000000000000000000000000..9eb8facddf35ff8d5f26a1853cb136dcd9c3e286 GIT binary patch literal 552 zcmZ?wbhEHb6krfwc*el+_1n*msq6B~T0VdMdHunM75g4sc=Y%3!>@fy5BD!Uym;%` zTTj2d{`j+O(zfO~duFdavgP=_t;g@J-E(f!!OIsPemQ^d_2<7ed(Pc> z_U-E9&o`fadG+yUdd;MB_uikr{pR%T*H@o>e(?I+m!JRo7j2ogV#kf=UyTcv7#A#d zC|^Ep#r7MI-|)uFy8if$Z&d8b%U4cbzWnq5{~y18?mM#o)$99j-rl)?fB)~_zyAGw z|M$m@zu&L_dAoDhbhUFk^8Y-Ud1i0-hHk~*cbjh<>AQWj?>`tY3>~2OlZBCi!Hq!& zcG}vtwb)wP*gM(wwmVLD?3v2K%I0ds#>z64OF+VcK}C>j zDu)=4F|(`~=Tu%PZe?*9b;f2U^JYE;b|q;MMaENZO!^1i_zm?$<#h}gon7RZ&Nc~~ tSeu$znK+z2d)`e*Ra;F}vgN?k&sv{bwKTpp|Iq#ArllFRg@c8`8UQ4((BA+6 literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/etool16/new.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/etool16/new.gif new file mode 100644 index 0000000000000000000000000000000000000000..7aea894d0b603a02aed2a7f706bcb3170988774d GIT binary patch literal 612 zcmZ{h>q}E%9Dt8G)5LOgQI2^@7e=H}5t7*jq~=si${U5|rU_+M-j`oOU#sb&i!)6! zQj1L2<%^C`(3Frs!zQH!M$LxHZR)0;HP3s_`~J#5py%WBe0&lT<%eQbQbx*H7)D;+ zC9mj8tL`~bsh6u?DXLzlp`Oc4!$r+QwcX=`U*-e?sC#^9(mL|ZR{74{H@%DrT- zV)#}6;rDanLRp{LGx3fOqC^RS3vNq|)X-(A$o!#sus3{C+!5o{Rj7~JHa zq?m$3AWMR=N;c$n#X>#8pgrH*sO=7AfY*vOt}fICx=Rq;>*}tJq5D zJOzs&S}52kF^hQm&roD!pv_wX{I_nC2C7b_o=HnlsqcF+ z>%ILpZc-}G=AK7a*@3|wd!lmkaw^a@Hhgq+cl5#IStlz|F}po7cvo=5fta}bq!M(A z4UvV+$@aw_y%1lD%Gl7ITxjV2!wCgP%26SkA9VL}>?w1J7eN*3kUXk(DEU6m(EdKjHN)jkv7c;{Jb4a3C!1>qfFng9R* literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/etool16/newconnection_wiz.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/etool16/newconnection_wiz.gif new file mode 100644 index 0000000000000000000000000000000000000000..9f2b4acc733d73b2b6570ee603b53d7be7621d3c GIT binary patch literal 328 zcmZ?wbhEHb6krfwxXQq=e#QEgi&idQxO~Cv1v974oHlvdguV$kuixzL>FsFmxNzad zn>X(TG8`ldJPaBlDmD~!9BBCQpB(<(f{`cMHnI*y-icKd>n9$MD(a_LPP*9MNknsQie+KFS#h)yU3=C=vIv^uK zeqvxtb(mb>p(E8lT{&n{2%olC=g~zhI#!c8Ta8}IFn2L`G~dja!pwSb%Ey#BtgVhe z3TFv)wZy)7@x7O+v5}8ofS-?{vr~<$x0jb+ke|1&S4~k#MOAe|8?UO0va*sJ&$4CJ LD_5yGGFSru?E-B@ literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/etool16/newfile_wiz.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/etool16/newfile_wiz.gif new file mode 100644 index 0000000000000000000000000000000000000000..9d050885be6d125c6f3a8ee61f770af463945b9d GIT binary patch literal 353 zcmZ?wbhEHb6krfwxXQrr>Fe)rKmPps{rBguKlfhzc=G1w^LIbre)@Ii`S<%Te>{Bk z12|TpyR{>mrI{2JXHL%C7O09Mu>554H9&1sF`=rV`q@7GGB8G zKfk`Pt2BF0FFPY+r;7~t)M?XXTxEIZ%$>s~>nhH=Wa(0IS4pnbYt~4*N^x%5yop81 WRg`1b?%krUA_op05^-{5um%7kHK6(c literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/etool16/newfilter_wiz.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/etool16/newfilter_wiz.gif new file mode 100644 index 0000000000000000000000000000000000000000..8f0d32338c9c2239a4056e8d1222baed06b4a1ae GIT binary patch literal 227 zcmV<90382ENk%w1VGsZi0K@ zV@c9935=&e2n2Eh(d8nsRB$4I2Qr~-D5Vz(a+q*bkZ}0WJ!KFG1p~2AC^V;zTpo#Z dOxjV$emX`yawbGZNGc06RghZ;QjxV`$ar2|~4QF>xx?1nJH^pSN zg-dLHSxb0IO?k_#wfoN-#<#^cFHrQ(@$27Px&BpB(<(f{`cMHnI*#i|Nm#8 z3@H9&VPs&?V$cB@1M(9CTcyL)0uLP_NoRJ$l$4wnuf&eSB7RCd%U3D>X|PbZ@Ns3- z3ctC1$1hv*PIR5@8KNY}$mz sJ4c6rh^V-LYeiL!lz@c1Zjz+Ilcd3PiKtXA0Zh;6p@k?CL0_Z zCPWoEoSYO+5;_f|H=jxoC@G^SrbiGR4I>RDtwszD8W?QukUPcxVg3N+QynI8>&A%Jbi9O>7_N5Cl(hUnU{ZHR?eR3 zS^IiJc1_9n4+adR1I3>#j0_BV3_2jKAU`p%RXa>C@X(R!?|htLDW%5X`Dm4E?%Ei3 z7KTQNCZ@(FmdA}eY;1=alz2Gr6&!lJu)xH_>0;9P_!0?09(g4vHR1M-b}11lVKpaJ z(MgjhOHNXCQWu{+XYOouCk?U1OO`IyaMF}ny=LudO(!ks&0Dr^)^gU_wR_Jl_x%SB II5JoR0MLz@eE-$|rN4 zPh{ct!#56|eRTN5#hjk~1^ov~CLOAsaja?1iPYSxCF}NIx&LwAl66y8pFVcw<;knh zx9>f6wWhtWj!Nlho2CsdZiQzwb8BED^qO za?yVK}G@h1x-1A`BP4#;-O_61)8W|BA+4ihHbG3g)26FOj+aGf zwh*_ygN=hj4?l;fkoQV=TU$FjTX&yU?G@f?vTklpt}Z=%7M5F;O|_goyo7qx85p-J z8OsQJdY|0XvSp>3l%(3qtI|9?0xQ%MjWnh1-dAPgTA^UBZ>S-0rAJjzWQDxBiLRdb uo0D3K3XIE}=e!e@I3RFriK~FQjDq9DM{FGeJm=_=KmtbaOum%8Z~|9k)Q|Mx%t-~asg z`|rQ|U;n@U@$br~f0sZ0z4!J1I)+!7lcX83znW6AUnrbZnn4lEKm7a?h60^|7RG)K=CIF zBLjmsgAT}zpg3V*pVi>q)ZEhA*52yn>EZ6?>f-F^U~gyJ>|||YWnpP$*krD- z88&P4aBxU-adAjJ9nemrivxmou4Gave%?w&H VCWb3o4z~-)E6wuw7@)vl4FI!YxQqY* literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/eview16/commands_view.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/eview16/commands_view.gif new file mode 100644 index 0000000000000000000000000000000000000000..093c6bad04348793bb198ed35e4273841b7b854a GIT binary patch literal 347 zcmZ?wbhEHb6krfwxXQqA_{8Oys#O!09zS~Ol1}6l&HN*pxd*lK4rt}<)ymqTnZ8Lc zcehsZYMs>8dYK!wBBy9aOw^8;pdHq$o3r)z-~WyK-gX^+H|^BNr5C?!x%K1Fqu&=^ z{r&#u|L5QT-~al5_4EJNKmWh`_5bD1|8IW%fB*ac=Rf~{|NH;z-~Y4c&t@msbr%~q z=b2V#S`?>Pr^VPOMmkQb)SpylFsaP2r`V_^&$K4f;{X5u47h>fPZmZ71~Ud7kP?ue z7}zQtX8ST#8i;VVEL6zh;uby4I{9MG48MgcP8k+z-OOg(zh|76j|h|a-Eptr=B;H# z?C;*+ob!#5m4#7RS-V(AUap)`QN^@aS6)?>aiXk7r=O<0j7(=|gP)$fnh2wax(M@h eU;Q-^f78}2yEi#9SOWlu>Xowq literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/eview16/editor.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/eview16/editor.gif new file mode 100644 index 0000000000000000000000000000000000000000..007e98dc702996ae8614878e2048b0c884b4a3d7 GIT binary patch literal 591 zcmZ?wbhEHb6krfwc*el+_wT=tpMU-M`RD8RKW{$#Y@f2WXWFXgZ-0LN1{C@I>-XOu zKYz!SEzWIO8(%yvp?F$h(}M14tM0$}@#xjhN3VW-`0~49%9h3{Tbd@Wn!fzNjO7QG zZ@<(xd&Bx&XV&dHGilbcPat!CO`5$-$vOS^pTDaQUO9I1^vwAS7cQBza^w2Vho@KdXIk`S zTJ-1G_2=46C~%%o;Bs_U;-nI zVrb&;>);?DB`GN-;N{@!uWx8w^Je?aI(A%~inlnmoLX#kb#0iW&+#y7y0lnYS-UASvwULFaBlHX zQ&3jsc*d^o!6Ez8V4)K$7l&Y%g_DLS3#WjxlgWgZ3zL{6jI&~#PH;}{S8%q9bSVl@ HV6X-N3G>&j literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/eview16/errorlist_view.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/eview16/errorlist_view.gif new file mode 100644 index 0000000000000000000000000000000000000000..cc87d38aa0a1b26e02c85a621d6ce447e9dbf97c GIT binary patch literal 604 zcmZ?wbhEHb6krfwc*ekRP*ifisKkH&p#KTU|H~_`ib-D)lfEOR@ZUfDe{j@C|Iq)T zQ6GcDKZQpAk4^laSNzh{?tg6B|E$8lfB)q*uPf=?bn4QhZ$JM0{`2qWuRlM2{;ulZ z);i}%$D9N2KmTf&w!3TLi3!V3Pg{GjZ_$y7OOMapbZzO*+h?vmxpeFK(>Fh!zx%o7 z;KR+wpY_gI`Rc>Z2d{oSdj0*)r(a*b|9<@D`}6ldKYsiD{ny{0zyHpfIbrVX-UV~J zmoDg>J+uGz&GY*Yt0?n7Kj(jL?*FAr|F2l_9}E}<2T=UU!pOi7#GnIm4k%6-*mpJrH3fNj`gnOb zcXc~A`}q5M`}+t>PMg*n)F0^YKWEBxNtYl2UcY&B{Fns9L`9@rgBS%lI06H=3NlKF z@3jkJ=jL4D&&kccR>a6{3D>;2bGQV|O|RNFvGE58@dfa+s!Okvb7*GeVP@fBH8Xto z&b@gFJA;6Rto$PpJ;zVBCR!OBG8zT#Hj0`a6C^GwwmP?4J$c$-$lT^Cq3BT1FwuG5 e6fu3LeFBCY?EL*f5o-(rnUm1RU=08!bm#>D literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/eview16/system_persp.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/eview16/system_persp.gif new file mode 100644 index 0000000000000000000000000000000000000000..592d46f7b72fac5d4d2879c7c248c99d4d167f7e GIT binary patch literal 606 zcmZ?wbhEHb6krfwc*ekR)G2e#x~-*EU6n11YTB1{O<7adI<2y{edWf(>$e`>zW3D1 zHJe)|tgNi-@QExueBxqiZq<@?`{ylLw{Y3I=B_D6PF>cHoT?o@Vb#I=n)yexl2>RY zEYgl&s1-9?8;GK&YDY}a4(nZc@c!iE9~<|*?Kt#){<+U=`~Ua9|9}7c|MAcNuYdpl`uG3GzyDo*eSiM{ z@1H)kXnu2adVEYq{H%GCkDWZYW&5g$lRB3!n^=?|x^Z3q-fcZKReANLPG?SRe);rb zYlXv!z1??jp6IKwTfLxkMw9iL9@E9`7EL97oBB=u|NqZ0a6s`V3nK$V7=sST37|M( zVBg&krl=q$D=j7A$k*ND7$&Krs;s82#V0yr1|wgSxV)T)70&E}Q~D=X_dd?E`EpSYNsTeW1} z{&`E*EnK#4``%+mPF)tsb`i~X7R_;%DfEyj^i(PL*RBawDfiQ^2{CAhD4O3~u%V!0 zL&1U*4aZI%+_HVu|KI2S|NqZGG*JA>!pOj2$e;t#0rC?ATl;|-1sWxZeIDWyJAPWs zM9N(=M}v^#4~o-83PHbZP8JG+{Wu8s!B;>COuxwzD|4YXBPtl;LK$jGQXUq^+J biJ6U4YNC^(g3=Lvx#M!~`Y~q=9T}_vHj0Sg literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/eview16/team_view.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/eview16/team_view.gif new file mode 100644 index 0000000000000000000000000000000000000000..88c056795d56a510d7ea3dcd2b5b11f3db11384e GIT binary patch literal 139 zcmZ?wbhEHb6krfw*v!BnlDS$SwCmuD|Ns9V|Nn8t|I3v-n!S$n`mZQ;UQyyaC(8~f z!GHu5f3h$#FmN;IfW$y%FtAt@ob+71*W&u&tv1d#QrQxPjw!8q(;`wZQO7aY-)miU g(1%`$157GbEX+%TSA|v{P21j;cYJkJr67Yf0B0C8{r~^~ literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/misc/IBM_logo.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/misc/IBM_logo.gif new file mode 100644 index 0000000000000000000000000000000000000000..0345b794ddd12fac7a20f1cfb5b2413672e9bac7 GIT binary patch literal 382 zcmZ?wbhEHbOk*%%*v!E2|Ns932M$vWH2P99=VfTE(Kg#qpcAq_=eV<%n#2454K5Ar zI!x`yI1Mcfxl|h%90Yn_t-G{9QYB z@{33j{aPWj<^bE0&aUpB-oE|`5m~wUZgz!}Z414o%}%U0s;o9+Twowt-8OM`ajMwN z0@3uT(}TA58R{(;u5a93Uu&?+w_{CbXwb=Hr_Y={cmBe~OP8-)y>|V^&0Du4mK|EU zc=rQy@$$n78@9gm++sib<-9w$c8XW+d-T{y*!+3Px=qvmZM|$Vp>t33?+vWH2P99=VfTE(Kg#qpcAq_=eV<%n#2454K5Ar zI!x`yI1Mcfxl|h%90Yn_t-G{9QYB z@{33j{aPWj<^bE0&aUpB-oE|`5m~wUZgz!}Z414o%}%U0s;o9+Twowt-8OM`ajMwN z0@3uT(}TA58R{(;u5a93Uu&?+w_{CbXwb=Hr_Y={cmBe~OP8-)y>|V^&0Du4mK|EU zc=rQy@$$n78@9gm++sib<-9w$c8XW+d-T{y*!+3Px=qvmZM|$Vp>t33?+rVFkK8dbiT^TJ;5`!I=t!5RSSVj1=T literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/compcmd_ibm_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/compcmd_ibm_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..c7a0c3fc2fa8114f01df4996e5d34018f0ddaaaf GIT binary patch literal 596 zcmZ?wbhEHb6krfwc*el+_{qBy=kBiDbZq_hldY52bxmFU?Z=;=zy3HSFLFy?;+3`B zH*b|s=Ddiq^$B&`Qk%A?HEr)+e0Jiztp`qAd-(GE(>FiGjbd|p_80UYD4BGqV%pK# z8ONIDoM@YW>gD^NpTGUi=-g92?NH_PBU4wOK6d5hy%*n~zWw>?!_Rl0e|4`s+qL4% z>C@xn*{jg!yXbm*>PHvgsr8Ho-$WxNN0DrxUIE`mNq9FTi}&& z1#>GCO+^lQ`G5!E{u=K;X!yPHm6Kx@6H*rvV+{Wx#PV=Oz{2^h5{$oM4K-G>(n3&W)OkU9P*rQBiJqr_qH2`i>@@D`5 literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/compcmd_ibmuser_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/compcmd_ibmuser_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..1c277194b2173de4d7933fce6294ba893bd4811c GIT binary patch literal 587 zcmZ?wbhEHb6krfwc*el+_wTb|sZHC{ znznZ@K09&V*6oLH95`|9;mhw&-~1Feip}ZSU(kP`WYVFEX-8{k9BZ0$qHX@Et9M_$ zeE&0}b5G^;Bgd}1JbCr`y%*n~zWw>?!_Rl0e|4`s+qL4%O%+w>O`-x9QmJ9j9-dyZiLqy~i`>FMROw^|iZquiwA>Fu5YI zKhvTw)1p7eZbE_cgaVgIC0_lRme)`1`VR&Sg8(T0WMO1r2xia$xdjv_4D2f!f}41_ zxSQIWJY1cdB#qQ$IXi;gyIquyeF~E@%%DV`p>P;6KfOwWy_z z93O+PgR_fYhlrJ#y0%oHkE5g4WML}{Lsd_J;qnQAJsWnSvdYVv21ZK@M08D__H;_!eD^{6O-J9 R> zoD*&HPrZEq^Ygdg8J&B|ryZ)Ceq`$E)5os7y!Yb!)3-lgefatA^RMoeXS-IMnY`iB zo-_9+%vv^g$F+<1-adNs{rUSJ8;;)IeB$1wW4CvlzIE>I({uM8&z!&T!OPdz?%utA z|L&8wub#epb?w%*MN4L1zIod}UMSt-Uq>!GK}lfZ|UUMh1p31|5(S zKykvrzNsOsNq~>PsXffABTU9bOOdz3%dx9n+R{*wyWPXn(bKbC%G8LPrzybA&E4HC zpea<6o6E)3HO$}N+s}7{gteYBH(T&_pFp2>aT^P5T_w(tqhUcEVm4OBnpzyJtj^tG z@@AIC8Vc-ka!wD!9MnI2RJVU?Co9V&DySwX$`JNbiDQ>zW7B>v1BM@)ivk3?IfePA l1^igQP?Sl zoD*&HPrZEq^Ygdg8J&B|ryZ)Ceq`$E)5os7y!Yb!)3-lgefatA^RMoeXS-IMnY`iB zo-_9+%vv^g$F+<1-adNs{rUSJ8;;)IeB$1wW4CvlzIE>I({uM8&z!&T!OPdz?%utA z|L&8wub#epb?w%*MN4L1zIFKO@h1x- z1A_;H4#=^fIALI)(BRP|z{lUz-q9{&qNT{&IYHXeP?38=rf1*jJXlmzUg>{-e~VK}z=3H8hb@EL KmnWJ64AuaUd(Gtl literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/connectorservice_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/connectorservice_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..41f0158c1c59350f42b07f5efcbf11bbcc618fb9 GIT binary patch literal 353 zcmZ?wbhEHb6krfwxXQq=e#QFb3zzry^mep&T)1%K)%#!XKK*|8>DQ;PzrX$X^YqQn zXK#PL`~2HCp<2qdQP#8N-REEHb{_lm?RP}!M2^r&e*Jro-nlK1;UH1qVbBn9^TC~p z4Fw$s8t%N>{^Q4m|L@NI|Nno&gb5uT9Ssc)1qB5O2?;LDpDc_F3~CHIAR|G3 zVqmLtm|Wl?!o;y?(IpQF-Kp-&JB2p-XbJOv^bm5B;ti0nwwcxpS3KzD$Y2cs(qejL literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/error.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/error.gif new file mode 100644 index 0000000000000000000000000000000000000000..85ec26bb8b34cc79a89c232ab5939ee85920c692 GIT binary patch literal 354 zcmZ?wbhEHb6krfwxXQrrHNWUSW3&Cw2gt=M=@#b09e6a_n_OYJJZ6jXA8niUvy zT$!0zcq@ek#l*eEy9I?Sc?I|jRrse0v^c8>@fC8;<>afFDIu!DwY-p(MUsOmKizfw=83D%FWi3h_QRL-`Z*i-ojVTVzP$P9 z?SmJe((30tc>X@8d3H|otdr+1KY#P_){CzN?XwEoXWoAKwSVfYcVB+qdinMC%P*x} zGy0~^di&+)yDvXJ{`z0pJN?4P|5bg{o_zoR?(2{G3De$w{qgb3*ZK)lKmPf@e$W1l z%9_SWQ&(==aqaHyIddn@nLA@{xhU-acJS9h~h=RxpI^BB>g|Uw8~2?%4r0H&`RHw0{hXZU*(c9k ze*Wg;truSl+h^W>`SsnGpQT+h-hTP{;oGlwUw$0FaHXnm+Pkkm>L*Nl`}N1iFJJ2? zOkKZce@10ZGF>sc|U#>{PG_X^#o@u6Ir?0E8Z*1(qWIEGO#x8tEP*CWey`k}X8e%PW4#8e0 zPDaOTsVl3i%Ld2AdS1I060fPGrpC)F73{&rDJbA^nqN|pmx1wetox@=QSp2{61*a! z(!p+ALUt7fLF*5+vhuF;XmoG!nAjG%Z;C=g!+{27_GLUX86F*;q!wXh*`)5mFK%dGPg|6>q#}6kYzm~%Vt`k^VCA;X@xFR z3ti?``p&8JUD6aDVqx(A|9=Lef#OdVMg|5$1|5(Nke?XXVh_wH@X(R!Ke41pQ^#`V z(#9=IR5)4swKKOooz$Y}e)!T#lXDGi$`=HV#`UnWZ;NzL5%)QEnBiy?2d9XXFjt$N kprE{-vnDG$+XO9bL!BwE>MXM~eAMRoELgb6*^$8-0Dd8Tg8%>k literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/launcher_config_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/launcher_config_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..fe296f652bd6659a5c087816ff34d78d2fb85eac GIT binary patch literal 547 zcmZ?wbhEHb6krfwc*ek>tL<;)k#6Re%AiripiyYxoMPmXYVMwD?VWDpoo?WkW$2z| zL>-=|TyU$tPLM)3iyl0(|X`*ch9 z>z3^EOmFkc>9TFxW7D?Vu6?&t=N^}yy{(>|W-aS5iaN5ZuGmajd{`SqImru?=eQ@^WIiSr{1@0vL2ajsnFA1A9Y5KvQ!|Yg>CegNU7lqOy{2hlmiL zn>mx0n3`3a9iJ1A{~{YkjW$y^9!D-$e^vttk5&Z}e{KivMgHE>t;+2F?!5La{`{P( ztx87f+WySKdirLvtsbJ*Z2sCh0>+XqZJLaR$8;?P<=Snv#QiutrQ|!Bd}LK*oWK13 K^Y>39gEat_F2Aq< literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/properties_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/properties_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..6223cfcb280fc8ce75ab05174ebfb67b951ac58d GIT binary patch literal 578 zcmZ?wbhEHb6krfwc*el6V#9&>{GNn@o~+6#1@$v`9K5*q=#}W4&e*)}*u1Xzf}VuJ z-sF-A$tC^i<&(0jr{>qs%&(tO+%&tSc}{uTyy~t+b-hb>9K5jS=#}H=@1$2u%B-4_ zT{Eq`eSR58c42ML;>HQfnkTL3n6`Syp^MuOUf6cv{N7_%4xPSn?EIblh8cBzOWLQe zX`Zyad)B%o8xAbnbZG648%IOZ9jD3@VVQE&fGY5;m$!2d3(Zw4gbM_VJHB_pDc_F3?2+RAjg8@ zgn@m2gGW%oBV`XLSEUD@0Y$a*stlXr#-DbxQ-6jPM7Yz+l4X3NuO%2M6)ADKiQeGH@#Jvas$*Wx6lO+AiQZ Q$Kv9IqumnhtV|5n0C~#6Jpcdz literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/service_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/service_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..8fb844f5b34e0a2a62e80f418a6c90e7ae58b758 GIT binary patch literal 563 zcmZ?wbhEHb6krfwc*ej`UDWdD_ut0+QzD90$(hroH7XSinq+mWl?-c@3~SWP+Eq=P zL!+yN)oWu?yDEE5R`s4#wr$>X__}@Ua`)(-kj!~GZAa2;w}&OxnFdY>FWwrOyC5iI zR%+D>*YtH>Ih!1!`ePbTMpkTToO$Z-iAxc+`wM#ZuG@R#;>{PuQ%;xFcAUQYtYG?u zx_M^`r=9R@JX${c#D}lH9=`t4zvEW__8YVI-Fg4@*Ng-ArtQ5oW8dw?#~&>{_F&tk z=R2>wSa#yUhKnz*zxeX;`)`fOr|!J{mbLP5<*qZ?TaNc1zA*pN{eoSm7VJ8Zyz@}> z@BMdgW9CkuyL;n-hZnDWc{*{T|dZDT*`_ZfO zXYNgV`25ty4Iz&nU0Atd!rnbgT5COLHEX?pd2{~k$$!4T|NZgtkEd5JUcC7K|9=L` zfZ|UUMh1o~1|5(wpg3V*pU{xi)ZEhA*51+L>+a_1)#>3Hn35Lc?b5**ADNyJ?Bf*D zrl}^T8Ws~8ps&^DudW&$5gr$%$k(PSq^c8}oFps7&?;|eV{Iyz$)d!Q(4y;LcHF|m zKwBd9h@Y9Qou!GeN@A;qk)yM{mASE=bgMF(h^RQffQ*8qAX5t)D+iZ_L&FAzgNt<8 literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/ssl_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/ssl_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..8e3d48a637e96d36565e4964b8f7f93227fdb48d GIT binary patch literal 239 zcmZ?wbhEHb6krfwIKsg2`_JFMpHIKI*z)yG&!1=WHub1)pQy8Yn&JLgrU&O)%&gH} z+HSh6(_&q}&AtWRC)dWmI9+n@Q2xy$?G@3&%j;xTHp;JUQ@(g`_W%F?8L$DxpDc_F z3=#}FAW4v&46Hc{YJDl0Nz)g`J+Dx85KwvZQ)r6Uh2@SC%JLUn8Ux&pCcm7TVKsYe zpp)BDHz8G*28Rg-Dt9;*l{Czd6>hgI(vW0oKA8Nm!@X^>Q_B4SlW&5os$z^xOkBcT ZZGvK|q74(OMO{RuPMfMbQ%RA*8UVO3S=j&p literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/system390Live_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/system390Live_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..2cc459a3716b3af445458542e189f7c19b457ed8 GIT binary patch literal 581 zcmZ?wbhEHb6krfwc*el+QrYjhs{d29z(<6uBq^5mIb<6DPrpc9c-IcZNRgDuX8~QF@zU~uQ7!qF` zmRJ&*TpE{Ne(Ky+kBGwP)Ut%kiqzby?R$^eg%nx@6&*Z!O3Syx(%s`I#Xdnu&~&Qpv}P5~c6l4?71ow5?NasvRu-maCaapH7-sA7a`R{#o2=f> zI9s1rSXf$X;S45aD{}*0etsF<=~B$f+}wt|A|kRHH&~SU_;h&1#T7Mguqt2C<&}_- zQ@hdsK!aCQR7rJ%qD0{NBb|cEIt>SwF+AiDP~q9hP{i5M?JT07d1r;80E0CEQ!$$^ literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/system390_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/system390_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..9c11dd7e48deef0046642fa32b875f9ede2f8cfc GIT binary patch literal 357 zcmZ?wbhEHb6krfwxXQrrQrYjhs{d29z(<J80?Bz?29-Z zi};)ii{>}m@3%j8^5B;3tN#E0&p-rF{K>+|z+lXv15yj}69Ze*ftdwjhb8(qE-Y#@ zY*DyyA+0a?>{QHqv%K7=8SNBZD;noTqfh literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/system400_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/system400_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..76f4e22d0bb90a6fc6059e53c75c85073db93976 GIT binary patch literal 366 zcmZ?wbhEHb6krfwxXQrrT-E=ULF8q#xT8*)d%O$QhF33%Z>sNHR@1(uzH3>1*V2_6 z53gLaIWVp~A+IyFe7a9$VMJO(W#`g{{#BjRH%yqjb@GDk4c+rsZa#Y9>b=W19;R1J zuIpRbGi%ed#XC#uCuEm2r{-22I(cR1{*$f|#oPBDJ9zYzRd~5>XpKTp1A|==gH0a0 zf2VLj>&%Tui{>}~|NozX6rlK%g^_{5fI$bO3FIdRwr+fi#3+5(5w~E()3o`uBfKl-mdE* alc}wz!_CRb&ZVeRdf=e8Q0YZS25SH;n|mYx literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/system400live_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/system400live_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..6186873b58e9e0ace86228f8d2d21e777290f27e GIT binary patch literal 384 zcmZ?wbhEHb6krfwxXQrrT-E=ULF8q#xT8*)d%O$QhF33%Z>sNHR@1(uzH3>1*V2_6 z53gLaIWVp~A+IyFe7a9$VMJO(W#`g{{#BjRH%yqjb@GDk4c+rsZa#Y9>b=W19;R1J zuIpRbGi%ed#XC#uCuEm2r{-22I(cR1{*$f|#oPBDJ9zYzRd~5>Xw9RiFFt<$su0w` zU{}OolgIAgDICx`bK_CD8t1;f3r#vhi{>{oqzQL?bl(2G@50Y5|NsAIzyOLrSr{1@ zEE#k_G9W)Ou+2R%ht)|Zs_2A-5a&yudBQv?lEFsuvR+}cCWjV=omeJVXd-oac5d$K zrwVI#)M(8bv~ z4h}^XA5mQaQ7Lt9X67Y|>MKOINonvb*`%>`ySA%~j<%2DF-0}~sZ;emWQueR^td@W W*|`+;yl-2czo090=g}ia25SK3=ahE< literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/system_persp.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/system_persp.gif new file mode 100644 index 0000000000000000000000000000000000000000..592d46f7b72fac5d4d2879c7c248c99d4d167f7e GIT binary patch literal 606 zcmZ?wbhEHb6krfwc*ekR)G2e#x~-*EU6n11YTB1{O<7adI<2y{edWf(>$e`>zW3D1 zHJe)|tgNi-@QExueBxqiZq<@?`{ylLw{Y3I=B_D6PF>cHoT?o@Vb#I=n)yexl2>RY zEYgl&s1-9?8;GK&YDY}a4(nZc@c!iE9~<|*?Kt#){<+U=`~Ua9|9}7c|MAcNuYdpl`uG3GzyDo*eSiM{ z@1H)kXnu2adVEYq{H%GCkDWZYW&5g$lRB3!n^=?|x^Z3q-fcZKReANLPG?SRe);rb zYlXv!z1??jp6IKwTfLxkMw9iL9@E9`7EL97oBB=u|NqZ0a6s`V3nK$V7=sST37|M( zVBg&krl=q$D=j7A$k*ND7$&Krs;s82#V0yr1|wgSxV)TaCqC=En8M^ z+PHlE+Qq96?B2g`=icSBm+sxRXXmCJ#||AkdFz^#Le7QdS^`_XheepYIq%H4= zS=}4|VX5_|2}vtDV&>I`&8-canD5u0=Q|n`0Z4S#BGLkD+s4UP{ z)-|x5(b}?lp|XyFq4NxBH8p9aHQIUxM&>p%6d4#TEUfJg8yFw&mRGS56Bg%lIC`a9 z_J)`cuON%d{f_HrMMRmocpOi3shDbMSP5`4u{w2id<$4&@G1EqBlEw1cfAh^xK3o} d{Lh)QBFW=OJ#+AafRB$J?eA9*WMyKo1_1kO(AWR~ literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemaix_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemaix_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..d6dcde08b14af6fc31d63d19d3dc0b7c2a334aee GIT binary patch literal 221 zcmV<303!cKNk%w1VGsZi0K@B6HtYjvd5XR#pCw> za-W0$|Nj6000000A^8LW0012TEC2ui01yBW000GAU?+}bX`X1RstMx042ldiy&$MF zaGW4C4pd|S0Qevh)P&$W8c-I*WBSN!P?$o&U^r|$-Ol0JxfB9u1LRqG8Y&`%X3W)) X$A^-E0`9lLa3geiZh2!XCLsVjjJsj< literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemaixlive_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemaixlive_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..6bc478ae6ba4fc6c3b6187520111dc9382693b94 GIT binary patch literal 348 zcmZ?wbhEHb6krfwxXQqA)G71Kh1)glOIB_?ymHOvyAPh5$1H7|b;u{OaPorfb$u&) zW^J0bcxP&Em1{)t_Pxgr9zA6hUcO<^N!`$z0~a41IDbzesDa(TQ#hb?=BDE_Hy(Zb z?Y~@&bKl;DCY_;0^P3scggZVuZ~xwR;pdkB|Nk>k8z}x{VPs%XVbB2?4Du5LTcyLK z0uPa*E)S*WGgQi^DW^?V;fi!t2x2<;*2qJapIzI9=iGDFq!TB(WSh^sD`Z&QIC6r4 zVS%%XuP{qV9hhmj@| z!^cNU^)$=D93{1Bmt2ikM6pZxXf80Q*w4ngKxIMPYAL6e2AVtWx1L;h<;IQo9X(Ss|A=PpLCw5_S~+{QviE3aZP&`$p_#r(3y4zIXeF=K zN?fWHw?HdqmR95xZ6J!6s2wpuJFNHj-~WIA{oj4}*RdymFTDKMxbJQI!T0^gKFmD* zdC8@(>#u*m@$UbRKmULI{r~;X|Ifew|NQ&^&%gigfBnDu`Ty&m|KI)k|Ksofmp}i% z`St(vpa0+g{{Qy(|F3`lbop8aYI7$zQ*RgjgybIAK1IOInS&*)1o-VIxWT_G175brT(OH!|o#EoOs*+|Nk=# zR-pKkg^_{5hd~GAKv0}8u+MMsX=-k1ZEJ587UbvS<>BUFXJKM&VU(1TmXVbc6PJ*m z+AJ(2z|hCV$;QgOsL4ZpblChx{8Jl4)%toicQ|?N=gb^s)m-<78X{9O>XKU42dBf2N$#V eOPI6CMxF@p;E^}XsBl&}F_WiDf|Zqt!5RQ(vci7= literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemcommandslive_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemcommandslive_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..8710ab849f21c8af7995c1916f7a22e957ec400b GIT binary patch literal 589 zcmZ?wbhEHb6krfwc*ek>9X<2z^DmnDM>NwnX#r8n8m;8jT8T@w;udJd%+iXSq76h5 z6SX5IXovOQeg66P-~WIA{oj4}SL437?FZlYANw%#^yej)zOKLi{oC*VKmPpx_4ohx zKmR}f{{Qpu|3Cl!zyJ0B>gWHjfBt{>>;I3x|6l(6|K`{K&wu`Z|NH;j-~Ye<{g-d? zJ9O{-@duY}r=_^e$_!gpQM|cduEx11oPNXN5B*S~#vZ(61Pq;kXV zBIBHR+yDRnGYm4I_>+Z^fx(|a2jnhLoG`GjYVdDrZfP=V?PxJ-Z{p+O;^bgwV`en& zcIsgg77-N_mk^S4bXe+O?a#-{%`l0Th2Pl3XnB*j;*On)%6p7fH2Em19zJrUr^)xw z5zRAayjolo)s&RfG_u`%E(Bm z$ZMMwTv<_=+`2$nQ9&a_FwvDy)-vpfM9Y#zM-{az))X}AT~x@?vFTC~;b5=^0BjJ_ A1poj5 literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemconnection.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemconnection.gif new file mode 100644 index 0000000000000000000000000000000000000000..e8efe69dc35230b3a17f5a852b2a89435bb28439 GIT binary patch literal 200 zcmZ?wbhEHb6krfwIKsfNe#QEgi&idQxO~}yWeaC7TrhjV%&9Y{O`bNPZ$fWRZ%2E_ zg$p+XG8`ldJPaBlDmD~!9BBCQ3B$p_`$go1mGMnU<55kdBazjE#tg zh|tj35NJRca7ZwKSRQ;sj=iBYiB$k*6L_$2h`@k|@k6)wj?nqE`1sI}kdTOoh=72A zaBy&7U||3M{{R30A^8LW0015UEC2ui01yBW000G6peK%GX`X1Rmd{E)Eeb3H1YfZk zEQD4470IcvFhC-YAnLF{h#o>zVxf4Z99XPLz~wq7l!*gCCVLiWbYp^+Z^fkBi(2c!yQCj+Z@ zf@)t%=DduqAfM9#nnzqpjyOCwvHz3ozbq`tBWEU8YhzKTi6FxTjVTXQ1Xvmy4tVK$ gGITK?DhOauSSqh%6yTvt8TwvCct0~05`EpRR910 literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemenvvarlibpath.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemenvvarlibpath.gif new file mode 100644 index 0000000000000000000000000000000000000000..51e703b1b9c671baa2be0f6525edb3b69403370d GIT binary patch literal 216 zcmZ?wbhEHb6krfwIKsg2wj(b5!P~sjn^4pBFDXFJ7TPNb)}zFdzZN zpDc_F4AKlbATf}g46LCK)cR5~=VfGBty!EmMJ+qTijl!k<;;`cOWYDXbj&=28jDUI znIPA;;-J&oD09KqYe6rnb~B%5E3$|wj(b5!P~sjn^4pBFDXFJ7TPNb)}zFdzZN zpDc_F4AKlbATf}g46LCK)cR5~=VfGBty!EmMJ+qTijl!k<;;`cOWYDXbj&=28jDUI znIPA;;-J&oD09KqYe6rnb~B%5E3$|A8BZMfAby{f8999w{_53kn=eT-3-Yb8xq)j<3k`x$A8tdec_7l&n=! SHPQOoBiEniwKhtL!5RQb;Vpy! literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemfile.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemfile.gif new file mode 100644 index 0000000000000000000000000000000000000000..a966159d95a8cbed1d10885f4061227725fc2223 GIT binary patch literal 354 zcmV-o0iFIwNk%w1VGsZi0M!5h^Y#1q`TT>Cv4fGYhm)>@lCgr3u!EAY?(+Kb_51ny z{P_9%hMK;NpTdTeu8Wqd@bvqWrpB7A%c8T-sJPRtyw%?5_}%CC-{|+`?D^;J`R(%h z^Y;7P=l9>~_}=LE;p+J6@cH)m`;eNb=I;6M_51Sn`<9)g_4xbu`TLcfq?@6kp`@Ir zsF8yg6Lgc~kJEFpM$VhkZHMJps4l$Db! zMJgGKdkh&TMI#`iq@*K74<3wT7#|i7MGhSu7qqms1VsV`2L`;o2Lc03#6&>=JJlPw A%>V!Z literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemfiles_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemfiles_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..9d35f172823a09adb4ba0187fb53259e97e00e84 GIT binary patch literal 317 zcmZ?wbhEHb6krfwxXQrr^VgrQX{#qMJ2q?0>F(*PAHV+b{N2wtAAdf2{o~`;-`{@x zo-}*e$FIL8&R+KB(@&Ai)dHbivlc8|v~>33rL+J4KfZd^)HSQ7ZeBlO*XHgm>-+zI zT(N&!$Ac67S2kt-zg)Sa+3QHJ|B6!Q6(!Ddvh4o<|Ia{ep!k!8k%2*lK?h_o$WIJx zQ4T_!E+SI>ZUU*1E^_v>Ry=!b(`FOVzamSfa{nD=l{YmU<}ZA2_#9$jkmZ>^H&DZ3 wuJ_lE4G|K|Oq`-ALVSGee8MS$Y>jM!Dcl@WSb0-e7+Gerq|BS|=Ez_T0N2QGV*mgE literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemfileslive_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemfileslive_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..5d568697977df60f105e6f6b62235903d9422a9c GIT binary patch literal 339 zcmZ?wbhEHb6krfwxXQrr^VgrQX{#qMJ2q?0>F(*PAHV+b{N2wtAAdf2{o~`;-`{@x zo-}*e$FIL8&R+KB(@&Ai)dHbivlc9rt8wnzyU?UFlp#&HKT?|m13ZdtT+_Tr_p z|NlR}dezi5tEO&VKVjGA?k(&4|9@Pue_O|c6a7~CMpv|BIG6Uo%2DX9&Qwuy|JiAs;7Sgoj^Pl~q$TTx)j&^W{v=OKN zv<*v@T&A8|I;FsAVo&?39dk4k#T7l0|0#<6bggu%(UxamP?2wJR^Z}NR*|db7m(#) pX5y4-bdu!bW9O5atu4qlolS5tH^&-Q-o-48EE`!CFLq?G1^_offO7x< literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemfilter.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemfilter.gif new file mode 100644 index 0000000000000000000000000000000000000000..bcf191a65869781b203453746858d0213710d495 GIT binary patch literal 209 zcmZ?wbhEHb6krfwIKseS;S!r)))JmlQ{FNwwRTEO>r%h|y}nVg|Ng%J`{~%;M1%45R?XpDc_FK&x~>nm~3ku=**ebRD$l(U6jPG}Fn=k;UZo zzQQfPBsc&Wn2R*19B>7a+sGXCeur*lmZ56< SCw$LNYFAAAZ7ajXU=0BNRz`OK literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemfilterpool.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemfilterpool.gif new file mode 100644 index 0000000000000000000000000000000000000000..5ba35b0d2e37b01925dede8ce04810ae1e6b07fc GIT binary patch literal 221 zcmZ?wbhEHb6krfwIKseiWAF22MaMQYp4l_$>hZ;QjxV`$ar2|~4QF>xx?1nJH^pRi zepyR+N=m$lTL5 UTV0rEThU;ls$14BqsU+l0HyL`K>z>% literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemfilterstring.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemfilterstring.gif new file mode 100644 index 0000000000000000000000000000000000000000..86fe0cdfda2ffb543f99423651db22e0bf419902 GIT binary patch literal 126 zcmZ?wbhEHb6krfwSj50!Zyz5YZ(m;@fB*je|Ns9pFfc$!#h)yU3=C`xIzSPiN&yB2 zX6KA7Q!ed3O9x|vRfnn%&TmaL&XB`wA9ty5!z2@-DG*c)vU(bBIKkfg=L;qiI{{MQ*n~UB5pDy|Tbm{+F?f-9e z{J+)t|NhkfKn0gd{$DJ8e6aTBrozLWW;^PPj(3~yYcbi|Y_hr1V123nj#{Hll?Iy& z)c%730~jd&WMO1rkY&&T@j!Mmu!bh6_oZacQ(qeNVn?CD_N^ie9Bd+MwLDo5EHF4A z6v%dBNm0NX4~`2NTO20zXtl2i>$Zq+o7q<3ljh?#y|rp@n2L$=nPk7^)-n=8Y3JWR Nk8Wse(okfu1^{6sXITIM literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemhelp.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemhelp.gif new file mode 100644 index 0000000000000000000000000000000000000000..7f6cdedcddf7bfd6aac87bc88d1599eb400d1566 GIT binary patch literal 373 zcmZ?wbhEHb6krfwxXQrr@8AEApT2(j{B`S|6BFmI-?Hb#<~=8R=d9nd_r#ei_ijIV z_xIm_jihNVWlLf^H^z5u%$l@4XUdMsx%;MWILK|7V~cQ2fcl$iSe+ zpaU`zJaoiFCv!Ci&eZ5pa|u@DP|$8()VLs`W1mt(Q-Fk)R;+9CNsq;? zlTW&TNpMl~zNoI}67MD=6z`>^obJRUD<>x&&&R_jE-uZ}A*(n;sb4^DhU`?e3@NGj zN~I;7q6NZ>mxzeSsK`jwsHJl$C@6U=$S7=gR%PcBOAwRfVpnxl4VI7yKkXLo9UO4o I)sev(02|+pBLDyZ literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systeminfo.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systeminfo.gif new file mode 100644 index 0000000000000000000000000000000000000000..745b884ff034c11402295e833f0af2c866015cf1 GIT binary patch literal 120 zcmZ?wbhEHb6krfw*v!Dd$K2*W(u+)=t?y zYs=lds=mW#?>&0;{n^_e?>_(Tow4%!&p%fmeK~yY?#-uPUw!!T{>$&LKmL69`upwY zUnyRZ3OamAvxMf1A%ZKycDweaw!l6~td zwy&<)zPk4Q?X&-XfB66ZKLd$C@h1x-1A{(;4oDx!PYi4o2c{Qz=w z?~+$^5#-~pANYVJw8q~GI9;Qo1IG5 K?%L(ZU=0AEkd}V{ literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemjobslive_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemjobslive_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..f81c05aec6ed1b5b1d016275b52569566274c36e GIT binary patch literal 362 zcmV-w0hRtoNk%w1VGsZi0M!5h^Y!}h^ZLQd-)e%bZ-=pSinV)@x{RgL*W&fj+wI5D z;eC|5nzY?+dXB@*-s0-_=I!|I^ZSjMsrUK()#CKS&fVGN_3H5W@AUii`26to`|b1k zWQL~O=J4O?@&G(;9A%<5cdc5FyK0)knX$zHPK?&$?bhJv=kN9G^Y|WoLyoKIJ zW)q0O9O15x7ujSx2#PZL2aN14FvjDncxI0gnr zZEbx~QLzOJ7P+~(FIl-~^VU5|s=5!JeLs8YVQoW)v59$8Tfd}?(#=PoUVZq<$i%#G z$#OOh&KGaqM8!n^{Qc$o&yT&)HpyR#7)K1M9|7nCNMjr zASODFfq_w5TVGUEY{7y>Zf@>NR_@unb&ry&?t^FF&t7_1+t6WbV&2r&FDavR^Usy9 zYB~i*9Q^aTLlT3vm=`J-dJ*`$UfBWX9$; PvzT=}6>dR+3Jlf&UFhx> literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemlocal_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemlocal_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..d60c188caa989f405c3d090d48ad7c437ceb36db GIT binary patch literal 580 zcmZ?wbhEHb6krfwc*el+`RniRKYm;JH9CfMI7f7QB}@uPn-P{fFQI%zZ0WMJ`t>0x z&Ee^7-+ugw&hCuQ?@1|{@bKl2hcCZJWp`v&P0g&Fl2@qPnpVX*lfh( zJ7?}(9;0SsVP79bMn!L4MP5FWW;1?YE>1QUCVfu^e$!@i0be~muS18V1T2~@MK*JB zu(L8VNs3xETTA;&C@4tWme3WmX|~ny)e)4J6BH7Z6Sr%&*VL5Nl+n`E_V}XItmf3h l!YRShF+q^YSH{ROi9@iJyH{pn#S)i^LaGW%w&KYm;JH9CfMI7f7QB}@uPn-P{fFQI%zZ0WMJ`t>0x z&Ee^7-+ugw&+kboneg!CkB2Y6M`d?pR!z;UoRU{Jqqup_(>Fg}zWTetG-6 zhp&D-eD(dwn;$=Z{r&diw|2}N?WpP65tFsUC%6@_jjCT?)I7TksIp^zS^K;Puf9Kh z`{Ui`U!TAIdiL_IX8sY)yhEBf`!ut6X=QBHOxvK9woxm2jaJHPt;A*8iOaO&7it4h z%xtZw=~~g#wWFtNMNHO;oU9c-K|5lCc6fhT$Nam`KY#l6`|amn-+uo2`|tm^pTEz) z{r%<#(69gGYMf0vLoYqO$&e=8@zHtv_r421xBUPApJ9N2;!hSv28M739gzK?IALI4 z+YsK=+|m@#+R+lw-lS&GKcPRUJFLf$d&bNep&@fag2Rn?e3vZs3knRF-()Q0>!ZM^ z;Kl3j9k8IugwL0YlZ}N*&x0Yrz1fuCS6A2b%o%xovu1PQy<8mZtjtUjA{Nb-lD^_{ za^g?LbwsV2t<`|F3@j|LW)e*FXQi`}P0h@Bcsk{(tl9|Jz^xzx?_C z`q%$=zyH7g{r~fy|G)qJ|M=(sx4-{?{rmsx|NlS#|Ns3D0u0mxia%Kx85qF&s24FDJgfQax?0O5N?dI7EaLC!KOm-=cHyLSD&~z2BDV@FpaQd9bNCX7T5UF|f0A Ym=~KdG8=HH#VD~dGX>38Rb;RR03^0jL;wH) literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemprofile.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemprofile.gif new file mode 100644 index 0000000000000000000000000000000000000000..0324b75c75b515e54e9835439c422c3259353925 GIT binary patch literal 367 zcmZ?wbhEHb6krfwxXQqA)G2e#x~-Khi%y@ved5%Gn)W4KQ`XeAPOGeKKY8xfg)8?~ zZalnx>*4KtPpw?D`R;?~EfZGObj+`;>o|A$u3P#NudL<1d8>Rf=S7sQPi@+s*0kLx zvheVUi#a{}3;GX~OgdCM<5<(26REjXOV;hba{uGJCF>qNeN{RA$kf%Rk6n4Weeba& zr!IG`I5T;}r9EfvA3S<$?v860@4ek{^!DZx_ck57{q)_dqWR6oP9EH{ebs+3U_b?m zKUo+V7_1m{K*AtDF|hSG+|6~?xmR*RrD$`O8ME}#qQi+1l9N`HymYA8dn>navDWHs zr`yh^b?vxcaCaFCgMiY`J$CXF#X~DBRV1ZUYKpi!`5P6D)WzGSmD$+18WoJiB_=8h z2naW-h>NvZ)=pw#;;c}SH`EkwTdvH?%3L95s%M}fx~zy@NlCv#*3?8tS7g6MeZl$K Jj7yFT)&Ls1tE2z` literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemprofile_active.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemprofile_active.gif new file mode 100644 index 0000000000000000000000000000000000000000..da0f78267262fc1fe2a411c5573e751b24815c3f GIT binary patch literal 608 zcmZ?wbhEHb6krfwc*ekR)G2e#x~-Khi%y@ved5%Gn)W4KQ`XeAPOGeKKY8xfg)8?? zpTD_smEIQRXP30)YYet zU3s~E@3AANE_basGkL?MJ!kG8JbG&Gj%ye1z1?v1_U04!HXXbD=;@26?_SB(I2X-t zwwfD#>&2ZzH;$}1weHr7+qYlb{_yR?v6Bb4Y+v>N@$&y4F8sgN^8b3v|2tFuKU(qs z<(~f^F8=@av`>ILFTKfB6l;*iFAmrntY@#Xi_^v7&8<&u` ztCFdNq@VXIK|v8AFE2F-ai1^2>JAP}oSr@{Gd40cb1J>!5|L0~&-Tok=aDhnJA1xY)?BB!cE|X3r}*}xS6=-5 z`SsV!dH=tj`TAh`yDPo_Uv2vTdei?`n-6T8_y11+)8kF|c31qr-G98>e0{0@;a0QF z1!^m@)Hj#t&P`DK4+ac01ByRc7#SE88FWB4fc(V3mV01Afy60^&J&94N1mv3&OXMR zv@^%-{Dk8N-&Sp!>*=D@SF&k-*RH0OHJcQBYxv})#7Y-2%@0)(;o@j$XyS5VYp-$Y y=w@eTRAgiBpV&8HA`j05wwbf%c8iEGO&-Tok=aDhnJA1xY)?BB!cE|X3r}*}xS6=-5 z`SsV!dH=tj`TAh`iwhm^uJrzYwdw!sP5)nQKCo@x|2zFpk2l@hUGe{R|M70~^`-iU zTg^5XsIACS-&~@*wn%?&g5rNLV4wj|{K>+|z@W^a12P-rCkD2H0}~5YX!7-+=*zh2 zsASpe{-o()!JI?=hZ$d0Ir{Olnk@8CnX=KCWz!C0F%F5{D{pV~JIwSxW=3T;=1Ef~PM*TUGnsA9yaj!tqD)hkEMr^I$HK}mg>~JOwd-sA H92u+u%9?ax literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemsearchresult.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemsearchresult.gif new file mode 100644 index 0000000000000000000000000000000000000000..77bbe12aa844d9be4a754da77dfacb21e163c333 GIT binary patch literal 586 zcmZ?wbhEHb6krfwc*ekR@Yu~CKmVlHu56vWu5I$VmD?|U`uh9Zk3V0(|Ni;wPj2(t z@}4cNQ`WamS=TmY-NTpPUw`=d^8L?GUw`$^So!ePj|VTmKYIP+$(tW9-v504@z;kh zzrO$c^X|Hicwe}CG!b92w{cN_L^>)5lU^Y_!~ zdt1b|)rf4X6Cc|Nj|=EKvN(!pOkj$e;uA0Vqxw*q1jrHZ@tawzXR{ zH*xm#_H}kKGBQk=${;I@WNdA) zXYU?sDXl|NCN`$WPaHS5<>q42FtoS2eC4v8z#%P3eMg6T_bxj~s7VMu)?4ae<)F&S z`j%B*_oailvbc)4xPrL$QZcbRoF(awE-Sf2t!zFx9CT*oms6V}WpJRenT=1vLct-y MVP*ePCPoHp08vQPYXATM literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemshell.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemshell.gif new file mode 100644 index 0000000000000000000000000000000000000000..15e83364423ab4c33ef8d7e1db5791434f4a9d77 GIT binary patch literal 357 zcmZ?wbhEHb6krfwxXQo~ozYU>Ftw?F*}|1O)a}#kf=a@&d#23am{T`P(J@cgyVO3a zA$QU~|JwCI4I9InHb=E?iEZB&+p#UNduL+Tj+EY=slB_>`}bt@@6MjMH+S+rm$FrE z<*VH)R(n*g@vdGQ)Ue^)qtBP0emQpkQ`DR@D=)s;eC_?-+aL0_Ju2P#xNh&$_CwDn zAAdRb%J z_l@@zzkM=-1vt#Pnwp!;oJ_b`SYXAU*m?QuI literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemshelllive.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemshelllive.gif new file mode 100644 index 0000000000000000000000000000000000000000..a3f79194a8aa9ec22f14c3fe44e6f30d8000a370 GIT binary patch literal 366 zcmZ?wbhEHb6krfwxXQo~ozYU>Ftw?F*}|1O)a}#kf=a@&d#23am{T`P(J@cgyVO3a z;qIfC{bLz-~MN9XO|`!4+4($tvO z)0(w#V#2K6l*ygx+vkR@n-RTyO6=xY5&yw}0WVPe$->CMV9KBaQU&r816%ijSp^;< zle#>VUd~XNHcjiTu+wZ9|#y=K=CIFBLf2qgAPalq?UnM-DB6C se+H*KSGPI{Jg_)D+t@^bouxr?meg(`r<-}k;@K}e_rH4jo0GvB04eApWdHyG literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemunixlive_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemunixlive_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..cd8c312d476fff03504d4fd38339ba35c0f14ca5 GIT binary patch literal 145 zcmZ?wbhEHb6krfw*v!CS9<#J<)}aIE?>+wZU#`ZvZ|_2r&QOLl;f{~a+rRf+__^i( z|Njg~K=CIFBLf3BgAPaxWCjC^UBO9D)s-_Q&Ca~ZbzPS;N$L0w5w^xv!V?dP-DNz) olwjTZdWPfE?aV9;t_g{HJihT-T1fmPMO|Q?_Q!JXNvkj{c+%Hhq`eCtvcMay4?gHEU(OQmSCqwxGgA@v8CMlUB9cP30*(rKc7|F0UH*c`cc*V_N5 z8U9~T`hQ$t^Hke!>lps8XLz?x>gHsID>D@DbTQs-Ww_bG@MT-<^Z5>6Hw5ip(r|V| z_p>Ix{}aXb6svx261>;%aAkh_-zf%vCL8}>75Aq_?qiF_n>M3wb0hvIvwTWo`=2BD zb4A&n*2K?6>dz}JHs^W#IKKKxzS;i}fmaEtZ)cQWwBdVRSTny@1ULJJrU}|Lf za^|G7M&JSo?;3%d6H^v6sOv>JFkEPH6O?r>QjmPn*xDs1Wf4?HfP;_EsmozwH j*_`S%-B3tCsv@|pTihUC!lCC&$JtrB+-}Z191PX~?Z-nO literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemwinlive_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/systemwinlive_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..6abee63786a37425f4b1e5e532decdf79bbc7391 GIT binary patch literal 1007 zcmZ?wbhEHb6krfw_|CxaW95d0eN$fdZvMOW%Kz~F+ZJxTn0n^_=l{Q^{=YZx`Qr&6 zU(EXd@WA&){TnWxzuewArLJ?s@oT>sj26fQ@3zZ7;uhb-U^Ba*bCXc;4ut!E)K7aT1`SZ6A-+z1l>ciu(R_Th)#EUl%$5f~nbXzZ7KdGiS zc*e}W%hwtYAE^ERSo;4XoBvlC{$H2<|G@g;oumJ+$^O4;aAI@h-d$_|pJw=fLFxZ- zfz4BGzpZ2VznO|zr&UJ>3^pf{F!Y0e^uO{7P*ft8gJT+zJGl4ZEnQ>WR_1!Z2xlvf37I| zT%`WI(qeO-$B*NypX8hU4-t5kp!#-3`9&MP=S9B%4H)ifG2GH-Jg>|8F--588pG`= zJ9A_A0Ib}Qo7IZgpaPG2*_~0*T)x;)S zv2g>tb0hPoGcPA+Oq7+gc6v9#u)u$=MT3Cmp^r>$-4o5&K1D8Wzp&8Bu!W^ivDt&E zk>$gIox&$3%$M|N*zut-WdVblZiEfPf+cPf<(*3;ByS|TatTVB1w=YMcI#8&W2>`R zc&NFBtLU6bVbM_@rbZsO1qKHbof^!N=lOIBr73U-DSAaL_~3R{Tr+HsiPQ>4r$#mj ny&a0dtX*OTfBjER5zw6wC}k2MvSFUA0E0CEa>G(P literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_action_ibm_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_action_ibm_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..802d0ebe890983f9af0ac6e25588a094ef55c2d7 GIT binary patch literal 338 zcmZ?wbhEHb6krfwxXQq=X2a=evo=nhwK2b>t)XpZ9*}IG5tmX}(=k6Ov)nCxiC5Ng z-@H{mne!sb)~7aYPixwq)3d*z|3Jy4L$x!GHO)B@ms)t`{>RGcN2abmeeBB1t`%n{ zZ@9GQ%>B7Lu3fzMcEi!zn@`-^bnJFmd`4J8hF?UyUu1%NP`Hy{;L~@n{(}Jn1wip9 z3nK%AHiHhx43M7~*zymECVA+r>+@*IIvJxh;pEe&j5{qBx-VVDbjV~~gs$q9f(GHh zt4j}VST#>OPmO@O`A4Mc4V*y05Gw8+5i9m literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_action_ibm_user_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_action_ibm_user_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..15d6f4ba853da500e39e552732b5e44b29a390a7 GIT binary patch literal 361 zcmV-v0hazpNk%w1VGsZi0M!5htgy?Lnz5Cdv2S#SfQFfFbcTS3n9I-EUSx56h@WC< zceTRXO>U}8X`WbiuVsR_W`ei3!`N($zi^Mhbdth-n8t#f$X;b})Zg*d-RgOl#KzR= zim1%I%-_`C?IJ^Gow(M~-tDl(+q1~tvc}t1UuaffXiivPPFY|_QddGwQM0(YBN5a=E#$LSCe>Ak7+oLX*iE;K9F!jkZ?qjbV_SgIFD&L|NsC0|Nj60 z00000A^8LW002DzEC2ui01yBW000Jtz+PfVEcSZ3*h|Q3I-7@{ObKK1Fb@a@I-}04 z7LlgW%u#d4M6)t#IC!_#3x+#dF%8Dn=5payc4`>5U1_33nb|?e_04KmlDapyl HsX+ic{u`t( literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_action_new_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_action_new_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..b595eb20bf27eb0063c8bfd882dcbb010c1952d3 GIT binary patch literal 370 zcmV-&0ge7gNk%w1VGsZi0M!5h|C#@+u*;U3v6Y&!Z*+!$hM8`3hJc5dUSx4%X?I>_ zaaLbwR$ypOSYJ+AU`J9{LQYZs{qNJnd&#$NZDc;y#CzP!hW+%htz~j%JaT3| zZe%`fV?OBJw*B+ZwUHyWk|Vm8CT?Rs{O6b z%Ub5vTY^H7Q0Qn2OL#e->T>yfE~?+E+T&$?DJdi;>-T(jq literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_action_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_action_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..556c02836333ee70df93ad0162414dcd51fff64f GIT binary patch literal 353 zcmZ?wbhEHb6krfwxXQq=X2a=evo=nhwK2b>t)XpZ9*}IG5tmY!lvy5^S{N3e5tfkQ z7ZL9lncyB2?&KGE`AGH2?fJPWcGr$n-#Oj3XIa#twW&pEHbrT+c`0_e$#yU9ZmY<& z&P%p?ba`n@zIk)L`H>Y7bvc%`IhN%a)-$UOrdAkEC^eo?W<0abs;kI!!xZniHTtuv z47yX5a{Oifg8>84K=CIFBLjmWgAPas$WIJxbq6G}J#>!soe;}888dBy$K|5QUb)lM zUI=dWi40r+)KfaRR8j9*P^pW8=RZ|1V5&*zbjzr@wlTAuk{7w9FY(G+?v^sgH*b|s=DdWu zZD~#0yBD7gDBG0Nv%jGKK*^*-71NG3%{kFF|CE3E#-Pg0p;ep1Yqmz#ZHsN(kCc8?p%EM=B*c>K79Li?%v}E&t5!u`TD_&mq)MPxOVsM`8&6tynXfb z-K#s#ZvFfF{_mIbe?On!I#GG+B;{Sx)&4wRJg-u0S)XG0Q2fcl$iU#kpaXIsC{7sIXE*pXHMg`j>+tgEv^lkkSjcj>I@$I%3+u>owKzE1 zIy$xpakhBa+1cCMc{B-HY0PeRcXxJkZ4$6H)sSazaq)C%=C{^RQD@WEI<4(>O5aD? zSVLKc)$qm*qZ@iYQs$b9s?6R`pLrYJ^^vqu<1&2y>}8XLnG(l`k1t+{n<%i{WGWI) dQEX>tG>FoOSs@@L%r45nV&JkdX`usyH2@Z8#%TZm literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_type_ibm_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_type_ibm_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..8d1885ba6d462b50c91d83917187da89c1d6ba3d GIT binary patch literal 341 zcmV-b0jmB-Nk%w1VGsZi0M!5hE>D#%P?a=QmpNLUJzSbXW1>c9q)KY1Mr52#ZmLXa zo?w2qW`ehiqs>ruvTTgMaF4)rlEQeF#e$s3hM&q$cd=4=vsHStSA4ZuezskKxM+#I zcb39=m&Asn&6TUmh^5Y>yV{GW&5Nncim1$zuhf#S(vz^#ow(Mx%iKtaxVF#ZxXaoY zXrM57taY8aqr=(S=fGkq|NsC0|Nj60 z00000A^8LW002DzEC2ui01yBW000JZz@BhOEDl)>2Fqxq+&T+pal+~-q(w;rON``D zS1v?HLwye1hYm$L8CI&eT=nX0WT+9R5bOKGtbv+Ih00CULML_^Nw%MdP literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_type_ibm_user_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_type_ibm_user_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..19ef4a224c6eba8e3117289ae1313a6594f2791b GIT binary patch literal 577 zcmZ?wbhEHb6krfwc*ek>=RZ|1V5&*zbjzr@wlTAuk{7w9FY(G+?v^sgH*b|s=DdWu zZD~#0yBD7gDBG0Nv%jGKK*^*-71NG3%{kFF|CE3E#-Pg0p;ep1Yqmz#ZHsN(k7B^VW+`AHMxMckl6oXD=SSeEs0X%cIwCT)TVs{GHoR-oASJ z?$w=Vw{BlvxO+?2hZ`$i9;y5G?8M}n@G14NQyUW|R|NKFTJ&XF^yk=3C~%%o;4-Pi zD?8MpKhyF*7%&Vnp!k!8k%7UVK?me6P@FKZ&uj2+YHn$5*5T#RX>0ar60wlw?(uhV zY!cRy~Wg!&?IQ3Ij6;SnXA8mwW+2&d$ad4?O94XQs1-FH{Ep0d&E-qSlxb5^jixmtC3`@JknHd?Z0noe22mk;8 literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_type_new_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_type_new_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..823609da24a3264223dd67f8a949052be521b1e0 GIT binary patch literal 577 zcmZ?wbhEHb6krfwc*ek>Fu5YIKhvTw)1p7eZbE_cgaVgIC0^N~ z7X6u)|G|J^kO9S?EQ|~c{tP-GcY)%BfqhCi#u`&Cr^9W1JS^F{gy1V)L-D*|%<$sHD}NO}SUE+gEauI%Db-s literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_type_obj.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/obj16/user_type_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..2ecef415faf0314feaf64c575b1b855defa69b64 GIT binary patch literal 341 zcmV-b0jmB-Nk%w1VGsZi0M!5hNQk($&*Kb)C7R!`a&C^7HVe?&oyp-gfiu zrR3Oe=iiU;>7nrHs_Wi+@aLf0%yiq#dB3Vv!K_!sv0%ioV9dH|&%Jc9nM1*VJvcFD@f6|Aq{Yq-OEf7i zS8nUzxOjBj(%~|xU&m(|P~j9sGC5=ig!9 ze~115orwN_Hv8Y%?EhzT{#_{fe|P52T!toJhFEikBMmA?nsin*c&=^sUft-my2)!} zyWhGN-wo~lTf2fbbp#%m8nb^&%;6dF2dBjynVE26QU3ZC-_0F?ho{G%Ti1H`%+CM+ z|1(ek6o0ZXGB9W}=zz=s`H6uoL8|Q$HlX#>H-FMxN#tMp;)GW`2IY3_f07CN&ocR)OgW e(*;;0TqHHw+1VB^(Ufu(U%6^^=-Rc84AuaX)Op?j literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/ovr16/error_ovr.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/ovr16/error_ovr.gif new file mode 100644 index 0000000000000000000000000000000000000000..119dcccd5a7dce3fef6029bdaa5017cbacfa35ab GIT binary patch literal 82 zcmZ?wbhEHbWM|-DSj50^!^!_{blT(chUXm8dYK!wBBy9aOw^8;pdHq$o3r)z-~WyK-gX^+H|^BNr5C?!x%K1Fqu&=^ z{r&#u|L5QT-~al5_4EJNKmWh`_5bD1|8IW%fB*ac=Rf~{|NH;z-~Y4c&t@msbr%~q z=b2V#S`?>Pr^VPOMmkQb)SpylFsaP2r`V_^&$K4f;{X5u47h>fPZmZ71~Ud7kP?ue z7}zQtX8ST#8i;VVEL6zh;uby4I{9MG48MgcP8k+z-OOg(zh|76j|h|a-Eptr=B;H# z?C;*+ob!#5m4#7RS-V(AUap)`QN^@aS6)?>aiXk7r=O<0j7(=|gP)$fnh2wax(M@h eU;Q-^f78}2yEi#9SOWlu>Xowq literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/view16/editor.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/view16/editor.gif new file mode 100644 index 0000000000000000000000000000000000000000..007e98dc702996ae8614878e2048b0c884b4a3d7 GIT binary patch literal 591 zcmZ?wbhEHb6krfwc*el+_wT=tpMU-M`RD8RKW{$#Y@f2WXWFXgZ-0LN1{C@I>-XOu zKYz!SEzWIO8(%yvp?F$h(}M14tM0$}@#xjhN3VW-`0~49%9h3{Tbd@Wn!fzNjO7QG zZ@<(xd&Bx&XV&dHGilbcPat!CO`5$-$vOS^pTDaQUO9I1^vwAS7cQBza^w2Vho@KdXIk`S zTJ-1G_2=46C~%%o;Bs_U;-nI zVrb&;>);?DB`GN-;N{@!uWx8w^Je?aI(A%~inlnmoLX#kb#0iW&+#y7y0lnYS-UASvwULFaBlHX zQ&3jsc*d^o!6Ez8V4)K$7l&Y%g_DLS3#WjxlgWgZ3zL{6jI&~#PH;}{S8%q9bSVl@ HV6X-N3G>&j literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/view16/errorlist_view.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/view16/errorlist_view.gif new file mode 100644 index 0000000000000000000000000000000000000000..cc87d38aa0a1b26e02c85a621d6ce447e9dbf97c GIT binary patch literal 604 zcmZ?wbhEHb6krfwc*ekRP*ifisKkH&p#KTU|H~_`ib-D)lfEOR@ZUfDe{j@C|Iq)T zQ6GcDKZQpAk4^laSNzh{?tg6B|E$8lfB)q*uPf=?bn4QhZ$JM0{`2qWuRlM2{;ulZ z);i}%$D9N2KmTf&w!3TLi3!V3Pg{GjZ_$y7OOMapbZzO*+h?vmxpeFK(>Fh!zx%o7 z;KR+wpY_gI`Rc>Z2d{oSdj0*)r(a*b|9<@D`}6ldKYsiD{ny{0zyHpfIbrVX-UV~J zmoDg>J+uGz&GY*Yt0?n7Kj(jL?*FAr|F2l_9}E}<2T=UU!pOi7#GnIm4k%6-*mpJrH3fNj`gnOb zcXc~A`}q5M`}+t>PMg*n)F0^YKWEBxNtYl2UcY&B{Fns9L`9@rgBS%lI06H=3NlKF z@3jkJ=jL4D&&kccR>a6{3D>;2bGQV|O|RNFvGE58@dfa+s!Okvb7*GeVP@fBH8Xto z&b@gFJA;6Rto$PpJ;zVBCR!OBG8zT#Hj0`a6C^GwwmP?4J$c$-$lT^Cq3BT1FwuG5 e6fu3LeFBCY?EL*f5o-(rnUm1RU=08!bm#>D literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/view16/fastopen.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/view16/fastopen.gif new file mode 100644 index 0000000000000000000000000000000000000000..7802b6dceff7aba594d0a02d6d58564a62d27b43 GIT binary patch literal 1023 zcmZ?wbhEHb6krfw_|Cxa|KI=5Uw{Aj`RCoIU!T7I{{83Q&tHFj{QTWEYhTa&Lm$5U zp1kbXtTm?>Z9czZ$K^G9u0DD5^ZLD4&)@yL_vGE%PrttY`1|?W?^hpw{`mFx+mGMR z-u?XW_4nuRe?EQt{q@K1?>~R)n&5(I1 z;q%khU)W|pCBSJ~aMJSp>{aCfQ)8l*q*ttOH0^h`pXTGyADlQZ%Xx}V(5z^~HcRzF z9n*H}Y5Qin&GgD!SvX6}*=;jp|4iE^yV&`$a}Lj$yMK;Pn|st^zs+aY zr_2v&*ppMRBtB+~kK9}i~y`FwLjzulT1hvi*P%e$QxbvXaH(edC!|DX5gZ=Bn@ zWrFRG3lWn9^md24UYpEoD}yuW;PQ|6Bg4S(L8+0$yYrQT?1j>_61?LGBIhg;3= z9bYpqO?_>V{=Fm1ZyZ`VFJ87kNb)}zFpL7ahk)Ww7Dfh!W(FOQ&7eHNz;TCxoioOH zgMwothu}KH0~;33HsuuT`l;}M!Id%pi9?UYG3I7gPJtAM&&$rv=t$v+c#)vk&^lf0 zl**Unw8PBoymoCN32Y1HwBs}aBosuN19`FpuI>Ev^w3#0K?eiRBy=@7Znyd zF^X6$3Yqw6Nk@lc*`b0)gN5hkiF;4sn8mcTv){4eQOd&$>^{?_Jo-3N*)cIGV1Zpu(B{VCq+|TbPE{8o6esk* Vyr(i@&6oeUS1ZCW?t2F1+Ffx77m4UDZWXQTEx<21ZK_@pO&sJxnO}9 jqa5SBkR^=E)Y&BFEm2crV`CDT$GmDa)4JvHjttfSUlN1n literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/view16/system_persp.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/view16/system_persp.gif new file mode 100644 index 0000000000000000000000000000000000000000..592d46f7b72fac5d4d2879c7c248c99d4d167f7e GIT binary patch literal 606 zcmZ?wbhEHb6krfwc*ekR)G2e#x~-*EU6n11YTB1{O<7adI<2y{edWf(>$e`>zW3D1 zHJe)|tgNi-@QExueBxqiZq<@?`{ylLw{Y3I=B_D6PF>cHoT?o@Vb#I=n)yexl2>RY zEYgl&s1-9?8;GK&YDY}a4(nZc@c!iE9~<|*?Kt#){<+U=`~Ua9|9}7c|MAcNuYdpl`uG3GzyDo*eSiM{ z@1H)kXnu2adVEYq{H%GCkDWZYW&5g$lRB3!n^=?|x^Z3q-fcZKReANLPG?SRe);rb zYlXv!z1??jp6IKwTfLxkMw9iL9@E9`7EL97oBB=u|NqZ0a6s`V3nK$V7=sST37|M( zVBg&krl=q$D=j7A$k*ND7$&Krs;s82#V0yr1|wgSxV)T)70&E}Q~D=X_dd?E`EpSYNsTeW1} z{&`E*EnK#4``%+mPF)tsb`i~X7R_;%DfEyj^i(PL*RBawDfiQ^2{CAhD4O3~u%V!0 zL&1U*4aZI%+_HVu|KI2S|NqZGG*JA>!pOj2$e;t#0rC?ATl;|-1sWxZeIDWyJAPWs zM9N(=M}v^#4~o-83PHbZP8JG+{Wu8s!B;>COuxwzD|4YXBPtl;LK$jGQXUq^+J biJ6U4YNC^(g3=Lvx#M!~`Y~q=9T}_vHj0Sg literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/view16/team_view.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/view16/team_view.gif new file mode 100644 index 0000000000000000000000000000000000000000..88c056795d56a510d7ea3dcd2b5b11f3db11384e GIT binary patch literal 139 zcmZ?wbhEHb6krfw*v!BnlDS$SwCmuD|Ns9V|Nn8t|I3v-n!S$n`mZQ;UQyyaC(8~f z!GHu5f3h$#FmN;IfW$y%FtAt@ob+71*W&u&tv1d#QrQxPjw!8q(;`wZQO7aY-)miU g(1%`$157GbEX+%TSA|v{P21j;cYJkJr67Yf0B0C8{r~^~ literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/wizban/export_wiz.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/wizban/export_wiz.gif new file mode 100644 index 0000000000000000000000000000000000000000..41a7823215cf4dc9818dc870e7675a0b988246c3 GIT binary patch literal 2816 zcmV+b3;*;-Nk%w1VM_o)0QUd@|NsBq=J@FD`uzR=`1<|K#nJ2V`q|UB-{<(rs!^A; z*Z2ATw8q=w=JMs~^yBLJyS&8F&Dk$QS-QNuo_HDX^!%`dB<1Y+iK4aa@%!oS`q|m# zYH)Sx@A_$nv+C^g_W1pilbUvy#&CLt_T!z!uyyg>lkW2S;o|N3{Qkqm%8sPS_|<#% z$Zhw_aD|??_QYxQ=d}0FbobJC^}%NN*?;-phV{N;`P_o@^Yi%NjQ8S~_~DWE4_TAy{_Q!(p>dQGg?pi+~Mweyz0~UZ>8st}?9JHZjggYq+3D`_`T6Rz z%*N6E?$<0nQ~KbXB}8KT=A-!e{7rJI=HkrR)!x+7;PUhNSaF}l$mu!kt^ z@cH=Lf#KfgsIkA?;`51`u1;^E($C!Y>bT$D;M?f&zN2By&D!|TkL&OG{{H!gtl0P1 ze&_A_y~o$u-|+k8!~OBv^W?3QmX~6GuXmEJ`0Kgv^7*jA+opvvu#r8gtFQd)&Yq#H z`{c3f@cT$)e*5LP_W1nw`26SR=ji9{%GBS&u6i&{gHUavtC>D#NP zyxP;!;J?k{A^8LV00000EC2ui080Qu000R8009UbNU)&6g9sBUTuAWDnle)aFq}xS z;=}=`!bB9n(W1wX6VIGtQ=uKllM+FyTnQk>f*%kyXh7MKrOl8jK>YYop+gm!G*jLj zdT@r(}4pNv0=lrodKmkXEuF0bijhCQ!5x4iFfDl)wGM`Fc(^)O?os1PhJ45I<;WI6ENVi@i!j27Ooj+HSJy|#0HBUFH}vS^k3a?~B#<*|Xrp&H0$>ddOg8D{ zlTbzpWsx=3cB4ngU<1RJTz2W@mtcZPC399@0L23;A@fZOY_{p&}hIV+gyMI0($bvr=RS|VCkipW~%9?n_;3>hw>$mu6xQA_3nEX)K_o)_1Ig#$M$WsaReR*9MHu9xE~ETxD!btJtt(e z@BaJn$G^$^bIbt@KHY;aekENrA9?A!W5^k#=Q}eP@PG(RU;@eDg$CO1er>=59=bq5 z{`oI=NDJIVP)9&Ql;DFP450`|NWv0w;t5CNlNDCTLMu>&fW1pW3W&1+5U79y%m@bu z!VrcE_^?2UflDX96$18k77GTJu9>LI!Pw)W%|1gIj2lSAq~WM#Q=aA%(c*B z5;rV{K2@Oq0tooipP2wfHnI7Lf)=z1BVa}~#K6#oGE^804FovFX$5cwq90_bdh@R?5n1qmz5);Hp^7>Q$w&1tNGL5nx4xSP?;mvQnWB zYCuH<*1A?`Y(W@-(8DJx%C%KAq8~(n1uUANg^!XVq*A3JJPy$aVou<&h)pbFAy5q> zxPupvg{&?n+XpI0fEAgDgJ$CpiU>eM7_BfWUAZQZq|Ra*c8G#KB0&l+oFcG4NW}-{ z0nKp#s39C7$gOU78-jHd02jb5fN+Of0A^e^6QvL?E;zddG01ha&?87A=rIdBWMj3h z6=^(%F^Oe7Lam{QLn+3K3*wshyyqdyMkvrr-~yvp4VfTr9H8Ocxjv7y0KkSRB=Lb2U_b&G(ZG@_=Sc~;fr`2;>SQf#4v_Dj8vqe9JWYu zGLmtPYji>;MJ(b4ri{cYBLN9Y@PYXzCy*J(Z~zVXg9q-h0+Eu`k$Qni8F*+(Aa3W~ z5=-I8HX1c$Go1;8^c{$oV<B+Fq9vFq0r@9uZsF}?^yd->r=odz7WzKcB^Zy>KK^d#h(wAPt6;|Mjz!KWih6Z(_ zNj(-*J37@!Ty+L{wTf56T82?Q#ij|so=)#1*N7IiqDviT0ie3h!N#-OXbi(kr(g}> zUiPh@edsoi`pwn8Hl&43-x(X5&&Uq9t!r55a);W@i%$2WRjuudxx3r3mN!Y+LvLK$ Sd)Mf0w6*u0ZAqUhAOJhh`uR!# literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/wizban/import_wiz.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/wizban/import_wiz.gif new file mode 100644 index 0000000000000000000000000000000000000000..caffb689e6a68e38b04d26079ba601b6131b3457 GIT binary patch literal 2960 zcmV;B3vcvCNk%w1VM_o)0QUd@|NsBq=J@FD`s?ue-{<)2=+ort`L4+3^tM{k%-7r5 z+|{<)$&|2zBlr3J>F)aY`u*zf`uf_c?D6}0p32gqPw@2o@a)v%>iPWr{^Z-Y z;^y+ExzkyAsi&!{<=n)Fm8RwF`RDEW_sD~pbQ8?Q(QAjc`uzUw@%!oT`r+vK;OF?} z=H|?~iQ(z^;OO|`>G>SH)_nKRb@urE?(+Nh%yIbBc=_Ff_Qh)T!DjZz zZS}rm^!NPu+JO1rhxp))_u`rL<*N4MpZ4UX_~Db?-s$J<_w?ql^yjuZRf+oh{`2U( z*UO~x_5AYb!t?h0m8#9}^ZUZj%kr*L)zRJR@cQ!V$8vaj?ehEa_58+_Hg|rF^S^km zxybJG`|<0|?(p`*vWEA`nnqV_#?t1yrfxu7jlROd_4WDe>F)LT{jI6ChKh~6!_)Kf z_5S|FxH>+w9}jsm;;ToV3?QW0n2w*3!+j>E+Gs-Jl?*$cA){x{8jF;NtG!-sR%t?(FXN+1KLt-G=Y;{Pe?p+}zv!{r}|H zt%91vD@T3q?eWI7hpNEdsfRQ9`u^d}p5)Y}=Gdb=PGsom@Y&I?^xu-O!Q1}-|8{_r zSZ;`nk(21|`0=xEH&JZr?C~=^N$T$TdzHWI@cS=WfcW_Q_1=rf6=9*VN$t`}I|Ej`Hr|`{KFh?fLl7itga7gmgst_VDQC>+a;fkhkLf{Qds) z=*-BoyvEo2`~0Y{y}h`^*Wcy#=g?z;u)Uc~#LU}^tJ9FL*7x}Os(&9cP=&hF)!?~! zPIsR8*?;oqyXx@!_W1nfnO{FbD(?CId&1#|qC^zH(W1wX6X&#YQ^_93lM+FyTnPZh10WC~KtS1%rOl8iZU6ytL4pdIG*jLj zdeDhZm?r(}CFzxp4!eQm_F^f6i?BbZDsuQ>R`SKsGB=lwEC#ym4bH5HS?U zVqLlwZCaHs*|r6OgF@W0bc5dgI48m(y*jz1@GIAB-IIeYx;%84EfB?v|IXDaI5I<9 ztsXp}Y#9e;#(+6DGsE1> zuIIb#T(MAFvTo6ofmFfa8+huokPU+Wu+Ys6f-C6lNJr0}y_XUoCfagx9lLfh+)rzE z+_@mDaA2q>;D7`Q=m0C#EL2!-_1#cK75H_B+GgO@1i&*OfY5*i6WD>khaiS1;)hq1 zkVb|mrkEi;5iqFRA(cEBp?<-sX4fEI*QpK7|ulbcFPxSw!#L3vLPj5g}%qmV`#X`rIrP>Gvw&dB7UHi}?C1_HTY z%mh4?YU-(|rmCu{lpfN>rG&!&X=rc|h>*bw1O%XK0HGQqjSs*EE9|hu7F#T(Q@o04 zp)_Vuj0iChkn66y_L{@B*k-Hkw%m3bC=gvJ8>^-%3?P6AFRTCq3(`_sEdVZLV#B=j z)@$#*_~xtT4N-&(Yo^?#pn|O##E|Z~?Yhe=yqW0W@WT*CEb+t?6Zyat{fe7uFy|WZ zX~74xJFUB+W>Uk+D5tFQ$}G1`B*q#4Tg3n)h+wnF8Gx*=$OLmT#)s-;R3Wh_2_Z)tnleX1TXyX z#20V;@U$$j!0e3tb^BJjCl2@GbHD3?9!6xZ{r22<@BQ|UgzrcR&D#!o?ufrly6;(E zf5iLn$1nf<^v54a_<@k`{Q1$V-#g>h%R~_dNWcOb@PG&;;4}ge2w3E=d;@r1=ys>L zt5r`|C0l|9H^{*bdhmlAoQ5G_0SiOu&wRM+AMdDVI(RjJ2{4SI3};Bg8phBNrZ9yb zOb9^@ta2t+Jn7Jv8yBGTwX6}Az87=#xTFhI&un(~yVEWj8F z00=-7q7am{BqK7pjZFe_ih^7pD1A0cRQmFl1qdc9Tlq>@RX;sGBJg(wXsN>Lhc;G!74=n7(x zhg$saf(tXq2R=XwIP4)C0R5*ESej*k6=tVDNK~oxF!V{RtsV8>IQ%?Bwr<{<1 zPwR2fj(W77Srh3DI!K!#Mvq79g^MoyK%Rb?z<5n)KeR~I4HB$)NA zXib6)WI)u8uHvYKOlmfj7#-~tzr zI0I}Gk$~=cHvzH*MG`pBi%8I54+mI91%N>X17P-DP?3Zj=-Pt%+V{TpO+X?#AdLRf z;lI2H@EOiv2}^v#1c^ulg29_uPSBtjSs()q4sd{SoIn#)DDDuu!G=^=qZ6P|#1=+O z;u4ow5sC1|EmnMsFSyvnA&7-9-e7_n*BHDCkO2*%Api)}103K$!zxZ7juT8`1@G0B z9NN$cWGL9iP>!;crwru~%oxhf1;rvbpoFb}!wM8uM+H3K0dbr{!|rN>G8BM}@4ET_ z&2Wx$0>0pl?_xo`9KZ+Y^3VZ3V50($P{SiA;Q?TvnOfbDgrXNMiF2HT4UmpB8xD%l zgj#x`m?lF*J@E-Vc>2>4P~%VdY>o<0A{~SvL^=koi9^FzAajVd22en26gc75PH07o zT(lRMpbb-^z>i{3b2~l*I@PI01u6*fh!eOvlmn6VtZR+yT<=;py`I9a-4tx!5L*Iy z-~%xFpoVgny9wy-gE*cYQUJvIsne!)wROEFwot{_O+ym5h3%azpn(rm2>2vUaSC8) zLK8&JM?R1o*UZ{t4)Bh*t#M6n2HATj+Rity`TcDP{Gu2m0J+;d6@!u|Ii&AxhAOow ze(eWb9N+!gxVNPUJvK7ajqiGRDI#9$iQl^7mCE+EFVO8_(|m%`(FM#<*5c>w z`q0YOhKY*d-R0TY*}S~Hw#vQZ;p+17^kiym?d>7el=Ir^#)yv7r$&r+m)6>)F?DjNoR5FQN^7j1J z(%j9>&8w`e8GTI7$kgQG>E-3+=;rKcZ*kw-P6@9OXR?ehEQ zI~IFJ=IHX%&f41A=iT1w*x2N3qKV(+^4!?r_xJbS6;?)LZk)X&=7;qctt=;rG6@bmetudvk6+}70K-r?@N z&cfQ+K+t&D=lIOU(f9fN>F)aY z`u*(j`{nHU@bvuc@%#Gw{`va;`TPFv^84xU`rzmI;pzC`==kC2`1bhy;_3L~>iO^U z`{L^P-nLhr1<*&tI_5AYn{O9k`t|tz{r&&;`Tgi_x=6-*VNzH+2$C0N9*wW_4fMk z^ZfJk_Wu6<*4EbM>-hNj{rmg<>FMe1@%o>kqSeyg+1lo(sj2Di_}}91?eY2h{QmUy z`fae1xVX8ryubJN`|R)d?(z9hly2bT@TI4x)Zp0f?(>$pq>{U-nYyO$^7-uW`t0!g z?D6_}vX|xS`0nxghM~ZbY7NwhJ$NU)&6g9sBUTu2a>CIgusF`P)T z;zU}TTt$4u(W1wX6Jc$dWosSBlM+FyT-hkwq*)LtQ9{{~rOlApM$MXqX@@77G*jLj zdQg*2n3;C?1WJ>r(}CG)?Id{&lG2|un?4;%>*Z8TkiuSNigK$>k)w{zdSxlB)uma> znpNpCtxf}-EVUI2H|X4tx>nV)JIVl$OnTjpjeGL1MVGY(r=4{e@!q#s{W@m2Yty7j zktcVmoS1KBt(z0ls`MH3;I*SOSytQ^b!vkyTf3fRs#EOQrpY$GU2qpC-JhkJdgYt+ z<;9wb3xu_bHS$rWmN%DO8nf`4(qmQs8jrk|t?bNycZY8KqlOv)GK?`H;6lP|9 zN84!@5(r<02pXixCLiW!-6*z<=--4Vl0^b4rLcsdh6zr`$tEy@$XYF})Cl2?Ch|oI z38jbR~p!2BMuEoWQ_UE(n^?1 zjwu@?kE8;MD4~3k=9+A-^ka*0%Gu?3qquUXk|g?;i6>B=Ldu_k4oaw%hGL0eqKeY_ zrK5O~cub$H@MtNff~rYqn=ID$<)XF8D2Dm~hq^3Zkz$KTYl4>cd0@~`PoL=au zthCxXXLT^?`e=W$D4+ldzzVDCrN(OdYNr73p$CGq)*9+6lNgXIsiw%nk+s+cJ8ZF; zy1HhY4y<9p2^W;>ER2=Fv@Ryc{Pga%+0M&ty~tkKg#$WRKt;dJhFX}qm{=mqQU}MY zEwKw9yQz;8yub`J5>sq0moMeYLs%Od{0O`WZ_BE;_ZnI<3eY@okIK%j0+T7F#hew* z^4i?3y@g&lK{Y7M;4{#2j?zjez!}|f%^=^*G?gTe8I%pQ(8)0WxAtCIyX~>UUeE0jJQ$3iI1G$4uJ{Psq}xg^erMe_(jU_+ z^0yvUfWaGrgf6-u;k>cJ2?vfQ!XJNZu|+@rgpY;?x5yWAS zDpX+)7~F#r?l1-U-Kz#5450`|7(x~BPkH|f-~dhH^^ZY zZjgm6C}9d6oFCZ#xIk;ere3$_=bf5<^SaOmxD26J9 zAcR9IQUvj4+lNzl| z031734Dz?eZZhDiOb$|gKIVnsZFyNe0q@oqS+06tbfC$h`qzJN51tVN@ zbN8}?KKIH0&wlPx1wZIt3E%+_a;(q?7r4M87P?S>`tzN|Fr)}>fDd~Z;RzgI81WLa z3tG@37O}`i0nE^j9|Qm$!ANN^%z*>w4HFA64T4N(8iYXv0SjL6!Zg0%P9n52j9{qe z`3kpDgy_PfB2|MK5O5A3{NSliHHK85DhC+!VF6gp>H_-E2R5()r@zR9J0q$E5y0UZ zMmPWmKoK&WHSHj2paD22LJ^?A*S_|(8@LE;U}F#itoA_>LC`5N-q}hK z1Og1=P%A&;rcurr1QxLhwS5?b7k;r=F$kfoU_k2uJm7}RwKbav zA;TCXa0VLu_On>%11^k9UP%C>u&iAyBAy!vI7D{3Zs3~c+zPgWEQ1Vc;I4N)D_k}# z02t*(EqbxQ+ysb03t9+72dr=aL-?Z^Z?i5@Eh~^`Y?lH~$Uy^a@YxmwK@nUHv52{v z)x##X1Zf+8FF$azrj zf$;!`1v@weZ8%zl2`9IrF2lk(-f<6PaMuQG*alz@bC?N0<}#OA#es;xf`Q;48aSTe8@9=8(zM2IBX)7rkAl?O-wyY<^WzM2A4Og19ud2#9cgRB zZNBo>wnw>*Z*b3Q-}*T>z@;Vd%DG$0v!?8v!3GP3+q>KOemJ=!{%>_reBBl!kM+Cb ktnpgI$>R+7w!_6e@_ze!Clhy6#oMiNj9Nk%w1VM_o)0QUd@|NsBq=J@&g{OIob>+t&D=lIyu-R$xE_xb(h?D^&D z^vl%Y>F)aM@b>un{oUp9$j#g5?fUBP`ttJgXL*V6^!&%j%jD_u^!EDg@%vA2aXwjh z-r?+Pa(247!|Ct(;o$1y)4t*8_~GgJ`TG9g=lJu=mzABS;OO}7^84cH_};#eiKJmjppq6-qfs{^r)e=BHXWVTtzm`}X+#FxCQ{OhSvJ?Dg8#;L6h3;N9kynVjnH_T1X!!^F9;sh9Ef{Nd>H)y%x_^7!7~=;-Y7thmnl z{Qjh|%JB2}^7Z_=#Mal{>H7Qrg^G;jGApd{_yhnvb(n4Fo6O`TeA{w5hkX<>v7I{{O11t?%>vUxtpM)-QeBcF)OP z_WIeabmZaY-Qnce-s+E%m(|)Y7kt+}@1hAdU=hWfk^62jQjE+t*P?Dgd9_{7oI{{R2Z(bVDP>chaY;O6k- z=*KF++sLWT%+#W`t0!g{QCIp@%ruX`{2~c_W1nw`1|DP_vPyN`uhCk>-e_5xbE@$qotDGa1WJ>r(}6bX$dO|t5ikNuf6i?BbSN(bQ>RuSKsGB=lwEC#+_7V-ks}Al zVqLlwZCaHs*|s&3;y~Q8bb|_1<0ORP!-zxNSj?F5w{B`!=222duTCKu{K_?3_vGLZ zenN)|g$vh%2YvdmVY8+6mQe~6I6>zs7G4B(Dzi0$IrHDSS_S7(qfInv)2LOmZhZl^ zf>CK`prc{iA~6yOaO>vVTQlI`T!Co+8(sQz^3|@J$Bq(3l?f9xsOO=`%RzSSI*+92 z{+qL40OB2YT59Mq=bQpj+@i`CH<-{34X#ASkW2SzXT%UG?3aOWn*|mg7Y`su;Bs52 zx1NHkP@)bwCXj=}3h*dIj2jhZSI33=X~^MsXL$x7h{-9Jo^$M}k|HHm7~=yuNpQ2s z4GB$VUyVBqF+`61bqJnaK!DhXAB~jp$(Um{VrCgJe3FhS7a$qOAwI;3gC(RKWP<~E z)>ua(R${rKcfj>n6DeGz<_DT(m>DLTG5qjDBMW4b3?6FBU#i505NAM;p?aO@iZ){Is)n+SIf4B3m9NH+UO6z zfB}jaV*CJs85da51rVapfk`ofP?Lo;0-ZsExW8t%Ln6Zx>*tPv*7d>+EC?jcF0HYV z&H@XhBl5^1hipnObTrTfGfON{jWNYo&}|-Wkg)K$dDfu?#OD^9F0u@~z=8+`1YmRk z8fRl7g3wAUYc*YTF~%4zzw$~Y)nLNTB+@8sGsEOEv2(=eW(h?(FsM*K(MKPhG;E_} zV#eH=)SZbbc$*T*1*$avK(*Bv1TG3Dlju_O*El<1gcf7>JTU4?nVWL2t?oo40Pc7 zf+s=Z!4CjIz#t|6Y~iRf7!ghM`UD3?SiDL3qybcM{J1020k!? z!+T%b1QJAP#i{|-NF)BL7B~#(0EJLgAuF%|iSQ|o2?p#3Fn+Sd8|LtfJPacR$+(RA zq49oG(;w?h_{Jy3Q2=xd-wyC7tOGz{DShms4j~xG2^Q~LK`7+YqLxTSw$X_xe54#5 zQO5zkgnU9E%O&|Z051M7y$qYeH@aM`CFtL;iyU|vhr|BfXNWNGs~^m(u=t4 zp%^m<2{@#&8nBwy8ci9vdeowrwQxie4z~j>q+mzQ%;YUOnagP!O(4~bngZY@x<>ut z7p2n|2MU4zfp4mE8RH~D9WaC$W@56IeuO4Fr8!7q#B&S{$iyb*Mp3)X?PPQqgATx{ zk0vCO8Tu*cU($(CO#-r=g9JbmP?1OyYOj(0ET$^q@C32#A*AR$=rcD7Mo<25r7c^+ z7m|^T3tXTLbf7~p3c=JujF5XWg+nu#z>J$}$e^^`=}8&-NtNEgYG3$VJ?)uK2$+JO zF^wZCnjtEyid2?5O(;)0sY|yJqX}QF#1eYJ0labGuYl!1Bzo}$QM{raGQC4HhUM0r zW>v0R6=YYRV24u@Q>K_z;T@*XR-9thnUIa9WPeCm6Jj74spy4jSKEt1ydssEt;J>; z>)Db2#?_>v_317t>pD8nQ*=MLR~aIKfy_eD4%eXVRc-rN+%9yqyZuA|FhGYdSogZt zEyNgLi`iNrSGjK`07F@XT0JCG+-LRNUAS(?2FhK^~V>mg)KNit zK|1gVYIFb#Hi&YR&p@vG=tY^-+Ho7UY*ajW*~_U2vzS-03TKd67DQG=eNTLl4)8<& z5FM}pFL)7UHyDB+R)D6fHM}o3N$Nt%}OSSCj`+1 zPgo!ibUp(s?hGmf(Blwhduz+=jEEEx02A{Vemc9fU z4o4BFF^Ga2 z{NRHyz$K8-iiR8F;f8p|Gbqr56F}hJ_P)ZstDOpagm%I9J&2{pF@chs{Nxk=IL9fd z(25+mJO>+ydCYr2^A1Si3OK*QDR7Q&9w=hKAOH6c8{&yU=;7!{Pdd`WaRmxk!y3_u zdLX904vKHX1E@+lU|<48kObo&FNMn+;PtSNz3g8fj?G7Y=OEyLFJK{F(bISEn8QXV zCO`<)U!nDrpS|*z4|^Hh+zULo04$gbTIUMAZNyhR6&P`fjk8EYz-~Q0%LmGAujqr{)=)kv2W;bV276t|w2EO)dRmK)n z0TVJ5G4VxxVOMJ*XLguIXHj;525LjDq6?nf#dShgP1ek#bn1CG! YEDX34coc%70$z?)ed-5YM-vbLJNt^ukN^Mx literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/wizban/newfilter_wiz.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/wizban/newfilter_wiz.gif new file mode 100644 index 0000000000000000000000000000000000000000..3c50d7d7d657f7c436d8923d268ca60f7c81d67f GIT binary patch literal 3033 zcmV;~3nuhONk%w1VM_o)0QUd@*4f(s_Q>_plcBJ}js z*qEod`uy|q%!2#;{?6Lw=I#3O*d_s9RfW#dASeaqq%w>9Ioc z$$k3z$+6!@$|W-b@=-JJY0O|>+tmL z$n(vK{`0l%x>>Wn%kJ><@yA-~?e%SVhWPpW$mmx`2YFZeT9<#{`i!WZtd;y zqqDE>=-=w?@~O1Lc7$p0^Z3fIc=7Sv>cL^*;OOb<@Tso0w8-1#qaEg|FZ$z)>hAjb z`|E~`Yw79k=Hc4w@9sKZgZ=*h>$g$!+??Lx=G@@kfsLKR&erYn`|auHLs4bqr6fOE zcI4&lx5n0jpuFSf?n`Z9?C|*d`}|8=aMIb=;NIrf(%kd*{O;D2;NIHy_~O~r-u>{d znzzvB=ilY!>NP$}$I;a3?)c{F@A1cY?C$pA;@aq~EB5&MAvsX$@cGf!*Y5K7A3Ro; zsi*z@{r~vY)!*ye*Wsz2a_jH-;OFP#i6A~xW&{yPh_gHzbG+2|Ns9qK~PzA zW8UWY=G-pyF`TG0*?(_Ta^ZV-X`u+a@_4xhq_5APi{Py|%@$~%p z`~C9u{552c`TG6-|Nr^={Qv*{?D6{e`ThI+`0Mcd*}aVQ`0hebUqoqO;mDnkp0DlT z(?m~Uo|$m-&vfwNulM-<^ys_$=eP9GXYIU0Ojv4;tjN^c-@nY%&e-8IP;2%0^62R8 zpsv8~^7`oQ`tS1kw8YEo@cRG%{Os`i{{H^rhR{k%GKY`+1LE&mHX(Sw#V4_ z+IQpR+vnulA^8LV00000EC2ui080Qu000R807(fPNU)&6g9sBUTu6}KFF&$SF`P)T z;zUc#lto0v(W1wX6X`J{hHM_klM+FyTuI8ostXWby+YZMrOl8IVqLi4s#YzTG*jLj zdhnM{n6iBSoJo_Y(}50-5hHd1*|bzjfi`_Qbl9q?Q(dJRo0Ta_t~N!+iZ%5DuvTNS z`qX+BtxA_`*4DvIBdtUygJ>;>KnIg(7_g69y`4Dg5t$~KOU69(G3UUbo6hW5HN_qSrVKfV$XtmMHWVDB zw}W>1SiuC7UUa8vMqN!6!Iuqo2FYL!5}Z(>Kr;o+28(~S9fM4O1FpwgYIP+zzzA%} zSCAxYAb|uGjTGd-g%_4rj4K?fr(1#Th4|ix6_hyNKme?9!vSKn2vvVDGUtaYGzw^= zbOr{7ASql_StUPM(m@9(TnfQskD~lYj{=?CaDx;6kn&73zwCfyjG^(wWQ_!}*PDBU zlvBr^d!A6o34oq}0R|jYU?>}53Zy_GW^(h7n$j@iCXD{Yf((;Qc6g(mAo{`!0R$0J zz%t8BV5%8r@Sv(3tg2vW1#lq$Iv*g6-k=Ey^yCo+1F*bF+cCvlI;WF$^7e`^1lXd= zDa@V{>Zqljn(C@@sNkxhaBRbY5zmlO2n;ajKteKkxZnc=&QQ9FAHiZur-#D0gG(-| zEZc0e&ys5D1gNUYL#x+TuuTGo06-532b58Uxa7JJM;c+|0pkV5v^%V(vZR6vF1y&G z%PsZZi|;@bq(jNckff|~0xWYd0=5JzKo2P-ydi}YRz%V8EVG0VhBUCmqD;lYW(r+W z$P$oC#~+6*vaVqu)zY&5XBpBP@{9Xv!F0b1}{kC$IupM zI?cwte5y3lAloZ4LeGT%Cs5ygD>9N_?4vdoS3ClYFdW^Ud*+*W-n8ELdej33#0%7f3k_tTeg^{#TEW!F9M5OJ*Bw%EZyYAih{ypg8GeYr5ArBwK!4X&pfdUuEzz`&12|xIO2nNxQ zF2unEIYjJZlyqCtIVNM{EwVZ%P6p$j|o03J3-#%!Ju zghbqt5TxM$00&6p57d00K;d_Z7W7eVaqxx*G)B)|2JwGs3?4fcpoV_tK^owQfJQgE zQExae9E(^%`%vHm5D0@Q*yJTCBU%x`jUXEo?WY4Yz>K5pW!dhCyRXSRxs7;E{mm8VfSP-~diAu`5uVoA?ekyY}oQ zOARt(8V|z~sI$X}c0AV$1W83=5HgV)JQnQEx2W~aXF;4i3~)wy0OZ|5Z7PEzPH;m1 z40||nij7QK7H@aS4RNxWqr3p~?qJP3anOCJ5a%J!*}+Hta*Oe7LOpBXbf~L`5w?J# zr^3WR-LZirAmdIvI)(!Xqku6hxo{6PU1p3^>i@z^)k7D;2dc zXIyGipDr2cg3~I#v6Bn50Sc9Vr zK@00JggvsrhYdJ<1DSZZ!?TbDd(2@Dis(TRHol2X;2|D#_HB}L9X@(kA`eHl7- zFouLPd;@|IL?32O^O*}G;(Vz19PFS4Eo__-c)$ZRJS}q5hMBCwEHk^E@rXyL90VYE z!V{#>^Qvos>P3(OBY+A?JVt)HN(j^?zOK`m+cEhW3E(z$=im8sV$TH z)6pjR$eR3Q8(aI-ZLbu!{V?|#jXUH>HafcL!S}TP9oyPoOWX;s47wkl=!uVTa2bzw bzxVUnYZzRdYZiL@a2!4tGt%W zhn%yEN~X`*;pgP#>g4e8_3iKTJX?HcjW*+Qj1U^Y~?Z zmD1Vj=j!ogZF=hM^+8r~S8ajZ+u8N?^}4i`)xF;2_Wb4M?Y+s%I$wjTuD3l-Vt$8}{r>;d!I`wX$F|4U&av2{rmpz;`{Cs1nyaa? zgu>C(*FRZy-rdUD+sFL*_E>_dgP^@jS!_vCW8d85@$&ODK1fx6sYg$k)Z= z_W1iDIZ#Jibe*WUk)E$cYGFrilOH@*pJ}y8T5$dS{=CWG?C$mI==G<%)ZpLe&(hcW z`~CR$_Vn}h>+I>|hJpa`u*+k`|0oc?(+Nk`~LR${o&~NG-p{S`|9xe?(_Tk`~La*{_peq{r>;&^ZfYw{_*wv_4obq_5Akv{qgkt`TPC( z`u#Ozk4R5m{{R2$@ca4t{P_9(x5eDX(B!y~$hf=0_3!P#%;DGA*w4S=Tzi~iiLh~# zxA*w{?d|aA>h4WeX4Kc%!lKera%kx7`m49czs%I`^7`-c`u_g@?C|>R@cZrY`B8nQ z>+tu@+UJIwmXnvBw6Buf*x}vVrOl8BToG#^3e_r^G*jLj zda#vFVh~aJ1WJ>r(}4$!xzc&8StzAHXEuF0)DfwvQ$>XuiW*sDvm zo<*zD<=O_UO1UK)Hz?hYz=TN!+d!8py>H9PJ^9z7OJjpw6;^e4FWjtt8#83)ixery zQ}G(EoVf4Sp(B=rOO(g}u!W9NdHyVw7%x_%5%a}-nj)Mp2uF}>_W^=|g)V2)CiaUJ zZpykZn`La#g#_RR*|_)sU`mX02$}W&QtsIp^V`o!@19<>q6-*@uoG0_0ssIJF%X^; zCY!vgU%#N2n`Me+<{k`)#8=QIlmI}22sAKbP;9C6H=8lX04N}I1e!M2frca~UnfS0 zK|%?F&|uI36;?>zFrsMa+<>L=_8~>@4H2S(0vYiQ2@C8o!)s9S*P?P!h!SIfGjdoX zdqQ=>#FSKSVWlQmYBCNCLsZa+20R*3LiIT9Q5gD1%Rf32q(Z7 z02QR7VCooS4AEtv8W3s;1BjCUaYQHQ^y15-Y|3WLFvn0DCyjiaatkc4jPl8`pLF_Z zsG^p7YO1SNAcq`5ykm(13*Z%qD8?d-tg@hrIw}>W zqJXNZfXZRTJvgvoh60#qn?)&AGz{jfl_S=aWEMRg216lM^Fs?1SQcS|VE{vWks|<@vED=v!vBk*>#EcCZ6kT)# zNGBaZKN56VG8+P+j1N8v5a9ByFv}Lj%nDc9%)_~Cx^vGIw`;LS-EjHzKq#}|wgQzP zgEhEYb6s6>^zwE-%<(c#CH{d>-?XE{aTv56c zd@K{h3*PiW0pl*)D$N5=bnwIjIYd&7D9!wIJLa12-g)nXqs<4@PIz)f9FOQAgAdD4 z;!E=aJWxOj^B`eI^t$Y_)b_b={`dES1DZ#YptvAhAsRneK^!(Q0Uvl`1ii4pARfR4 z5P+ZsZ{WfPo`3-TX%7^*>mKLG_PO7I#0lPz1Oit84F+n%8`E$ZBLvU_3u2H9c3{L4 zJgAir>TZOd^WDY&KGFqy=pYW&NM8WZpba{7A%YLsz#CdXKO_{u4qg}pa5LpLIJ?BfgCVGi+c2-|9BTb&{ZS}&gjG?JmCWjm{J>wRKzlp zFrETDKpJ+i!v>@g1_3;Q5v#}~A2$iW5)KhZHt@m$rlAIGWFs4AScf9i(1npiAqpMn zKn}u?1A5r<0r}YC9{cCLF9PyFHVDBmm(d71(7_PP=)y}HfUrpX;Q`U?0QB@x3Th{8sUJ;hLV>j7r$F_9 zP>1RP8*r%tE7d{>zG4KoQH=mFLg+`;lhZD8(wAWzNFcVl)c|-k05AY6492>uq^iIb zmtcVsAi=VlP8FvkwQ4WHNVraTDqhW^*R${iC_fxR3o5t-!1BPdUnt3@hJot`?^)7L z_SCM+l9#jW1uZ~H%MVwmf?xx-Ew|oOq>F`UW3gJ-yE1ED^}1KIBl5`+Up z$ZmFDz}*-4l$&pFBGILAei;S6VZfe?fUK?v%=>N=?4)v)e?tbfsiCApc%hwgNT zKYcM^9Kh5@r~?~Lz>OVrBNLf`!W!hk>>9+Q2GEwr8YTgSOh`crKmfuGga8S4+(8|j zCa|Y@`mS?0q7q(MwF!v511V%;5^JadAOPWpdfU6+fQW}YsGS6CYg-6HUC3SAOVSQtD_v|V1;e9Ebd(+JZQ{UP;h-6 zy*d&{xj=PSQx%NhLgn9F?VQ#X3SVQg|mehJoni7Cv* z(c$Lv@bvt-xWwbz#GiT_)1*|zn^KdLn(XoW<>~b4@A{^xtoZu<)zaMj{r>Rq@ZsqA z;_3L~>iOX3`0erg_v4)4==kC3_~PpM_W1qu+?C|&`RDBTaf%U&*_}6{)!e`9R(fQtm^!NPu;gIy_ zwCC;m^XR(y;EF6dO84TH=I#3R<*4=MuJ+`j#j<{qovrWl`}63)?B~++u2S;#{PO9> z>hSt^dwjE(PWt=)-qf?%*5SFPa4JDr&C%8E^84}i{PF6{-Pz*e+PLoX`|jMD^t4#q z-Rbl8{OaY)v5zwKyI|Yb!tv|T-r()c#?tHCqxJax_1%oZ!p#2u|M2YAhoHD-cZ=HD z<syu9_WAwb;_k+gGyVSmn46vD*{eNUd-utN z@$~$LoV3WNVg2sewwqS!?B2G`TG9W(Y*Qk{p8{0`rNSX z?)KZ&yWrjB{OQv9`~B|d&#s$h+}!8Lw}|)LgRhc8v9hxK?!um;qWtU3>hAdR^ZED2 zf!))r@w0FK|Nrsw`1SSp=;`t5?e**M`@g`%+t=dd=I`a<%;@d-*VWb>F)Ub@!HPHv+U{M z{r>jn(9_uB$;{Zz!leHD_1Vj&{QUgr?fUZY^v1}|rj%Z=kv`JGm+h@ljF6G??%~?B zZu8`=UTl8);GFo=d9}E?f}+39$J6%s{Jf%H`S$Sl&7b7z_vY*P-gT=~+!ie;@bK>Lf<>c$W zjxy})^6u>LA^8LV00000EC2ui080Qu000R8009UbNU)&6g9sBUTu9K(6fqwJFq}xS z;>2W-oJ17B(W1wX6Wu^sLuehxlM+FyTnRu%0Ui(!96;HTrOl8sNbumn06_(rG*jLj zdT@$Pm>&@M1WJ>r(}5ZItXac@kgEYof6i?BbZD{yQ>QW*KsGB=lwEC#Btc>-4=)qQ zVqLlwZCaHs*|z1;VnW=qbc5dg_~!y2y*jge@GIAB-IIeYy5w`1Ef2+u|IXDaI5NXj zkO~x_Y`Fzy#(+6<^_(!-1<|7qzcu|KbK}6PSsQc-J2np`Eoj?LeHOApCWiX?SPut*&^uw0dNQtrE=x+=|jaHRg)(89#C26=E7_1B$O!8 zE*$md;x!?Jh%$PB@!o+5CfLsd#WuhUj6(haiS1q8-;f zFb+a8Kp3HDS};)IcD4EEU2Xy~;eZ3<+))M?Jof10k32%~fHgN3S)>^b46~vb47j)- zjKlr+SbzYeA_WA77^2M`gLLWTm!^an<{o730YL<4rm5xwokYk}lP~ty9c~&5B*h_r zICID$l=OKAF1XYpXf39cVd$ZVCW>eRZHh($Ax%1IVT^NTXn+YF6m;h(H+1Uhr=W%^ zDyWRU#)lS=!uh0}w;f#w|)T7Vd+MjGdZP(*_Q z2L#AUE3LN1K*O}uR%`9G*jigE4_Xwf>ZBhGAOH#?Y!HG6%{~h)K~jto!@KatEAPDY z&dVqXPIQ~9q``eq!K)*1Q0}?us#`0&da$7I!VEX;@WT!>Dn`EEO6tnEDqtG$!00-w zuBIi-Ao9p0mu&LMCMOV&6BO^O!~j1SU;qjkcd)U!9UFY`KvHy5!_PnmE%eYt53MrG z`nm|k4@Ag3bImss?D4ajc7wy!SZA&E)?90i3>hm^tOOJsG3_+X8Vihb!5_05iVbkb zE%)4X*FE>wVKd;$Ph~g%Ei>9St1Y$8nufB&;fN=$_~MKw?ujR0GcW-ZOZ9y=)Pm=1 zaN$98?)m4Shc3G3JFo$H3S?2vw*Y4UjXB3`Q_b!oJ=AXd?YQTzyX|cBP6p}&sJ>O} zPp1w0)a&xR$Pmmo@BH)7N8fx2)c>A(<*fT%eBj3uK065DhcEv4gA|E{;X z_PuU^-s71OHpsyadhmlF+~77KSPu#MkA2#6U*=+$JUjW|g)oev3};Bg7jDBIftW`i zCb+%|rtpG;+Z?<9fI!3|8u5roOd=8U5D0plf*#d4p${)7z#zuYPD{w57PrX7E_!hZ zdFTQ?sBj7@M3I8S`(YK~Cp(@!;f-*Nqa5cr$3%p&3zj&AJj^J?G*Xd!7!)GUwm`^2 z8uE~cEaVsxk%$}N(Gv2QgFHUbM*wc`eJm^>yUxJLPI~f_pVWjX$3V(=+{g@;h{PO( zG0941?~j-y;LhyyhFaS4mbk>_8JNIJCX7KAvM{9?%n*r4n1PaLw4@5VCrE)HK@re| z<|Z~_1!`C!n$bjpHn+*mZgLY5%}C}e0|-bfwha$$jQI06t@$b=*yQ~+_TBBqt_2P?M9idcBntINOx7WP5bKA82a zXh^GC`!LiEl#`7uEQlNaV1YVlKop?RfnIfBi)r|^4X;oKKZrpLMi}<6VStAVlE92G zgn<)~g)A>7%L`6~0S#>BfJps`kU!AXuAl&fXh%z0K?O@5RPz!8xW2Pr{TgERzMos-~#<>_`>kTfE>`U zfD@?kts@;sE^eXVOV9!X{Izfz6hPw|+xW&fZUZ-TQR6hgw+i1q$3B-C$d4ss75|t- z6<#o796R~RPHun&di(+m@M0en@FO{sx;bc+;vc)1#3j^0<}#O=3usQWnz;arHoMu$ z&9|*B7s9ZQa~xobTPAQb-Qb2~xKjpzmcbMTEmf)(0HHe(!^HAc&wCC>pBCI~22;^z zcV-~af+qA-?c=Duz+}-aYLY!^lTQ>5c)V?#tDpZI=s{1R(40QBrxi_4Q9HWScouJw zWtWOSBxBW=ZndT%)C*Zt<seg^0RTJIX&(Im literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/wizban/newprofile_wiz.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/wizban/newprofile_wiz.gif new file mode 100644 index 0000000000000000000000000000000000000000..5f4263ddaea8cf7c4a5b21ceabc60a07394fbba9 GIT binary patch literal 3229 zcmV;O3}W*~Nk%w1VM_o)0QUd@lb*ARnXm5h`;@E9^8o?y^!%)_#Mjf^?)27whM~jL z;c+JFSIYw;d>-6I4`RMNU@$~s+t%VqOyjKq}J5n z%g)&J_WCY6W!c!};OFxD{Ql?d`fGHOK}~d&nXdNu>q}O9P{)(i>S!0Od z=JTaTRn+3`H$-fClfCr!{nF0bt)aJzlB{ryxs^Rn-r?@+@b|{b+1=&w`uz3AE;hfz z%Cp7Xr>w)~0noNO9!t@w(6CoJd&a?D^K)JSp4r~! zb&$Kf&D-|*_TJs*?CbC-HC<9%e@8)N&D`s|xybYO{Nw2K*x~PTL|mAjwW7AtUTBKC zzQ#pRb=>IjoUg}?lcnL`=icJ*p{KOl=I%X6Y{=H)^Y-@Q>G-L-()#-RiDGzVZjMG$ zc!{9Gj+?MfS$&+OxTvkXrmVNNyUg$P_JEnc>+tIL`TI9RXkluJ!^PCu;^(xx!&F{> zpt{$js=m|Q>e$!g%GT%o{`zQfkN5Zcky&o)@${s=+frSD+uP@QXoJDe;Op}9-|6C* zp|xXdiLJla{r&#nNN?|K8^K=h{P_C)`uqO(`TgbW z`RVTZe2Aaw@A}~A_~7UG;pq6`>G=8j{^RQT-qNh{rUU;>F@gf{{Q&;{_^$w z?eY8ChfK^|F_4xhn^7!`o{rUU-`TG65z|;Nx|L^nr{{R2q<@EUZ{m<9t@AdPm zsIlhn^XusCrOl8bWXX_GAQdf{G*jLj zdXSV(n7C5;1WJ>r(}5v;@#4i30|uo(XEuF0R9LC0Q%hRK$`mD6n<8b&nkr-11FKh; zYBhUSrAxJIWe9licC6f>bwAd!=bwj`~Uw!xGw_krXl;DMc1TsX-EC(XzOIyP* z*W7xmHCU5$2EZpDefHs}AAcHTxZ!{m4MtvwvJB&+iR!7wSZgfe;n@&F_yGe1@)beC zlVXS=#|a!#G~OsXmgh?WK9;B;ibJ{wgdm(eQpX8$h(SUT5Fq*4XH_y30+v{Ycng<5 zekmk$ba{eKH$E@{1`E6Bg65hq4DqICaVivoEp%pCiWUXn>E(%gw%2DKm4qQEp@zzV zsG^HDdJr+B*a9h?QjQJgBE&d5s5D9fvE+;JCV<`*GHM@%oEzU~NhR!_u{PVp6m9s!HMK?ph+G{s+13yoz zZ0gih$2=+4$XbeXEYEuX4R+5M|2$9)ilA*Y(ugzdjS~xqAveMfkuuBV3&-p*-tA%_ zf+?oJ!uKnF?+p0ZWY?mBC1^wf2NJ9!LGleID{>AAj}sTU)4PhPhzllFegFeZT_Lh!?X z9(ve;XFL!&gE--g7jbyN9|=sPP=v3)8c;1l0KV|$Zdjv$$>mD&6OOD;c%5^f@!&_g zfh^zz87PDSO3`(#?BwzuG0K+5yE-xZVR31|3016{-;7~ez!Q~=5r7lVBhRRDj^12nE408nB0Td|?24fIVOIqxb&qcfM^r~@dQbHVGdAO2TWgj(QLkvf*Y-* zA4qz~S%wjNsEB}4m&yfue8Czf;KLKNL54lpV5wN`X)5o@O0s!^0e(=#G4ohUR7~Kk zXg!8KE@2I1@F5UFaKjvIzy-9TRjc;2B0gIw5U^TeteY%r4hBouW5mD>#|Xq4wDARX z1i%J_jVxXxsn@O!gpQj4Y%-DBi_Uts7kg+x6t3ZhFOWeUP}sv~Jv-Tq0+o_hA^*rO__uw$O9ku$nQN~(FWtO zLZg(lgda{YUS*;}6bKf@C0vzy<^Ou@0y~<}y>m0S=%B4$hE?RR9?O zxt55JlMkHW3OHg6!{9+8cp!yFaAV6q_<{}Q0E`5q0uYc$w4xJ@W*qEb72Dh>CjOA5 z5s0;@Ut|)KPC#c-yrBX_7=s@4%x88OAq~06hK1*l;9qC}5Fhx!A!dDu4?rT##b`xk zNrwqGEQ0|aI6(@?L5>BCR1tCT#~;AJfMzqmADtEjsK>w#6Y${5>`(?b){u>L#GnDc zNU$B?v4L`zyVj7vK?}OO=3Ru)g$`XMeB1)`ctIMtVT7hHVF_!9 zaLW@siVVP9=IP!-UL#G(Xw{+?mx!e zf_`hH6}^XZ?e}%H0Ds&I0UM1dA4f8SSj$9I1TNPZpo PF#Q*T*e8Kq6%YVBF?WKB literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/wizban/rmote_exprt.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/wizban/rmote_exprt.gif new file mode 100644 index 0000000000000000000000000000000000000000..2d1e70525204275f7138b6b391808ca30fa9f835 GIT binary patch literal 2722 zcmV;T3SIR_Nk%w1VM_o)0QUd@|NsBq=J@FD`uF+$>+t&U^!(rF`0Vlf`~3d+`u*wd z`u6z!>hJpP@%!%b`{nHU`uqNto2Y4pwCV5q+uG&){r=R@-0kxE^Y!)p{@g`mmjD0i z;pq6|>iP5b{Nm~O;OF?@==kC3`11Aq;_CVC^ZQI&Y?7#{-qKf{paoa{{H{|{`B?u{bO~B@ALcW@cPHYyXNfqewxM2*VLS+ zwYadT`uq9f=JD_I{IbH-r?kcS`u>WYx908od6T@7r_2BU@!sY2@blf=-RW$Kr-Y5A zg^ru}`u_j_=X!&l^!NP#|L(ZGy88V7&&RMTM|`Hm=+WBNJ56I#bENk9{e_#tH&~F_ z+s(DOy5iyK@$~#|hM%&-+2!W#dV-ns_x<_%{^IBK{Qm!4e6jia{o&~LTzsqH<<;Wl z@9FFDJ6VmBl%2)R#q;&|nwz8f`u+O+{cw!B-r?=k+~PT2gEdof`uqJPK33S^?tO)w zE=+>g;Mw2c>YlRE!@afs|Nq|P^5^RD!_VI2=kP*SZ}<56KUi?QC=*5Tpe?8?>So|>8L?egjB?>A9x?e6qHS$3(Vq}SEpaD$rs{Qc_i z`Skba_xR&ITYT5r&4G!c^!54r`}XYd`uO?%rKG6$`TYL={_5}f-`?lz@caAw>HPib zDKtXv^4#3Xr}+8j@bUKa_WUL^L?bs#AvsTqp~jD|)~%_iuFK!q#-*9A(44!+^7PpD z_}inPpRd5b_4xNnVSD%Z{P+0%e1x0T-q(hekB*O*z0~FV{Pdi?cetR`+tX^ z;nlsbva-|G$I{iv+SbC}(7D>Ta-GI8%o@R*K}r(}AVD*svjkOf3RRf6i?BbZCVEQ>PXnKsGB=lwEC#T(DrOj1mXP zVqLlwZCaHs*|w$P;6U86bc5dgNF$0Dy$h&ZXy8|_*}5kOTXgB=FxxbX8ULNDRj_1+ ziHZyuQ2DZh%#8te=K48dg#@EXAAWnffo8{nS+_RmGPZ0PI2_czt@>=_-31e=@jcoL z@DjpNZ+`3VB1N!jPoQ>E2wEj9l_Sjy?aQ7}9_iDQzYgCy}ze);)2+W&j zuA;#D=(d4Joo*H>;f@RKVA0Mt?KG*iR95Mu2U!XkV|zK6^TG!P zj9F%xXQIJLnov44C6ztumxc;)Zb@VV1PJhg2pog}LY{l_3DSqq{8{+fJwp!kV;BvrDk6LYQ-Shj8g|RI(qtPp%jjqsDGOTQH!H7B)MvRN znd>NHE3Qg71c4gVwppkLBlub>4vY{X$OA7F+rhDsCJSq1YNEAPDV zGQ-Rr_{NDt4l^)fgty@u%WAo=E-ULQqO5?&Ixd9a@WT*4tjff3M54mJ9Q8}e4c>}N zuB*!KsZtGA^dm|!c&swT$}G3+^2*ypW5y6P(@X>@j&Ll9z{nOXGDsvpF^n#-L}2vM zNFTk83rxEp#xhPs?L-+=-{45j-i|vk$mfo1h0waJAokc~lP%9V@vvhLJSTAD$J?o- z5=tmn=M2RXADauS*H6Iz^26VN2QK&zh#;cF;V0~qPdnZ&fpR|cmN3hzbC?Fk&p>yFhdIt!9-&uAql|<#uvVjgc#0{h7Z(98mLgA0_+fj zf6<`tICz904l!>&v(yolC=4X*K>~2-LKnzE2S`*=h77zy0;sYRDro78#1W(R$|ywd zp>cNTT4M{eAdEeHBaV>B0wjWA#XJt6Ei%|i7rl7FK>Co7XEa_KX*UoO=As3Qv<460 zpn)t%@(Yzr9|SImNf}U~KNbRH563tIP#RK{h%AUHm$67K9Ah4Ycx5b?qZdBHNl3a3 z<0sAdO9Adpm>WQb9a=yQVzhw}gn$GODw&;T?qpQZ?Bp&7NzDL)@0!A_0xJ5j2`yj( z4BfqVD>3HYFg z1Tw%<-{=J<7)@tDH#$w5esq-RItUF)v4LcOV-MsQYEfgO7Z1QRqcdgdK->A$U?PMD zG^hYolktUbe1oVh^@mrJD$}JBfTLt2D-m%@%7d^$t$=8SEs%kPHe>(>ci@F$c>xMg zOkxgmSi~Z_(TGNzK@OV8tRXhbSwrwa6MT?^Xyp)u(yn0*Z%FMMKw!|E3M3I~)q^@> z@d#G`U|<)7J!~gBF$Yh0;tXd<#~8*y3tCX%xS7a=J}ki8<~mm&qe$*?n?PMYSoac_ zP=q3uz+LXbb0D%P1p)w}jz`q?4j708GVTEbQ1I5b-2kp|iECWsDtEcgWiE6xaa;;e zceB^Uu6DcYUF0<+t>aBVES&KOX6%B!iCrvXCqd!IMpm+tt*nMeOIp&F_QR(|t!h)- z+P+2!trbXL4I$tLAlzcB19(Ozx%gG3f>EqB4W%^=3;?tuSj7-@Lmt%83Vu?B#&iYf zjqlo29lw*uC{8huA1LGmsKdy%oNG*#?8&h@b+1r8a0SNPz#!+LMYKG!mceRQy!KLm zuZQf~YtuSrDPxh!XWmbmvs~l4F4@f<1+!UuOlLArnZIo`}+I-?(+NT@A~cX`{3yK;OF@6^ZVuO`HPaLDmhBh$-46O{MFIi z@%8-X>-6*X{Qmy`K3aL>>iNso(tCrRvclacMSAo0`QqyN_4obc>iOd7_?xS}_4xhj z@cL|qv+wi!tG(KEewyLv_~GgJ`TG0j?D^#D`Q_{R+ui9nV21tu|Ek92`TG9n?fUQY z{Qv*%gPOwT?fT5ZvC6!s#kHG-p11w|FxE| z;O@N3;_>wS^!NSw`~BzZ)%p7U|Nr|kMp;E=n7p#3(!!?Z=k0`yq~Pc9{QUmm;OO-B z`D1^s|NrN4i?+1F(b?AE`1<1g{r8q#KyX(l&H+tLD^@NC*h>V=Sua;hWtN;Ju_4oYi@cHTL?}(eQ&)e>dkf3LG zjQach{QUjOy{ea;sP6OlW^;u4{NnQV{HD0p;NtE0`Tad!l`u_%{{H^4!?)}3`$lb# z=kEIC+JFL_WbSf_f>VK-{9)@`23TYsL0dkufW?sRc?HYpIdpH+R(o6 z^Zd5a>h1F8=a)#6QVp;2z3+uY{=|MS(%zm2E8oS?7S;pA?8j@#t)VvWRUki)pk0{WG(;4@(W1wX6F=}^F~%9klM+FyTnQin0WuI3C_vefrOl8D7@#0iU_k_#G*jLj zdhmfx6c88q1WJ>r(}8fluwa2=jI9Amf6i?Bbf^vjQ>PXfKsGB=lwEC#WWZo5iV6tG zVqLlwZCaHs*|v=W0YTidbc5dg_yNfmy$qsAaNt+2*}5kOTXgy5Fk3Q<8ULNDRj_1+ ze0UHbQ28>1%#8te=K48d9s{FEAAWn=_-39r0@jdzr z@Cw3FZ+`3E2wBEpgdFEfnaQ7}9_iDQy(fpWC|3^G;3KN(= z@0&w`_0ib|9(B4^gvKX&Od&*q;Lw2|LJ1(TUv{H;P{4oP1xQ?Ykd0^2ftGC22^NeT z;^0AiJb;9R`^Co7g#dmxU2gDwC`E`PmUyB;5Ad+!grhMq#)TNNC*X|l)sR96Afa)i zh$Nc$;6NXE!Gn)1p7#X@L&BJ$jJPRKLkKb)5WtxMH2GwXQa04%l|Q!V3YSF2*j@|J z+@Qh%W}=CvnmCfE%8mdyWF?$g8bAgIbb4u|0|N+f!wfP^KmnhA{`rxUmT*D@79$M$ zprMCixgP@>Fxq92!Z{GZm?xwLt*y7lmn*i? z^h(DOh~%p;4gB`oh#V%Epz41u1hT>tVWhimyR=g4rNb z@iqd#&;mz+j3N%g>Ow24yR}w}>j+%1LGcJl)NJ$3IM>WfIgj-GNFa8M5{W4YFT8TY z@Iq{e%!Y8`^wUr~T@5`{Q$5Z+MPyyXD5GE#NfShep|Z3sKm4*VY_KuJ+HAMYb}B+- zfDAJ7)N)G>gX9eY2$6jM-2^LB6vFP&@7fBnFn_qs_8*Kl4tE9_$diHHcDc2CG1TwxD1q zt{_qqL#RUmMA3vsBZU~Os6vK(Ad6b;-vhenMHEEAKNlJ!4&`^oACiI?YfPaK6=Fd+ zwy=N8(Tfs2fX5mp(20EPAsUzTM?kW1kgkEF7PF(souo>Pk0c`$C3(L;!axhnxFqh} zsL3KysFUGpq#nug#2xmK8DKDDJ?yXpDC~g*s*G1cKA?kEK7c}W+>5wm8OlADF^WN0 zMkwAO0ut=N4?uuHFc-oH9TXFe$3&(g!}ZBLHj|c-tN|`Uv4m;pV+Yx&0}x)ZO@$Ei zn+*u3I4?v0PG*A8nWI#v4c-ujeO$o>*60Ei>WPqhe$xwQXi;qR;(>mG@}KB@W)JTn z0(~gs8Gi7DC+Z*wh8pAp4$Ws7BFdj2F#r@5UFJn^n9)(*!wKQI!WFu3j9>i11%NPV zK~U;VI0SH|5)DQ$Kmk*6jbTXK3C=kOP)jr30|roFM?PdRi&?0_9dih(AXixsTI3-C z<~YN@a!4rEBs##INFZ5aAvxFc7UF)ijTmK?Si~YI zQCJ-ROyU)LkVOefP}x50wgm400uzP{FJTHK52!c=4c6+`w}y7Eb-k-;&(T*(r1lQl z&;~cQn_bz?79KbV?`;JEgf7&<1qhvkCnO;We+YNDw=-^`K9Ge3JfI8)_(mi43$TDS z_pNZ%gn$JMh5{S70|-vAf`@?)F^HiV%^(3WU;u+xyn+f;(B@c;i_$k{@Te?(B~@l< zQFCIHs_C4h1cOM{>%8%TFBBkBTk1s;%hbd)MX^SusJ#4%&&5Q9@eySlVwa9MrsZ_x ziL2VjDK78FeE2|+g$%>{7MYGmF0qnx%w$qJ*~b(lDjYv-Wr?yS%QxOKBzLT0AjVfy zAW`<_m}3m${lo&xc0{s2xt!u35{|{UA}T(~JY!DQSkE(Eb3oht=Qnp)&RHb%mCu}K kEzeTNi}v%AtM%wX)49wBxHFz@oa9S)naB7GWOi`3ie%GBiM+REYO^62jRmZi4#`2GL? z_QlG^#Le95vvK+Q{CbqS+1>5d)Zp0I<${{K>&%mkqQZur#Cw^=-`v^j@cQ!e@wmRa z#mBY&{_5fA`0@1o%+=Mp$l|A_sYPU&>hSv2(%%37`QGC3s=L(W>iKk!wC?ftp0dIE z{Ql+Fy5Hyc*xKl&thwIg_2}*Om8#0K!rfeatli=6`uqOl>iI%faQpoJ{r%ptzSG^_ z>FMtJqqD5*?d;|3`PHj!!p`LC@A}c%=IQF#^7Z-MDb`euDQ4W|L28_qn)$TaD$kn zv&+f7r{Lo5{{H{@`u@|+x8&*d;_3L{=lE`my6NxwjgOYJtCsZl{M*yI+}h;s^83`< z+--=mQF5d0@%y#6!{X@k`TF?f>GJdS+pfponXSpLy3gFBQ>3}sw87SrsKa1>t(Kgs z`TOhL{Vdd}D8?(XuXw$kI|?%dw&_uHl6 z=k{ZPuk_)wp|Zl<+~)7|_nVG++~VoS(d4bYz~bcL{r&&o;OfxY>bS+)^5w_U+t%9I zb}zE?d#&)x!}7K3k0H@AmKU`Tqa^-`(Hn?Dy^P_>QgB{Qdjp z=;iqN>+r;V_4nbu$ zil45)*52&S%CY0^`Ps*(>dmtC&#!ZSj;XoF>+knIXN%e2-`Cybr?}Fox7Mw>*yru~ z>h1Wlu(C^RpTWe^(AeroQea+cevYHZ%gx2-?91uw_3-D?-Q3f5cY4&|@z>Sh^!L+P zc&S==s5DAoA^8LV00000EC2ui080Qu000R8009UbNU)&6g9sBUTu6`%4mWiUFq}xS z;zUqoK14jg(W1wX6UmfG@F4@olM+FyTnS)DD>o2-{6N`}rOl8#62SaWWQ|OkDR1`T zWkP|`qezdMFu|)ALmWC`)+y5SCrzOWl!0g#h7XOeV7~?$8wQXZDZCQ8OrW!52C6=1 zUS(+l6^aW_s_2!)SJpXm=CwbFbJv@TefcBR+WpAC9h<7kvKpSj1{CH zplQ)Ma*q_LOP44`qclNIT7e=T>x5M&gKfB0E351!#Za?dn(9g8M7&TTVi@ohDB!}y zk|h+DEu)}9nbWn8-NdO=`}Sm@D|vzcpn->3qAXPg7?H)vIC6Z-n?I)zy-g1(I2>o+ z&fT`;xZtUzz!%(Tf{F%(j510OfIM=}IdaJH9&^q?N5K$QFyMfGI`P+^cL2@>k`xxS z^2rvmEYQORV_5)5DycNH00$h1AqEss3^9Zser(drhHPo)VR!%KcG5~xsFA=Uq7ZPG zVhYH?M<61^VC9uqS}B4H$~Z7v97Fnt8)ZkTl;o0+bb^irQV7J00#dl3mo(BOVdouq z-f_k!erVGrEMSHSqLDR?s75P~JVHbyfh;zV0&>!6rvZ7MafU0dP|$#%N(9Q?heeWE z=toJmB8sBuG)fSplHQqT9+=MmPyi(jP%zC0V17#Em;oA!12>{{g2FtG3Z%drNl24R z7|b@C3j;UEDqR#V;F0U6VtywgscN)P1vdmdQ9-c)9Ge8Ccv|Yp3^N213^@fvA@2~% z;Hqo3A?oImgbSVCJE*8Zk;;ez+*BcozvL=l z2Ab`EHuv3l!{zaF`%@YH^L?z%JauJ3>gPk8a*JHP=FPeaYT^Q^o6y4+@3 zQpNzms&hLI^k+|w-=}mx_UPdk&x9uB%fb1cr#|Vm?|lPs!V@Myjr!?s11p$85BfmC zgFPY-O6cGJ0yx0*MelJ)5(Ew)009Lu(1E*%#qVB`2Uxx0g~3>X5{L)B4W__+%_HCk zVK*W{l;IX7RL2Sb>z6{{8R2J-FoF`Za0(h0PlX)Jp$FH;z7Z|LW+hC=5b3uIE+F9) zonU|%$Jhy31S0|cgW?SZC`IT|5lM?k06Y??#Rd`)2xB9h6Z;oFHR2F`Zd@OdY~Thb zRPP#F)EypAK|u=UA{VmAARiq71OTqFgMl>Qh-~lyB6K1IG)UwwfRKPzjBRX1ljI~T z8AU)A5QJvxM;wSi%Xv%yKRDRIE~o*7Jx;QJth{6!U&%vK^@9W<2mui+Km}Ut@)P3- z1Q=LA&1zb+n#}-#HbG#+KkD#}AR&Vk=HQJQB=Z`7P{BA@@Bktp@tsKIgC#Iwi+a}6 zlHQ!6AU{I?h8<8N5H%ozIg=?36m)_u?65~M3~&Nz=%r*;kj5w`FwawPq!>adUkapH zi8Q2vig5eLFhH>bWXM4U`glSOMxjh@NW%akg8&dAATm+FBT)pXz#LS73Ub`gQkJTO zP=_jmO32`-NKNWTNV)@mvcLj0Q0YKD=>$U#fP^%KU-fKBhh&fgsChDgSPg*GTA1~$ zXf>-xK*7|eN+A#`z{MY)AXSzsld4YWL?-|d2@6cXADGa9*2YR$u_oaJh(+ua7Ry-1 zF6FV1jqFm8v5U$!wWLyLf(_JQ0Yg;40-z18XeaOh6$pY3<48mv2s?(vy7mUJox&|< zOIzCiPN4%`$gOU7%Uj)25CRYQwZ$s-s{su_ zq7hl3?sT!M-2zX7y9g%XYyt3HJ&d9TfB1rgaX|w^%mcI&puu{Zx}iE4!VvMDuRG>I z16OE-9QMdV7Ni@B7Kg$IFpjYgv_Rt;+gJ-QfB}xVdy6Ruq`{+j!Z9A821W>?A9Qes z0DxhL4R5FwzW4(!I!lAnKEMKxK(UG?;bIy4AQND|F^zLf<}&BFyNex2g8}gbMI1x_ z4VLf+9e{xdV9bLDgm`i*4Dp2!%t93U@Wmc*!H6(y`Nd#PbfV#4iblgg0+5chq|FQi z1uwQ11o^HmQ1AyuWa9!h7y%;cYymv$`2wBAMI_J>$~pMs0bKqv9A?evM%!A_xW;vv z72M-m9JL^t_C%)@F%AKY8WvR>R%ikNrfrIB@8jP9j{pNAK=6VS zyxWo1u@+={>2jO<+}Jn=0Tl5IV*}#>@lJpePN4xH2tW;ZZiUhQ3yoyBOblL#yWHmWq zP>1YL40xD_>#&E4vxUMWf?f!OVz>ijScV;tXUmoyFyRIt(1?zS2n&GXA+|vRRlyN^ zxP@HUeXs7$i2sy`yjGtIP a%gBtS$crBUjlWol2Ox~FNQ?p)5CA)FPYmAx literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/wizban/rmotearchv_imprt.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/wizban/rmotearchv_imprt.gif new file mode 100644 index 0000000000000000000000000000000000000000..82f052791622a4f7ec3a2aeb5afc496d612ffbbb GIT binary patch literal 3416 zcmV-e4X5%)Nk%w1VM_o)0QUd@|NsBq=J=|(%8R4IxX9x6`2ARRrs(eaEGx0>hJp4+Ud;J=;7k+ft$nR>GYPUz5oC6-v;^_0g%;fa;`t9)d$<)@( z(Zku{?)Lcip03UA^84H1@RF#<>F@g9;o+Q~r@F=1^Y;AP-07RI(c$U%-rn2m?Ca&_ z?dId!?eY8I=lF=L)upSe{r&%kpuX+u-P76Io3OIsFV-de5}^p>@Z1Uy27yG=k?y;>Dkq|#mBIkjd}Olq~PG{(ADJK-O;PMtn}ft+SlUk z?(*jA^wGwvp|Zoaw!^fpsNv=Bp|8os(B;k7=1Oay?Cj$2^7!%L#jd52uD{&f+~&W= z(5S}g`TP3r^ZVD=U?2MJBxWm@)@%Eg(;*X}q+}`Zo*LbS+V}YT=e=7rsJ7Oh zuh7QU>-_!vG(S!M|Nhe3>f74p?C<#3;qKey@ZRI|>F3+<#C_`Q^PjV+)#38z?8?y6 z*4NbEGgNZW-tqY1n*9Cx^v|!Tx!A3_*pZ&F?&s4oKvC(yiRbP5>+klcxWD@Q^SaaD z{Qdan?eyo*yU*9^Kwy-5f|H4%s@&r2-{tGm+3Vou>hS2(rOl8b3KU?20SFqIG*jMe zmMewPqezpc$kmKt2c0|V0PzWw=Fk)zz^nmLqN~@gXTqKV0c+2ZTnQmSC27IJ)Sol0 zvdqN+1O-yg#E3D**Vr+AfFng>v1rB}3OZ64#M5tW$+mB+qMXZNRyZCZc%U0psZyLc zp!DducTd!$NshcZQm_ZDK#^+;q@vT-E!DV_SGFjTj-8im^MWfX-bU$;ZOnCyg-4B%_Cl1uyW?kpN|sI0#I!1+PB+= z>s@6EU9E%?M+JSXvBnNrcw!8D#v!L%a}PX_!!BT;a$R=$)fO3UC+Su~0l=VOOc*;5 zaYi0QSaHiOrhM>$3oiU3g%mmD;D;ZLG-07m*kP!hhTX{p(ryL#;Da+eAG;k^*Cl_24QA8hp zn8N`oTXLD7mqF$h=9sONsmm-a5R?KrV#GNoopxGc$pZ`M=>?Zv0?D6{ABhQr4}~6@ z=s=4)ssyA(NZQT_2spC91Gr%S;Ae*1Z7OJ|X8;n2Gp&GtsG_XEDF7$L7At@Z^RzPu zbWSWW#;iZqDp`jr9We_a(HP=P76XhbPztO(T4$=3tU3ZZb2y=H4jjn(r>4`^6y~*h z8A3z1z{&|r7X0=L3nZJMn#A_(iuoAQ)D~^dbPCk z1vm(3Qv()@Je%--@e0-H05AjsvBbbyyfJ#{8M4U;q42=N7khkgiOIC0j2jasAhFUB z0~G1<4)~Iaf}OV*2+P#4tO1E2IeXznC42mwDR(_Efy4?w1YmXmMTXw?G@~x zpy~+ce(^;pIrE^k7sCwy6UPid|LDOvOuX?!*=L`fb^$_^+4iUo#cfFu!x|e%)_f1s z&jl3#j-g3~udqTLhbOLhwMoAtgbgS> zZ-`Dh;-(*+$ET_z?7dZ;pNM+ndlm@y3UrJo#G~;z~VPP(TaR$G+Ho0Uc|wf&v$~hACLX3-h}GBIkiArdUN5%w#4{G|m&~L?!5Jc;f=~FB5Q8182}^i`7ntF+sMUgMSE~iZqBX6ulqEZY zQ3wP7)Ybqh$gOU7n_El-qXL51#1MvCix(L8xTd9r7HGj-Do)_J(47E9Hu~Deh5!(a z;Xww7FpE_bLLJ}@uXuUEi&zk1xI;khahc0rT15A`^?0vzFY;R0!r&!O=*4!s`-uoV z0RtFF#g^#M17Z|GxI=ivBi2g`C^*=`ZHRD$gFxXRK!OGphHgmeo7VgGqZ={k1rY{N zf(T?l1r+E;fa!n^0}CR-ig@sYB~0UIRQSdhCPjvy%aFx#xC0*UhZ|zh1!X8h19Oc* z1jtZ^f)e7zLx4glrd*0=SlP-a$g-BVtcot@SjQB8Zfg}n-TDGK$P^$#FWm41t~AvD z01+6$lkxEgMO699S>}h9yUgc4^EtbDc-$-dc&I%rHBJPx^RjZs2~C*(85@wkWqtl zo3R80caZzxg$hVw7o(6s7($~5YEWYi7|*yZ>b(I0jKdTh=lHU5aDpJ%LmK@5Hn9qN zk!^w(ydejNfcm~2>mYj}7L}-h8h+sq5%~P)Ko>z6KmY;(2mlia__#1c&TLgc0t{VP z$2#m#h(fG_2rlR4K)T&+qR#x)HE+z#J)`qWkl^fSN4pDVFoQ4{fB|r4z(0}>@(nQC z22O9n4rC#VJTSljwxvKN4SsN0eqG@O7&{^Mp>s_*{_&8n0gMpAjbaqz5DEClKbVn; zyQ|^^kk~;C>_CA}G@t?S_yn8>5A(&w_V6`Vyd3iJ0W8@5_PEFW3`7u*-j8GRnP~Rs z+W?7hxFG`YIQ{9X01w=<{xyYveZple`+QV9<0#0!_P37$VR*me<;cYU=bzCAC`=(7 zz4$~G*582juOA*6c)sg=9NQ4U{=SMA1f8eM4@+bE|Cq*Ul<*3fKz>j_3okGQ$lwM< zpj#QR3f={Hw)K1mhgS7>e=tx;u`meM@MLoEfggwuB8U&@g0!%PZ zGqgw0S6@9ybK!O!Facm(7+`%uD;_`<5j9a!C{4OlPvf(L9Cn3ZmxWLP6Fkv{UI;C1 z5r#i8hEZ6C6*Pr|SAnm^h6*=pS{R32C}4DG0d^P{5|xKis7IAG#C2;ZeOTyWgD8h{ u=p%I~h6k{Sd1!|8v`3I=g_78Y;`WAHD2IlKiHN9)oT!Ip#D}I65CA*NLG{4^ literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/wizban/rmotejar_exprt.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/wizban/rmotejar_exprt.gif new file mode 100644 index 0000000000000000000000000000000000000000..d51c1dbf8af18563d7405b2959d2cdf8ddfb4234 GIT binary patch literal 3249 zcmV;i3{LY$Nk%w1VM_o)0QUd@|NsBq=J@FD`g)bPGgWu``|{%B>+$sb-Rbq@zEGIi^|Ni&%;;Nsv(~qLQ>+t&I>iOX2^ZEMy z?(+NW(uh`er{U=J`uqMyW}3RrFx5Y!rRi@-E@MOYKFF>xzqpu=*raB)7H(} z+T`%|`s3>Pae0W%-R-Qn#QXgI^4y}z)8h2z#p&+)>hJnbV|d%+;nLyou*Kbio4k#T ziQeY*l&sBnn#keo_P){P?C|vT`{pnzG3A@#XaQ{EDK) zw#wn`^ZNGd%;4wv)Y07H>G-(0%jN9()7+bCE^Yh5r>f_-DL;)6v@2h^o}%?f1&o=>7fvuffvi?fU!s%-`hk z{`=y@%*p=#?xnrh0oVtjHk%u?)a&{+VtqP#@FiQ$6@{Y?&syz(ckZJjJfag`{U^H=IZhG_w>EX z-0SJw^5nVx|NqCwxYyR<^y$Cx`2By5p)5&%@X?Ly^ZNY!`OV(%?)Cii_tM_u@Avuo zyu{KtNL=*y;iIj^>hby4)ZY2=zVY+-?C|*K@c8)a!-0yU^7s4p`0oGz`|9%f;Nj}v zCfQsS%A0i^7)XMv5lz8%iHbz`RniU+mNQpnW(*DS4 z@QkzHnXu9G_4)n$*Z2AT+T-x{Nr@C zxWv_Bf3VfGKi}%(maopu*W~*6>aWb)pt#n5kfpA`&y=OX-`>&o_UGg2+3Dxk{PyYS z@%riV`aocmA^8LV00000EC2ui080Qu000R8009UbNU)&6g9sBUTu9Ih2qy{zFq}xS z;>1524n!2d(W1wX6TNI$Z~z0xlM+FyTnS*tHzyEp+(6lprOl8t7Qj4!LyJtBDQ^lr z2tp@J1vq;Cq&c+dK$i=2mc)?M=S-$fh5q>#HR@EVO0S~KYExuaouU+ASX*`JSh6ai zc6Gu*fm*gNeVQbeJ=3Pb3X5vnsjjeB9jiqM!pp@J0drH#`L zZ&OJJ8mJ`UNqLNXL6#sS^Qc3NJL*;GUtyCtCrBaHZhN)aTM zNa7}&;GrTOMYw@qY!)6@TTnK+;f4)K)FB83p48z>8mvf1Lj|m)QAacn)&XP%6z1pM zg^#^;lM)Fe&`Bp9WS3nBTyiCv0s|uiU}ykMouWz?55V!jqmV`_X%}6nf)95UHYUy$Rg6&Rp@%j_ zN)Pv(@(BxTtbtFeYp~!d3zJO$Qb-|VP}2iAm^!JJ0Gu+wz!aW>8mdt73_!;cr>uI$ zvdga8s;jZiI))5AIPjtZS_t|=6;=2O?5DyCMalpvxKK(y`|JbBy8C?6Y^txK`bjn` z^q`I?Cb8M(w%z_3tgwjQ^aK#PNODUl1$g6)Ck)GzPZJPF3^5sGkdTZ$Jxp=M#u@C( zt+)S%Yg0TueDF;z#cWW3A*py_j4UuqQp(I_ltBa$B#eRp7Y<-j!p8c(z%R()f+}zd zt$>k8DY8)Dg%_zr?Zpfmgh7l8%+g0y&*))z*@%a1G)qkA(Y6?s5J5{AVF*I|?N@_whv!^?4!8s&00G45 zL!YgfPj9?Vh3^%LL!b41u!`9fl-LUG3duN zF6^Kh+!Nd){NTUTq0LY$`GX?{00wg$kPAY{#2t8XjAO*&g)O`T{X8d!3rfHNLl7J$ zI7qhesV;3Enc4{dX@P(kfMO2nOGGea$izDYBN&NDL?0@+13O4y2su2&4m(J+-gr7#mwOk)}|(T6GS3>0Q?fCxk|gc5AAhyVK_2tASty3HVr2(UvnK#@Qp zw6TqBJmeI)hJZQ5fD=QQ;}EpS!^3rPd>--R9|u50GngR;NECu7M@dRiA^-t>d!z`U z0EHpYV~1_xRuw+*fhiadlNI@cCWnXsPH>_c2t1`QhdE3+Sg;zvgF+-k@Jc_>@|n+^ z!Vd!Q!2lTJn%K;yHm?b@xbZT7W;mi8#!1Xmj?K9S%Xo~^P(8N=lCd~ zf-mSp4Im9ENcTX}J*;2_Ul=GaBk2G$pl=Qe<$_FS%7r%qKWt5I{`^ zJ%LKkd*X9g9F;~SN{|8zSb!Vw0Kzn$u!t;V0SGCb0SQQmfFVFZ1QMvmGL|QXvcj~i zWnD(-II&J1XyOpeB%Cb$f)t2=8;eNC5k`B2y3TbF>0pOOS0|99mOv9|;6o?` z>w$m&yn+%>NNHlq7YxU`Qvzln<18ji+-1xH8u*hVI}bq*&%$F7maqhAOKaD3P(!sx z-Qz%#st0?>}Y1>G)y4h~2J6iV>e9CE@A(3pjM3-pX2_N`?QE-3*1PH)pHs@gf z3%R%ik9%wgUA&z3C58yF? zOTb_lm>$Lna=_^vT;c?|*a8;jOy^?MfE(Lj#w*qlij@9>1WQn|Bg$atTB||JI>@!I zv4IT|=voIRum?PzfQw$NVihfDL3B$y2o0nI2BKzgL%eVvUC1B{K`??5THR+@TO$HJ zpaU-Upaw*k8xc#Om^Nx=WilW_4JNoo3dl@sBv9el%9ie2H86#ATw>JH7Rb|-@iId| zq6Y(Dh7nM3WFjoV8oh{s3@$K$MbLo`tpkL{H?9XJFaaLVzywwAA%h4Y!QROKUUsuT z;Hw&7p_&JIniuFM3uWkI04N9n!!i8ohxY;r5r}{ltgwq+P~!qfPdd`6QS_k)J?K<0 zwz7|~at3(Ni_@OD+-6YoIP{<$?J#dQaJB>kSR>iJNIMly&i1z3JL<+xxpb3}3|dyf zhcM5&CT9SGt`8vW1*nV@y3q`rk$}-|fQ-gF{_)75doo5r`Htc7>e7CiF1OD2 zzAGaRe6Gx8oNxdNHKQ58NIedyOoBYP{`GliMC=>Uh%3~dczMjbz-PYst%KnAlK8xC z6$6uYeFnvGI85{N(mjf=MoV9Rvb`?~!e1i>dn;E7-S<0Bt7F`|l&Pnhrgu~{Pa*ItfBXVy{_`(?Ns&#T`g_-Ym?H_2U>T!leBPIQ-+_Pn zXMU*Df2*T@>*ssdhdCQ?3kGNu2>5+4vVd37fVhWw;UaSY7=RUMff-nQq(^@Wcp3~? jejx~fp+bTH$bKhC87Vk_321*FNPhcwegFh20RaFzdUUQe literal 0 HcmV?d00001 diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/wizban/rmotejar_imprt.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/wizban/rmotejar_imprt.gif new file mode 100644 index 0000000000000000000000000000000000000000..7d43b7ed09c5d367db46de02c91c9d61ff16ae2d GIT binary patch literal 3357 zcmV+&4dU`gNk%w1VM_o)0QUd@|NsBq=J@FD`bSu7-0Ai5*_Z3^`r+vKVp+)Yr|*)!W_V?C{;8<;!Z~>iOB`^Z5Gx>Fn{av$UnM#q{B( z-{<)E`TgA7!Z2Uu*2JzwAt$K`i7pozR~8v)8><|&gJa+`uzUv z$$9+z^R>Fmr^V+wR*2^9`gxVP;=WMi>h}Bm{_^wlw#(v)*Kk{rSbdnBwU3<>v0j*y`!=`Ps2F{r&!an!QYJqS4IP z&C<)8vd#GH%{^Os_WAvWpu@`A>@7=y*x&5u@c7u(-|_hUp|;U2OlowEx{{o*kd>|N z?BC_?_`Ay8-{I=!@A%T&;`aFZn61nH|Np(o$}2~G@9V_$_W1ew{@CE%;N$J$j_WAtf>gCPb>X4?&^Z5GU-_gz2>tcSe>GJyL@Z0FhILAztjBv{OIxe^!4w2lCCjOh5r8j^yjts=D7Lqwwkfg`TPCm z>+|>d{NU#4A^8LV00000EC2ui080Qu000R8009UbNU)&6g9sBUTu3lY7dHw7Fq}xS z;zU5A$V3#t(W1wX6Vr%F!oUE>lM+FyTnWHN2PzOlgh1JmrOl8wl2D<-z{C-mG*jLj zda#R5mr(}6Y+CDB>ZfYP5cn?4;1sKeB$Rjn?~igK$>kzaMHQedF%Ri

    + */ + public void renameSystemProfile(ISystemProfile profile, String newName) + { + boolean isActive = isSystemProfileActive(profile.getName()); + String oldName = profile.getName(); + profile.setName(newName); + if (isActive) + SystemPreferencesManager.getPreferencesManager().renameActiveProfile(oldName, newName); + invalidateCache(); + // FIXME SystemPlugin.getThePersistanceManager().save(this); + } + + /** + * Delete the given profile + * This will: + *
      + *
    • Delete the profile in memory + *
    • Delete the underlying folder + *
    • Update the user preferences if this profile is currently active. + *
    + */ + public void deleteSystemProfile(ISystemProfile profile) + { + String oldName = profile.getName(); + boolean isActive = isSystemProfileActive(oldName); + + getProfiles().remove(profile); + /* FIXME + // now in EMF, the profiles are "owned" by the Resource, and only referenced by the profile manager, + // so I don't think just removing it from the manager is enough... it must also be removed from its + // resource. Phil. + Resource res = profile.eResource(); + if (res != null) + res.getContents().remove(profile); +*/ + if (isActive) + SystemPreferencesManager.getPreferencesManager().deleteActiveProfile(oldName); + invalidateCache(); + + //FIXME SystemPlugin.getThePersistanceManager().save(this); + + } + + /** + * Clone the given profile to a new one with the given name. + * Pretty useless right now, as there is no data to clone! + */ + public ISystemProfile cloneSystemProfile(ISystemProfile profile, String newName) + { + ISystemProfile newProfile = createSystemProfile(newName, false); + return newProfile; + } + + /** + * Return true if the given profile is active. + * @see ISystemProfile#isActive() + */ + public boolean isSystemProfileActive(String profileName) + { + String[] activeProfiles = getActiveSystemProfileNames(); + boolean match = false; + for (int idx=0; !match && (idx 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. + */ + public Object[] getConnectionChildren(IHost selectedConnection) + { + return getSubSystems(selectedConnection); + } + /** + * 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; // much faster and safer + /* + boolean hasSubsystems = false; + if (subsystemFactoryProxies != null) + { + for (int idx = 0; (!hasSubsystems) && (idx < subsystemFactoryProxies.length); idx++) + { + if (subsystemFactoryProxies[idx].appliesToSystemType(selectedConnection.getSystemType()) && + subsystemFactoryProxies[idx].isSubSystemFactoryActive()) + { + SubSystemFactory factory = subsystemFactoryProxies[idx].getSubSystemFactory(); + if (factory != null) + { + SubSystem[] sss = factory.getSubSystems(selectedConnection, SubSystemFactory.LAZILY); + if ((sss != null) && (sss.length>0)) + hasSubsystems = true; + } + else + hasSubsystems = false; + } + else + hasSubsystems = true; + } + } + else + hasSubsystems = true; + return hasSubsystems; + */ + } + /** + * 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); + } + /** + * Set the shell in case it is needed for anything. + * The label and content provider will call this. + */ + public void setShell(Shell shell) + { + } + + /** + * Return the shell of the current viewer + */ + + // thread safe shell + public Shell getShell() + { + IWorkbench workbench = SystemPlugin.getDefault().getWorkbench(); + if (workbench != null) + { + // first try to get the active workbench window + IWorkbenchWindow ww = workbench.getActiveWorkbenchWindow(); + if (ww == null) // no active window so just get the first one + ww = workbench.getWorkbenchWindows()[0]; + if (ww != null) + { + Shell shell = ww.getShell(); + if (!shell.isDisposed()) + { + return shell; + } + } + } + return null; + } + + /** + * Return true to show the action bar (ie, toolbar) above the viewer. + * The action bar contains connection actions, predominantly. + */ + public boolean showActionBar() + { + return true; + } + /** + * Return true to show the button bar above the viewer. + * The tool bar contains "Get List" and "Refresh" buttons and is typicall + * shown in dialogs that list only remote system objects. + */ + public boolean showButtonBar() + { + return false; + } + /** + * Return true to show right-click popup actions on objects in the tree. + */ + public boolean showActions() + { + return true; + } + /** + * Set the viewer in case it is needed for anything. + * The label and content provider will call this. + */ + public void setViewer(Viewer viewer) + { + this.viewer = viewer; + } + /** + * Return the viewer we are currently associated with + */ + public Viewer getViewer() + { + return viewer; + } + /** + * Return true if we are listing connections or not, so we know whether we are interested in + * connection-add events + */ + public boolean showingConnections() + { + return true; + } + + // ---------------------------------- + // ACTIVE PROGRESS MONITOR METHODS... + // ---------------------------------- + /** + * Set the current active runnable context to be used for a progress monitor + * by the subsystem methods that go to the host. Called by wizards and dialogs + * that have a built-in progress monitor and hence removes the need to popup + * an intrusive pm dialog. + *

    You must call clearRunnableContext when your dialog/wizard is disposed! + * @param shell The shell of the wizard/dialog. This is recorded so it can be tested if + * it is disposed before attempting to use the context + * @param context The dialog/wizard/view that implements IRunnableContext + */ + public void setRunnableContext(Shell shell, IRunnableContext context) + { + //this.currentRunnableContext = context; + //this.currentRunnableContextShell = shell; + pushRunnableContext(shell, context); + } + /** + * Clear the current active runnable context to be used for a progress monitor. + * Be sure to call this from you dispose method. + */ + public void clearRunnableContext() + { + //this.currentRunnableContext = null; + //this.currentRunnableContextShell = null; + popRunnableContext(); + } + /** + * Return the current registered runnable context, or null if none registered. Use this + * for long running operations instead of an intrusive progress monitor dialog as it is + * more user friendly. Many dialogs/wizards have these built in so it behooves us to use it. + */ + public IRunnableContext getRunnableContext() + { + if ((currentRunnableContextShell != null) && currentRunnableContextShell.isDisposed()) + clearRunnableContext(); + if (currentRunnableContext != null) + return currentRunnableContext; + else + return null; + } + + private IRunnableContext popRunnableContext() + { + Shell shell = null; + boolean found = false; + Vector disposedShells = new Vector(); + Vector disposedContexts = new Vector(); + for (int idx = previousRunnableContextShells.size() - 1; !found && (idx >= 0); idx--) + { + shell = (Shell) previousRunnableContextShells.elementAt(idx); + if ((shell == currentRunnableContextShell) || shell.isDisposed()) + { + disposedShells.add(shell); + disposedContexts.add(previousRunnableContexts.elementAt(idx)); + } + else + { + found = true; + currentRunnableContextShell = shell; + currentRunnableContext = (IRunnableContext) previousRunnableContexts.elementAt(idx); + } + } + if (!found) + { + currentRunnableContextShell = null; + currentRunnableContext = null; + } + for (int idx = 0; idx < disposedShells.size(); idx++) + { + previousRunnableContextShells.remove(disposedShells.elementAt(idx)); + previousRunnableContexts.remove(disposedContexts.elementAt(idx)); + } + + return currentRunnableContext; + } + + private IRunnableContext pushRunnableContext(Shell shell, IRunnableContext context) + { + previousRunnableContexts.addElement(context); + previousRunnableContextShells.addElement(shell); + currentRunnableContextShell = shell; + currentRunnableContext = context; + return currentRunnableContext; + } + + // ---------------------------- + // SUBSYSTEM FACTORY METHODS... + // ---------------------------- + + /** + * Private method used by SystemPlugin to tell registry all registered subsystem + * factories. This way, all code can use this registry to access them versus the + * SystemPlugin. + */ + public void setSubSystemConfigurationProxies(ISubSystemConfigurationProxy[] proxies) + { + subsystemFactoryProxies = proxies; + //for (int idx=0; idx + * This looks for a match on the "category" of the subsystem factory's xml declaration + * in its plugin.xml file. Thus, it is effecient as it need not bring to life a + * subsystem factory just to test its parent class type. + * + * @see ISubSystemFactoryCategories + */ + public ISubSystemConfiguration[] getSubSystemConfigurationsByCategory(String factoryCategory) + { + Vector v = new Vector(); + if (subsystemFactoryProxies != null) + { + for (int idx = 0; idx < subsystemFactoryProxies.length; idx++) + { + if (subsystemFactoryProxies[idx].getCategory().equals(factoryCategory)) + { + ISubSystemConfiguration factory = subsystemFactoryProxies[idx].getSubSystemFactory(); + if (factory != null) + v.addElement(factory); + } + } + } + ISubSystemConfiguration[] factories = new ISubSystemConfiguration[v.size()]; + for (int idx = 0; idx < v.size(); idx++) + { + factories[idx] = (ISubSystemConfiguration) v.elementAt(idx); + } + return factories; + } + + public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(String systemType) + { + return getSubSystemConfigurationsBySystemType(systemType, false); + } + + /** + * Return all subsystem factories which support the given system type. If the type is null, + * returns all. + * + */ + public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(String systemType, boolean filterDuplicateServiceSubSystemFactories) + { + List serviceTypesAdded = new ArrayList(); + List serviceImplsAdded = new ArrayList(); + Vector v = new Vector(); + if (subsystemFactoryProxies != null) + { + for (int idx = 0; idx < subsystemFactoryProxies.length; idx++) + { + ISubSystemConfigurationProxy ssfProxy = subsystemFactoryProxies[idx]; + if (ssfProxy.appliesToSystemType(systemType)) + { + ISubSystemConfiguration ssFactory = ssfProxy.getSubSystemFactory(); + if (ssFactory != null) + { + if (ssFactory instanceof IServiceSubSystemConfiguration && filterDuplicateServiceSubSystemFactories) + { + IServiceSubSystemConfiguration serviceFactory = (IServiceSubSystemConfiguration)ssFactory; + Class serviceType = serviceFactory.getServiceType(); + Class serviceImplType = serviceFactory.getServiceImplType(); + boolean containsThisServiceType = serviceTypesAdded.contains(serviceType); + boolean containsThisServiceImplType = serviceImplsAdded.contains(serviceImplType); + + if (!containsThisServiceType) + { + serviceTypesAdded.add(serviceType); + serviceImplsAdded.add(serviceImplType); + v.addElement(ssFactory); + } + else if (containsThisServiceImplType) + { + // remove the other one + for (int i = 0; i < v.size(); i++) + { + IServiceSubSystemConfiguration addedConfig = (IServiceSubSystemConfiguration)v.get(i); + if (addedConfig.getServiceType() == serviceType) + { + v.remove(addedConfig); + } + } + + v.addElement(ssFactory); + } + } + else + { + v.addElement(ssFactory); + } + } + } + } + } + ISubSystemConfiguration[] factories = new ISubSystemConfiguration[v.size()]; + for (int idx = 0; idx < v.size(); idx++) + factories[idx] = (ISubSystemConfiguration) v.elementAt(idx); + return factories; + } + + // ---------------------------- + // USER PREFERENCE METHODS... + // ---------------------------- + /** + * Are connection names to be qualified by profile name? + */ + public boolean getQualifiedHostNames() + { + return SystemPreferencesManager.getPreferencesManager().getQualifyConnectionNames(); + } + /** + * Set if connection names are to be qualified by profile name + */ + public void setQualifiedHostNames(boolean set) + { + SystemPreferencesManager.getPreferencesManager().setQualifyConnectionNames(set); + IHost[] conns = getHosts(); + if (conns != null) + { + for (int idx = 0; idx < conns.length; idx++) + { + fireEvent(new SystemResourceChangeEvent(conns[idx], ISystemResourceChangeEvents.EVENT_RENAME, this)); + } + } + if (SystemPreferencesManager.getPreferencesManager().getShowFilterPools()) + { + fireEvent(new SystemResourceChangeEvent(this, ISystemResourceChangeEvents.EVENT_REFRESH, this)); + } + + } + + /** + * Reflect the user changing the preference for showing filter pools. + */ + public void setShowFilterPools(boolean show) + { + if (subsystemFactoryProxies != null) + { + for (int idx = 0; idx < subsystemFactoryProxies.length; idx++) + { + if (subsystemFactoryProxies[idx].isSubSystemFactoryActive()) + { + ISubSystemConfiguration factory = subsystemFactoryProxies[idx].getSubSystemFactory(); + if ((factory != null) && factory.supportsFilters()) + factory.setShowFilterPools(show); + } + } + } + } + /* + * Reflect the user changing the preference for showing filter strings. + * + public void setShowFilterStrings(boolean show) + { + if (subsystemFactoryProxies != null) + { + for (int idx = 0; idx < subsystemFactoryProxies.length; idx++) + { + if (subsystemFactoryProxies[idx].isSubSystemFactoryActive()) + { + SubSystemFactory factory = subsystemFactoryProxies[idx].getSubSystemFactory(); + if ((factory!=null)&&factory.supportsFilters()) + factory.setShowFilterStrings(show); + } + } + } + }*/ + /** + * Reflect the user changing the preference for showing new connection prompt + */ + public void setShowNewHostPrompt(boolean show) + { + fireEvent(new org.eclipse.rse.model.SystemResourceChangeEvent(this, ISystemResourceChangeEvents.EVENT_REFRESH, null)); + } + + // ---------------------------- + // PROFILE METHODS... + // ---------------------------- + /** + * Return singleton profile manager + */ + public ISystemProfileManager getSystemProfileManager() + { + return SystemProfileManager.getSystemProfileManager(); + } + + /** + * Return the profiles currently selected by the user as his "active" profiles + */ + public ISystemProfile[] getActiveSystemProfiles() + { + return getSystemProfileManager().getActiveSystemProfiles(); + } + /** + * Return the profile names currently selected by the user as his "active" profiles + */ + public String[] getActiveSystemProfileNames() + { + return getSystemProfileManager().getActiveSystemProfileNames(); + } + /** + * Return all defined profiles + */ + public ISystemProfile[] getAllSystemProfiles() + { + return getSystemProfileManager().getSystemProfiles(); + } + /** + * Return all defined profile names + */ + public String[] getAllSystemProfileNames() + { + return getSystemProfileManager().getSystemProfileNames(); + } + /** + * Return all defined profile names as a vector + */ + public Vector getAllSystemProfileNamesVector() + { + return getSystemProfileManager().getSystemProfileNamesVector(); + } + + /** + * Get a SystemProfile given its name + */ + public ISystemProfile getSystemProfile(String profileName) + { + return getSystemProfileManager().getSystemProfile(profileName); + } + + /** + * Create a SystemProfile given its name and whether or not to make it active + */ + public ISystemProfile createSystemProfile(String profileName, boolean makeActive) throws Exception + { + ISystemProfileManager mgr = getSystemProfileManager(); + ISystemProfile profile = mgr.createSystemProfile(profileName, makeActive); + if (makeActive) + { + //fireEvent(new SystemResourceChangeEvent(profile,ISystemResourceChangeEvent.EVENT_ADD,this)); + } + fireModelChangeEvent(SYSTEM_RESOURCE_ADDED, SYSTEM_RESOURCETYPE_PROFILE, profile, null); + return profile; + } + + /** + * Rename a SystemProfile. Rename is propogated to all subsystem factories so + * they can rename their filter pool managers and whatever else is required. + */ + public void renameSystemProfile(ISystemProfile profile, String newName) throws Exception + { + /* FIXME + // first, pre-test for folder-in-use error: + IResource testResource = SystemResourceManager.getProfileFolder(profile); + boolean inUse = SystemResourceManager.testIfResourceInUse(testResource); + if (inUse) + { + SystemMessage msg = SystemPlugin.getPluginMessage((testResource instanceof IFolder) ? ISystemMessages.MSG_FOLDER_INUSE : ISystemMessages.MSG_FILE_INUSE); + msg.makeSubstitution(testResource.getFullPath()); + throw new SystemMessageException(msg); + } + */ + + // step 0: force everything into memory! Very important to do this! + loadAll(); + // step 0_a: get the proxies and the relavent connections... + ISubSystemConfigurationProxy[] proxies = getSubSystemConfigurationProxies(); + IHost[] connections = getHostsByProfile(profile); + String oldName = profile.getName(); + + // step 0_b: pre-test if any of the subfolder or file renames will fail... + if (proxies != null) + { + for (int idx = 0; idx < proxies.length; idx++) + { + // the following call will throw an exception if any of the affected folders/files are in use. + if (proxies[idx] != null && proxies[idx].getSubSystemFactory() != null) + proxies[idx].getSubSystemFactory().preTestRenameSubSystemProfile(oldName); + } + } + + // step 1: update connection pool. This is simply the in-memory name of the pool. + ISystemHostPool profilePool = getHostPool(profile); + profilePool.renameHostPool(newName); + + // step 2: rename profile and its folder on disk + getSystemProfileManager().renameSystemProfile(profile, newName); + + // step 3: for every subsystem factory, ask it to rename its filter pool manager, + // and more importantly the folder name that manager holds. + if (proxies != null) + { + for (int idx = 0; idx < proxies.length; idx++) + { + // Hmm, in v4 we only did this for active factories. That can't be right, as it needs to be done + // for EVERY factory. Hence this commented line of code, new for v5 (and to fix a bug I found in + // profile renaming... the local connection's filter pool folder was not renamed). Phil... + //if (proxies[idx].isSubSystemFactoryActive()) + ISubSystemConfiguration factory = proxies[idx].getSubSystemFactory(); + if (factory != null) + { + ISubsystemConfigurationAdapter adapter = (ISubsystemConfigurationAdapter)factory.getAdapter(ISubsystemConfigurationAdapter.class); + adapter.renameSubSystemProfile(factory,oldName, newName); + } + } + } + + // step 4: update every subsystem for every connection in this profile. + // important to do this AFTER the profile is renamed. + for (int idx = 0; idx < connections.length; idx++) + { + ISubSystem[] subsystems = getSubSystems(connections[idx]); + for (int jdx = 0; jdx < subsystems.length; jdx++) + { + ISubSystem ss = subsystems[jdx]; + ISubSystemConfiguration ssf = ss.getSubSystemConfiguration(); + ssf.renameSubSystemProfile(ss, oldName, newName); + } + } + SystemPreferencesManager.getPreferencesManager().setConnectionNamesOrder(); // update preferences order list + boolean namesQualifed = getQualifiedHostNames(); + if (namesQualifed) + setQualifiedHostNames(namesQualifed); // causes refresh events to be fired + + fireModelChangeEvent(SYSTEM_RESOURCE_RENAMED, SYSTEM_RESOURCETYPE_PROFILE, profile, oldName); + } + /** + * Copy a SystemProfile. All connections connection data is copied. + * @param monitor Progress monitor to reflect each step of the operation + * @param profile Source profile to copy + * @param newName Unique name to give copied profile + * @param makeActive whether to make the copied profile active or not + * @return new SystemProfile object + */ + public ISystemProfile copySystemProfile(IProgressMonitor monitor, ISystemProfile profile, String newName, boolean makeActive) throws Exception + { + Exception lastExc = null; + boolean failed = false; + String msg = null; + String oldName = profile.getName(); + IHost[] newConns = null; + + //SystemPlugin.logDebugMessage(this.getClass().getName(), "Start of system profile copy. From: "+oldName+" to: "+newName+", makeActive: "+makeActive); + // STEP 0: BRING ALL IMPACTED SUBSYSTEM FACTORIES TO LIFE NOW, BEFORE CREATING THE NEW PROFILE. + // IF WE DO NOT DO THIS NOW, THEN THEY WILL CREATE A FILTER POOL MGR FOR THE NEW PROFILE AS THEY COME + // TO LIFE... SOMETHING WE DON'T WANT! + loadAll(); // force the world into memory! + IHost[] conns = getHostsByProfile(profile); + Vector factories = getSubSystemFactories(conns); + if (errorLoadingFactory) + return null; + + // STEP 1: CREATE NEW SYSTEM PROFILE + ISystemProfile newProfile = getSystemProfileManager().cloneSystemProfile(profile, newName); + + try + { + // STEP 2: CREATE NEW SYSTEM CONNECTION POOL + ISystemHostPool oldPool = getHostPool(profile); + ISystemHostPool newPool = getHostPool(newProfile); + + // STEP 3: COPY ALL CONNECTIONS FROM OLD POOL TO NEW POOL + //try { java.lang.Thread.sleep(2000l); } catch (InterruptedException e) {} + if ((conns != null) && (conns.length > 0)) + { + newConns = new IHost[conns.length]; + SystemMessage msgNoSubs = SystemPlugin.getPluginMessage(ISystemMessages.MSG_COPYCONNECTION_PROGRESS); + for (int idx = 0; idx < conns.length; idx++) + { + msgNoSubs.makeSubstitution(conns[idx].getAliasName()); + SystemBasePlugin.logDebugMessage(this.getClass().getName(), msgNoSubs.getLevelOneText()); + monitor.subTask(msgNoSubs.getLevelOneText()); + + newConns[idx] = oldPool.cloneHost(newPool, conns[idx], conns[idx].getAliasName()); + + monitor.worked(1); + //try { java.lang.Thread.sleep(3000l); } catch (InterruptedException e) {} + } + } + msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_COPYFILTERPOOLS_PROGRESS).getLevelOneText(); + monitor.subTask(msg); + SystemBasePlugin.logDebugMessage(this.getClass().getName(), msg); + + // STEP 4: CREATE NEW FILTER POOL MANAGER + // STEP 5: COPY ALL FILTER POOLS FROM OLD MANAGER TO NEW MANAGER + for (int idx = 0; idx < factories.size(); idx++) + { + ISubSystemConfiguration factory = (ISubSystemConfiguration) factories.elementAt(idx); + msg = "Copying filterPools for factory " + factory.getName(); + //monitor.subTask(msg); + SystemBasePlugin.logDebugMessage(this.getClass().getName(), msg); + factory.copyFilterPoolManager(profile, newProfile); + //try { java.lang.Thread.sleep(3000l); } catch (InterruptedException e) {} + } + + monitor.worked(1); + + // STEP 6: COPY ALL SUBSYSTEMS FOR EACH COPIED CONNECTION + msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_COPYSUBSYSTEMS_PROGRESS).getLevelOneText(); + monitor.subTask(msg); + SystemBasePlugin.logDebugMessage(this.getClass().getName(), msg); + if ((conns != null) && (conns.length > 0)) + { + ISubSystem[] subsystems = null; + ISubSystemConfiguration factory = null; + for (int idx = 0; idx < conns.length; idx++) + { + msg = "Copying subsystems for connection " + conns[idx].getAliasName(); + //monitor.subTask(msg); + SystemBasePlugin.logDebugMessage(this.getClass().getName(), msg); + subsystems = getSubSystems(conns[idx]); // get old subsystems for this connection + if ((subsystems != null) && (subsystems.length > 0)) + { + for (int jdx = 0; jdx < subsystems.length; jdx++) + { + msg += ": subsystem " + subsystems[jdx].getName(); + //monitor.subTask(msg); + SystemBasePlugin.logDebugMessage(this.getClass().getName(), msg); + factory = subsystems[jdx].getSubSystemConfiguration(); + factory.cloneSubSystem(subsystems[jdx], newConns[idx], true); // true=>copy profile op vs copy connection op + //try { java.lang.Thread.sleep(3000l); } catch (InterruptedException e) {} + } + } + //try { java.lang.Thread.sleep(1000l); } catch (InterruptedException e) {} + } + } + monitor.worked(1); + } + catch (Exception exc) + { + failed = true; + lastExc = exc; + } + // if anything failed, we have to back out what worked. Ouch! + if (failed) + { + try + { + if (newConns != null) + for (int idx = 0; idx < newConns.length; idx++) + deleteHost(newConns[idx]); + for (int idx = 0; idx < subsystemFactoryProxies.length; idx++) + { + ISubSystemConfiguration factory = subsystemFactoryProxies[idx].getSubSystemFactory(); + if (factory != null) + factory.deletingSystemProfile(newProfile); + } + getSystemProfileManager().deleteSystemProfile(newProfile); + } + catch (Exception exc) + { + SystemBasePlugin.logError("Exception (ignored) cleaning up from copy-profile exception.", exc); + } + throw (lastExc); + } + + // LAST STEP: MAKE NEW PROFILE ACTIVE IF SO REQUESTED: NO, CAN'T DO IT HERE BECAUSE OF THREAD VIOLATIONS! + //if (makeActive) + //setSystemProfileActive(newProfile, true); + + fireModelChangeEvent(SYSTEM_RESOURCE_ADDED, SYSTEM_RESOURCETYPE_PROFILE, newProfile, null); + + SystemBasePlugin.logDebugMessage(this.getClass().getName(), "Copy of system profile " + oldName + " to " + newName + " successful"); + return newProfile; + } + + /** + * Delete a SystemProfile. Prior to physically deleting the profile, we delete all + * the connections it has (first disconnecting if they are connected), and all the subsystems they have. + *

    + * As well, all the filter pools for this profile are deleted, and subsequently any + * cross references from subsystems in connections in other profiles are removed. + *

    + * A delete event is fired for every connection deleted. + */ + public void deleteSystemProfile(ISystemProfile profile) throws Exception + { + // step 0: load the world! + loadAll(); // force the world into memory! + + // step 1: delete subsystems and connections + IHost[] connections = getHostsByProfile(profile); + //SystemConnectionPool pool = getConnectionPool(profile); + for (int idx = 0; idx < connections.length; idx++) + { + deleteHost(connections[idx]); + } + // step 2: bring to life every factory and ask it to delete all filter pools for this profile + if (subsystemFactoryProxies != null) + { + for (int idx = 0; idx < subsystemFactoryProxies.length; idx++) + { + ISubSystemConfiguration factory = subsystemFactoryProxies[idx].getSubSystemFactory(); + if (factory != null) + factory.deletingSystemProfile(profile); + } + } + // last step... physically blow away the profile... + getSystemProfileManager().deleteSystemProfile(profile); + SystemPreferencesManager.getPreferencesManager().setConnectionNamesOrder(); // update preferences order list + if ((connections != null) && (connections.length > 0)) // defect 42112 + fireEvent(new org.eclipse.rse.model.SystemResourceChangeEvent(connections, ISystemResourceChangeEvents.EVENT_DELETE_MANY, this)); + + fireModelChangeEvent(SYSTEM_RESOURCE_REMOVED, SYSTEM_RESOURCETYPE_PROFILE, profile, null); + } + + /** + * Make or unmake the given profile active. + * If switching to inactive, we force a disconnect for all subsystems of all connections in this profile. + */ + public void setSystemProfileActive(ISystemProfile profile, boolean makeActive) + { + // Test if there are any filter pools in this profile that are referenced by another active profile... + Vector activeReferenceVector = new Vector(); + if (!makeActive && (subsystemFactoryProxies != null)) + { + for (int idx = 0; idx < subsystemFactoryProxies.length; idx++) + { + //if (subsystemFactoryProxies[idx].isSubSystemFactoryActive()) // don't bother if not yet alive + { + ISubSystemConfiguration factory = subsystemFactoryProxies[idx].getSubSystemFactory(); + if (factory != null) + { + ISubSystem[] activeReferences = factory.testForActiveReferences(profile); + if (activeReferences != null) + for (int jdx = 0; jdx < activeReferences.length; jdx++) + activeReferenceVector.addElement(activeReferences[jdx]); + } + } + } + } + if (activeReferenceVector.size() > 0) + { + SystemBasePlugin.logWarning( + ISystemMessages.MSG_LOADING_PROFILE_SHOULDNOTBE_DEACTIVATED + + ": De-Activativing profile " + + profile.getName() + + " for which there are subsystems containing references to filter pools:"); + for (int idx = 0; idx < activeReferenceVector.size(); idx++) + { + ISubSystem activeReference = (ISubSystem) activeReferenceVector.elementAt(idx); + SystemBasePlugin.logWarning( + " " + activeReference.getName() + " in connection " + activeReference.getHost().getAliasName() + " in profile " + activeReference.getSystemProfileName()); + } + ISubSystem firstSubSystem = (ISubSystem) activeReferenceVector.elementAt(0); + String connectionName = firstSubSystem.getHost().getSystemProfileName() + "." + firstSubSystem.getHost().getAliasName(); + SystemMessage sysMsg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_LOADING_PROFILE_SHOULDNOTBE_DEACTIVATED); + sysMsg.makeSubstitution(profile.getName(), connectionName); + SystemBasePlugin.logWarning(sysMsg.getFullMessageID() + ": " + sysMsg.getLevelOneText()); + SystemMessageDialog msgDlg = new SystemMessageDialog(null, sysMsg); + msgDlg.open(); + } + + getSystemProfileManager().makeSystemProfileActive(profile, makeActive); + + // To be safe, we tell each subsystem factory about the change in status. + // At a minimum, each factory may have to load the subsystems for connections that + // are suddenly active. + if (subsystemFactoryProxies != null) + { + for (int idx = 0; idx < subsystemFactoryProxies.length; idx++) + { + if (subsystemFactoryProxies[idx].isSubSystemFactoryActive()) // don't bother if not yet alive + { + ISubSystemConfiguration factory = subsystemFactoryProxies[idx].getSubSystemFactory(); + if (factory != null) + factory.changingSystemProfileActiveStatus(profile, makeActive); + } + } + } + + IHost[] affectedConnections = getHostsByProfile(profile); + //System.out.println("Affected Connection Count: " + affectedConnections.length); + + // delete... + if (!makeActive) // better disconnect all connections before we lose sight of them + { + if ((affectedConnections != null) && (affectedConnections.length > 0)) + { + for (int idx = 0; idx < affectedConnections.length; idx++) + { + disconnectAllSubSystems(affectedConnections[idx]); + } + SystemResourceChangeEvent event = new org.eclipse.rse.model.SystemResourceChangeEvent(affectedConnections, ISystemResourceChangeEvents.EVENT_DELETE_MANY, this); + fireEvent(event); + } + } + // add... + else if ((affectedConnections != null) && (affectedConnections.length > 0)) + { + SystemResourceChangeEvent event = new org.eclipse.rse.model.SystemResourceChangeEvent(affectedConnections, ISystemResourceChangeEvents.EVENT_ADD_MANY, this); + fireEvent(event); + } + SystemPreferencesManager.getPreferencesManager().setConnectionNamesOrder(); // update preferences order list + + fireModelChangeEvent(SYSTEM_RESOURCE_CHANGED, SYSTEM_RESOURCETYPE_PROFILE, profile, null); + } + + // private profile methods... + + /** + * Get a SystemProfile given a connection pool + */ + private ISystemProfile getSystemProfile(ISystemHostPool pool) + { + return pool.getSystemProfile(); + } + /** + * Get a SystemProfile name given a connection pool + */ + private String getSystemProfileName(ISystemHostPool pool) + { + ISystemProfile profile = getSystemProfile(pool); + if (profile == null) return null; // MJB: Defect 45678 + else return profile.getName(); + } + public IConnectorService[] getConnectorServices(IHost conn) + { + List csList = new ArrayList(); + // DKM for now, I'll just use the subsystems to get at the systems + // but later with new model, we should be getting these directly + ISubSystem[] sses = getSubSystems(conn); + for (int i = 0; i < sses.length; i++) + { + ISubSystem ss = sses[i]; + IConnectorService service = ss.getConnectorService(); + if (!csList.contains(service)) + { + csList.add(service); + } + } + return (IConnectorService[])csList.toArray(new IConnectorService[csList.size()]); + } + + /** + * Return list of subsystem objects for a given connection. + * Demand pages the subsystem factories into memory if they aren't already. + *

    + * To protect against crashes, if there are no subsystems, an array of length zero is returned. + */ + public ISubSystem[] getSubSystems(IHost conn) + { + return getSubSystems(conn, ISubSystemConfiguration.FORCE_INTO_MEMORY); + } + + /** + * Return list of subsystem objects for a given connection. + * Demand pages the subsystem factories into memory if they aren't already. + *

    + * To protect against crashes, if there are no subsystems, an array of length zero is returned. + */ + public ISubSystem[] getSubSystems(IHost conn, boolean force) + { + ISubSystem[] subsystems = null; + Vector v = new Vector(); + + if (subsystemFactoryProxies != null) + { + for (int idx = 0; idx < subsystemFactoryProxies.length; idx++) + { + if (subsystemFactoryProxies[idx].appliesToSystemType(conn.getSystemType())) + { + ISubSystemConfiguration factory = subsystemFactoryProxies[idx].getSubSystemFactory(); + if (factory != null) + { + ISubSystem[] sss = factory.getSubSystems(conn, force); + if (sss != null) + for (int jdx = 0; jdx < sss.length; jdx++) + v.addElement(sss[jdx]); + } + } + } + //if (v.size() > 0) + //{ + subsystems = new ISubSystem[v.size()]; + for (int idx = 0; idx < v.size(); idx++) + subsystems[idx] = (ISubSystem) v.elementAt(idx); + //} + } + return subsystems; + } + + /** + * Resolve a subsystem from it's absolute name. The absolute name of a subsystem + * is denoted by profileName.connectionName:subsystemFactoryId + * + * @param absoluteSubSystemName the name of the subsystem + * + * @return the subsystem + */ + public ISubSystem getSubSystem(String absoluteSubSystemName) + { + // first extract subsystem id + int profileDelim = absoluteSubSystemName.indexOf("."); + int connectionDelim = absoluteSubSystemName.indexOf(":", profileDelim + 1); + + if (profileDelim > 0 && connectionDelim > profileDelim) + { + String srcProfileName = absoluteSubSystemName.substring(0, profileDelim); + String srcConnectionName = absoluteSubSystemName.substring(profileDelim + 1, connectionDelim); + String srcSubSystemFactoryId = absoluteSubSystemName.substring(connectionDelim + 1, absoluteSubSystemName.length()); + + return getSubSystem(srcProfileName, srcConnectionName, srcSubSystemFactoryId); + } + + return null; + } + + /** + * Resolve a subsystem from it's profile, connection and subsystem name. + * + * @param srcProfileName the name of the profile + * @param srcConnectionName the name of the connection + * @param subsystemFactoryId the factory Id of the subsystem + * + * @return the subsystem + */ + public ISubSystem getSubSystem(String srcProfileName, String srcConnectionName, String subsystemFactoryId) + { + // find the src connection + IHost[] connections = registry.getHostsByProfile(srcProfileName); + if (connections == null) + { + // if the profile can't be found, get all connections + connections = registry.getHosts(); + } + + for (int i = 0; i < connections.length; i++) + { + IHost connection = connections[i]; + String connectionName = connection.getAliasName(); + + if (connectionName.equals(srcConnectionName)) + { + ISubSystem[] subsystems = getSubSystems(connection); + for (int s = 0; s < subsystems.length; s++) + { + ISubSystem subsystem = subsystems[s]; + String compareId = subsystem.getConfigurationId(); + if (compareId.equals(subsystemFactoryId)) + { + return subsystem; + } + else + { + // for migration purposes, test the against the name + // we used to use the subsystem name instead of the factory Id + if (subsystem.getName().equals(subsystemFactoryId)) + { + return subsystem; + } + } + } + } + } + + return null; + } + + /** + * Return the absolute name for the specified subsystem + * @param the subsystem + * @return the absolute name of the subsystem + */ + public String getAbsoluteNameForSubSystem(ISubSystem subSystem) + { + StringBuffer dataStream = new StringBuffer(); + + String profileName = subSystem.getSystemProfileName(); + String connectionName = subSystem.getHostAliasName(); + String factoryId = subSystem.getConfigurationId(); + + dataStream.append(profileName); + dataStream.append("."); + dataStream.append(connectionName); + dataStream.append(":"); + dataStream.append(factoryId); + return dataStream.toString(); + } + + /** + * Return the absolute name for the specified connection + * @param the connection + * @return the absolute name of the connection + */ + public String getAbsoluteNameForConnection(IHost connection) + { + StringBuffer dataStream = new StringBuffer(); + + String profileName = connection.getSystemProfileName(); + String connectionName = connection.getAliasName(); + + dataStream.append(profileName); + dataStream.append("."); + dataStream.append(connectionName); + return dataStream.toString(); + } + + + /** + * Return list of subsystem objects for a given connection, but does not force + * as-yet-non-restored subsystems to come to life. + *

    + * To protect against crashes, if there are no subsystems, an array of length zero is returned. + */ + public ISubSystem[] getSubSystemsLazily(IHost conn) + { + ISubSystem[] subsystems = null; + Vector v = new Vector(); + + if (subsystemFactoryProxies != null) + { + for (int idx = 0; idx < subsystemFactoryProxies.length; idx++) + { + if (subsystemFactoryProxies[idx].appliesToSystemType(conn.getSystemType()) && subsystemFactoryProxies[idx].isSubSystemFactoryActive()) + { + ISubSystemConfiguration factory = subsystemFactoryProxies[idx].getSubSystemFactory(); + if (factory != null) + { + ISubSystem[] sss = factory.getSubSystems(conn, ISubSystemConfiguration.LAZILY); + if (sss != null) + for (int jdx = 0; jdx < sss.length; jdx++) + v.addElement(sss[jdx]); + } + } + } + //if (v.size() > 0) + //{ + subsystems = new ISubSystem[v.size()]; + for (int idx = 0; idx < v.size(); idx++) + subsystems[idx] = (ISubSystem) v.elementAt(idx); + //} + } + return subsystems; + } + + /** + * Get a list of subsystem objects owned by the subsystem factory identified by + * its given plugin.xml-described id. Array is never null, but may be of length 0. + *

    + * This is a list that of all subsystems for all connections owned by the factory. + */ + public ISubSystem[] getSubSystems(String factoryId) + { + ISubSystemConfiguration factory = getSubSystemConfiguration(factoryId); + if (factory == null) + return (new ISubSystem[0]); + //return factory.getSubSystems(); + return factory.getSubSystems(true); // true ==> force full restore from disk + } + + public ISubSystem[] getServiceSubSystems(Class serviceType, IHost connection) + { + List matches = new ArrayList(); + ISubSystem[] allSS = connection.getSubSystems(); + for (int i = 0; i < allSS.length; i++) + { + ISubSystem ss = allSS[i]; + if (ss instanceof IServiceSubSystem) + { + IServiceSubSystem serviceSubSystem = (IServiceSubSystem)ss; + if (serviceSubSystem.getServiceType() == serviceType) + { + matches.add(ss); + } + } + } + return (ISubSystem[])matches.toArray(new ISubSystem[matches.size()]); + } + + /** + * Get a list of subsystem objects for given connection, owned by the subsystem factory + * identified by its given plugin.xml-described id. Array will never be null but may be length zero. + */ + public ISubSystem[] getSubSystems(String factoryId, IHost connection) + { + ISubSystemConfiguration factory = getSubSystemConfiguration(factoryId); + if (factory == null) + return (new ISubSystem[0]); + return factory.getSubSystems(connection, ISubSystemConfiguration.FORCE_INTO_MEMORY); + } + /** + * Get a list of subsystem objects for given connection, owned by a subsystem factory + * that is of the given category. Array will never be null but may be length zero. + *

    + * This looks for a match on the "category" of the subsystem factory's xml declaration + * in its plugin.xml file. + * + * @see org.eclipse.rse.model.ISubSystemFactoryCategories + */ + public ISubSystem[] getSubSystemsBySubSystemConfigurationCategory(String factoryCategory, IHost connection) + { + ISubSystem[] subsystems = getSubSystems(connection); + if ((subsystems != null) && (subsystems.length > 0)) + { + Vector v = new Vector(); + for (int idx = 0; idx < subsystems.length; idx++) + if (subsystems[idx].getSubSystemConfiguration().getCategory().equals(factoryCategory)) + v.addElement(subsystems[idx]); + ISubSystem[] sss = new ISubSystem[v.size()]; + for (int idx = 0; idx < sss.length; idx++) + sss[idx] = (ISubSystem) v.elementAt(idx); + return sss; + } + else + return (new ISubSystem[0]); + } + + + /** + * Return all subsystem factories. Be careful when you call this, as it activates all + * subsystem factories. + */ + public ISubSystemConfiguration[] getSubSystemConfigurations() + { + Vector v = new Vector(); + ISubSystemConfigurationProxy[] proxies = getSubSystemConfigurationProxies(); + + if (proxies != null) + { + + for (int idx = 0; idx < proxies.length; idx++) + { + v.add(proxies[idx].getSubSystemFactory()); + } + } + return (ISubSystemConfiguration[])v.toArray(new ISubSystemConfiguration[v.size()]); + } + /** + * Return Vector of subsystem factories that apply to a given system connection + */ + protected Vector getSubSystemFactories(IHost conn) + { + Vector factories = new Vector(); + errorLoadingFactory = false; + return getSubSystemFactories(conn, factories); + } + + /** + * Return Vector of subsystem factories that apply to a given system connection, updating given vector + */ + protected Vector getSubSystemFactories(IHost conn, Vector factories) + { + ISubSystem[] subsystems = getSubSystems(conn); + if (subsystems != null) + for (int idx = 0; idx < subsystems.length; idx++) + { + ISubSystemConfiguration ssFactory = subsystems[idx].getSubSystemConfiguration(); + if (ssFactory == null) + errorLoadingFactory = true; + if ((ssFactory != null) && !factories.contains(ssFactory)) + factories.add(ssFactory); + } + return factories; + } + + /** + * Return Vector of subsystem factories that apply to a given system connection array + */ + protected Vector getSubSystemFactories(IHost[] conns) + { + Vector factories = new Vector(); + errorLoadingFactory = false; + if (conns != null) + for (int idx = 0; idx < conns.length; idx++) + { + getSubSystemFactories(conns[idx], factories); + } + return factories; + } + + /** + * Delete a subsystem object. This code finds the factory that owns it and + * delegates the request to that factory. + */ + public boolean deleteSubSystem(ISubSystem subsystem) + { + ISubSystemConfiguration ssFactory = getSubSystemConfiguration(subsystem); + if (ssFactory == null) + return false; + boolean ok = ssFactory.deleteSubSystem(subsystem); + return ok; + } + + // ---------------------------- + // PRIVATE CONNECTION METHODS... + // ---------------------------- + /** + * Return a connection pool given a profile name + */ + private ISystemHostPool getHostPool(String profileName) + { + ISystemProfile profile = getSystemProfileManager().getSystemProfile(profileName); + if (profile == null) + { + return null; + } + return getHostPool(profile); + } + /** + * Return a connection pool given a profile + */ + private ISystemHostPool getHostPool(ISystemProfile profile) + { + lastException = null; + try + { + return SystemHostPool.getSystemHostPool(profile); + } + catch (Exception exc) + { + SystemBasePlugin.logError("Exception in getConnectionPool for " + profile.getName(), exc); + lastException = exc; + } + catch (Throwable t) + { + SystemBasePlugin.logError("Exception in getConnectionPool for " + profile.getName(), t); + } + return null; + } + /** + * Return connection pools for active profiles. One per. + */ + private ISystemHostPool[] getHostPools() + { + ISystemProfile[] profiles = getSystemProfileManager().getActiveSystemProfiles(); + ISystemHostPool[] pools = new ISystemHostPool[profiles.length]; + for (int idx = 0; idx < pools.length; idx++) + { + try + { + pools[idx] = SystemHostPool.getSystemHostPool(profiles[idx]); + } + catch (Exception exc) + { + } + } + return pools; + } + + // ---------------------------- + // PUBLIC CONNECTION METHODS... + // ---------------------------- + + /** + * Return the first connection to localhost we can find. While we always create a default one in + * the user's profile, it is possible that this profile is not active or the connection was deleted. + * However, since any connection to localHost will usually do, we just search all active profiles + * until we find one, and return it.
    + * If no localhost connection is found, this will return null. If one is needed, it can be created + * easily by calling {@link #createLocalHost(ISystemProfile, String, String)}. + */ + public IHost getLocalHost() + { + IHost localConn = null; + IHost[] conns = getHostsBySystemType(ISystemTypes.SYSTEMTYPE_LOCAL); + if (conns != null && conns.length > 0) return conns[0]; + else return localConn; + } + + /** + * Return all connections in all active profiles. Never returns null, but may return a zero-length array. + */ + public IHost[] getHosts() + { + ISystemHostPool[] pools = getHostPools(); + Vector v = new Vector(); + for (int idx = 0; idx < pools.length; idx++) + { + IHost[] conns = getHostsByProfile(getSystemProfileName(pools[idx])); + if (conns != null) + for (int jdx = 0; jdx < conns.length; jdx++) + v.addElement(conns[jdx]); + } + IHost[] allConns = new IHost[v.size()]; + for (int idx = 0; idx < v.size(); idx++) + allConns[idx] = (IHost) v.elementAt(idx); + return allConns; + } + /** + * Return all connections in a given profile. + */ + public IHost[] getHostsByProfile(ISystemProfile profile) + { + ISystemHostPool pool = getHostPool(profile); + return pool.getHosts(); + } + /** + * Return all connections in a given profile name. + */ + public IHost[] getHostsByProfile(String profileName) + { + ISystemHostPool pool = getHostPool(profileName); + if (pool != null) + { + return pool.getHosts(); + } + else + { + return null; + } + } + /** + * Return all connections for which there exists one or more subsystems owned + * by a given subsystem factory. + * @see #getSubSystemConfiguration(String) + */ + public IHost[] getHostsBySubSystemConfiguration(ISubSystemConfiguration factory) + { + /* The following algorithm failed because factory.getSubSystems() only returns + * subsystems that have been restored, which are only those that have been + * expanded. + */ + ISubSystem[] subsystems = factory.getSubSystems(true); // true ==> force full restore + Vector v = new Vector(); + for (int idx = 0; idx < subsystems.length; idx++) + { + IHost conn = subsystems[idx].getHost(); + if (!v.contains(conn)) + v.addElement(conn); + } + IHost[] conns = new IHost[v.size()]; + for (int idx = 0; idx < v.size(); idx++) + { + conns[idx] = (IHost) v.elementAt(idx); + } + return conns; + } + /** + * Return all connections for which there exists one or more subsystems owned + * by a given subsystem factory, identified by factory Id + */ + public IHost[] getHostsBySubSystemConfigurationId(String factoryId) + { + return getHostsBySubSystemConfiguration(getSubSystemConfiguration(factoryId)); + } + /** + * Return all connections for which there exists one or more subsystems owned + * by any child classes of a given subsystem factory category. + *

    + * This looks for a match on the "category" of the subsystem factory's xml declaration + * in its plugin.xml file. Thus, it is effecient as it need not bring to live a + * subsystem factory just to test its parent class type. + * + * @see ISubSystemFactoryCategories + */ + public IHost[] getHostsBySubSystemConfigurationCategory(String factoryCategory) + { + Vector v = new Vector(); + if (subsystemFactoryProxies != null) + { + for (int idx = 0; idx < subsystemFactoryProxies.length; idx++) + { + if (subsystemFactoryProxies[idx].getCategory().equals(factoryCategory)) + { + ISubSystemConfiguration factory = subsystemFactoryProxies[idx].getSubSystemFactory(); + if (factory != null) + { + ISubSystem[] subsystems = factory.getSubSystems(true); // true ==> force full restore + if (subsystems != null) + for (int jdx = 0; jdx < subsystems.length; jdx++) + { + IHost conn = subsystems[jdx].getHost(); + if (!v.contains(conn)) + v.addElement(conn); + } + } + } + } + } + IHost[] conns = new IHost[v.size()]; + for (int idx = 0; idx < v.size(); idx++) + { + conns[idx] = (IHost) v.elementAt(idx); + } + return conns; + } + + /** + * Return all connections for all active profiles, for the given system type. + * Never returns null! + */ + public IHost[] getHostsBySystemType(String systemType) + { + IHost[] connections = getHosts(); + Vector v = new Vector(); + for (int idx = 0; idx < connections.length; idx++) + { + if (connections[idx].getSystemType().equals(systemType)) + v.addElement(connections[idx]); + } + IHost[] conns = new IHost[v.size()]; + for (int idx = 0; idx < v.size(); idx++) + conns[idx] = (IHost) v.elementAt(idx); + return conns; + } + /** + * Return all connections for all active profiles, for the given system types. + * Never returns null! + */ + public IHost[] getHostsBySystemTypes(String[] systemTypes) + { + IHost[] connections = getHosts(); + Vector v = new Vector(); + for (int idx = 0; idx < connections.length; idx++) + { + String systemType = connections[idx].getSystemType(); + boolean match = false; + for (int jdx = 0; !match && (jdx < systemTypes.length); jdx++) + if (systemType.equals(systemTypes[jdx])) + match = true; + if (match) + v.addElement(connections[idx]); + } + IHost[] conns = new IHost[v.size()]; + for (int idx = 0; idx < v.size(); idx++) + conns[idx] = (IHost) v.elementAt(idx); + return conns; + } + + /** + * Return a SystemConnection object given a system profile containing it, + * and an connection name uniquely identifying it. + */ + public IHost getHost(ISystemProfile profile, String connectionName) + { + return getHostPool(profile).getHost(connectionName); + } + /** + * Return the zero-based position of a SystemConnection object within its profile. + */ + public int getHostPosition(IHost conn) + { + ISystemHostPool pool = conn.getHostPool(); + return pool.getHostPosition(conn); + } + /** + * Return the zero-based position of a SystemConnection object within all active profiles. + */ + public int getHostPositionInView(IHost conn) + { + IHost[] conns = getHosts(); + int pos = -1; + for (int idx = 0;(pos == -1) && (idx < conns.length); idx++) + { + if (conns[idx] == conn) + pos = idx; + } + return pos; + } + + /** + * Return the number of SystemConnection objects within the given profile + */ + public int getHostCount(String profileName) + { + return getHostPool(profileName).getHostCount(); + } + /** + * Return the number of SystemConnection objects within the given connection's owning profile + */ + public int getHostCountWithinProfile(IHost conn) + { + return conn.getHostPool().getHostCount(); + } + + /** + * Return the number of SystemConnection objects within all active profiles + */ + public int getHostCount() + { + ISystemHostPool[] pools = getHostPools(); + int total = 0; + for (int idx = 0; idx < pools.length; idx++) + { + total += pools[idx].getHostCount(); + } + return total; + } + + /** + * Return a vector of previously-used connection names in the given named profile. + * @return Vector of String objects. + */ + public Vector getHostAliasNames(String profileName) + { + ISystemHostPool pool = getHostPool(profileName); + Vector names = new Vector(); + IHost[] conns = pool.getHosts(); + for (int idx = 0; idx < conns.length; idx++) + { + names.addElement(conns[idx].getAliasName()); + } + return names; + } + /** + * Return a vector of previously-used connection names in the given profile. + * @return Vector of String objects. + */ + public Vector getHostAliasNames(ISystemProfile profile) + { + return getHostAliasNames(profile.getName()); + } + /** + * Return a vector of previously-used connection names in all active profiles. + */ + public Vector getHostAliasNamesForAllActiveProfiles() + { + ISystemHostPool[] allPools = getHostPools(); + Vector allNames = new Vector(); + for (int idx = 0; idx < allPools.length; idx++) + { + Vector v = getHostAliasNames(getSystemProfileName(allPools[idx])); + for (int jdx = 0; jdx < v.size(); jdx++) + allNames.addElement(v.elementAt(jdx)); + } + return allNames; + } + + /** + * Return array of all previously specified hostnames. + */ + public String[] getHostNames() + { + return getHostNames(null); + } + /** + * Return array of previously specified hostnames for a given system type. + * After careful consideration, it is decided that if the system type is null, + * then no hostnames should be returned. Previously all for all types were returned. + */ + public String[] getHostNames(String systemType) + { + Vector v = new Vector(); + + if (systemType != null) + { + IHost[] conns = getHosts(); + for (int idx = 0; idx < conns.length; idx++) + { + if (!v.contains(conns[idx].getHostName())) + { + if (conns[idx].getSystemType().equals(systemType)) + v.addElement(conns[idx].getHostName()); + } + } + } + if ((systemType != null) && (systemType.equals(ISystemTypes.SYSTEMTYPE_LOCAL) && (v.size() == 0))) + v.addElement("localhost"); + String[] names = new String[v.size()]; + for (int idx = 0; idx < names.length; idx++) + names[idx] = (String) v.elementAt(idx); + return names; + } + + /** + * Returns the clipboard used for copy actions + */ + public Clipboard getSystemClipboard() + { + if (clipboard == null) + { + clipboard = new Clipboard(getShell().getDisplay()); + } + + return clipboard; + } + + /** + * 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) + { + // first extract subsystem id + int connectionDelim = str.indexOf(":"); + int subsystemDelim = str.indexOf(":", connectionDelim + 1); + + String subSystemId = str.substring(0, subsystemDelim); + String srcKey = str.substring(subsystemDelim + 1, str.length()); + + ISystemRegistry registry = SystemPlugin.getTheSystemRegistry(); + 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 = SystemPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_FILE_NOTFOUND); + msg.makeSubstitution(srcKey, subSystem.getHostAliasName()); + return msg; + } + } + else + { + SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_CONNECTION_NOTFOUND); + msg.makeSubstitution(subSystemId); + return msg; + } + } + + public List getSystemClipboardObjects(int srcType) + { + Clipboard clipboard = getSystemClipboard(); + ArrayList srcObjects = new ArrayList(); + Object object = null; + + if (srcType == SystemDNDTransferRunnable.SRC_TYPE_RSE_RESOURCE) + { + + // determine the source objects + object = clipboard.getContents(PluginTransfer.getInstance()); + + if (object instanceof PluginTransferData) + { + // RSE transfer + PluginTransferData data = (PluginTransferData) object; + byte[] result = data.getData(); + + //StringTokenizer tokenizer = new StringTokenizer(new String(result), SystemViewDataDropAdapter.RESOURCE_SEPARATOR); + String[] tokens = (new String(result)).split("\\"+SystemViewDataDropAdapter.RESOURCE_SEPARATOR); + + for (int i = 0;i < tokens.length; i++) + { + String srcStr = tokens[i]; + + Object srcObject = getObjectFor(srcStr); + srcObjects.add(srcObject); + } + } + } + else if (srcType == SystemDNDTransferRunnable.SRC_TYPE_ECLIPSE_RESOURCE) + { + // Resource transfer + ResourceTransfer resTransfer = ResourceTransfer.getInstance(); + object = clipboard.getContents(resTransfer); + if (object != null) + { + IResource[] resourceData = (IResource[]) object; + for (int i = 0; i < resourceData.length; i++) + { + srcObjects.add(resourceData[i]); + } + } + } + + else if (srcType == SystemDNDTransferRunnable.SRC_TYPE_OS_RESOURCE) + { + // Local File transfer + FileTransfer fileTransfer = FileTransfer.getInstance(); + object = clipboard.getContents(fileTransfer); + if (object != null) + { + String[] fileData = (String[]) object; + if (fileData != null) + { + for (int i = 0; i < fileData.length; i++) + { + srcObjects.add(fileData[i]); + } + } + } + } + else if (srcType == SystemDNDTransferRunnable.SRC_TYPE_TEXT) + { + TextTransfer textTransfer = TextTransfer.getInstance(); + object = clipboard.getContents(textTransfer); + if (object != null) + { + String textData = (String) object; + if (textData != null) + { + srcObjects.add(textData); + } + } + } + return srcObjects; + } + + /* + * Returns the remote systems scratchpad root + */ + public SystemScratchpad getSystemScratchPad() + { + if (scratchpad == null) + { + scratchpad = new SystemScratchpad(); + } + return scratchpad; + } + + + /** + * Convenience method to create a local connection, as it often that one is needed + * for access to the local file system. + * @param profile - the profile to create this connection in. If null is passed, we first + * try to find the default private profile and use it, else we take the first active profile. + * @param name - the name to give this profile. Must be unique and non-null. + * @param userId - the user ID to use as the default for the subsystems. Can be null. + */ + public IHost createLocalHost(ISystemProfile profile, String name, String userId) + { + IHost localConn = null; + if (profile == null) + profile = getSystemProfileManager().getDefaultPrivateSystemProfile(); + if (profile == null) + profile = getSystemProfileManager().getActiveSystemProfiles()[0]; + + try + { + localConn = createHost( + profile.getName(), ISystemTypes.SYSTEMTYPE_LOCAL, + name, // connection name + "localhost", // hostname + "", // description + // DY: defect 42101, description cannot be null + // null, // description + userId, // default user Id + ISystemUserIdConstants.USERID_LOCATION_DEFAULT_SYSTEMTYPE, null); + + } + catch (Exception exc) + { + SystemBasePlugin.logError("Error creating local connection", exc); + } + return localConn; + } + + /** + * Create a connection object, given the connection pool and given all the possible attributes. + *

    + * THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU, IN + * THE PROFILE YOU SPECIFY. THE PROFILE IS ALSO SAVED TO DISK. + *

    + * This method: + *

      + *
    • creates and saves a new connection within the given profile + *
    • calls all subsystem factories to give them a chance to create a subsystem instance + *
    • fires an ISystemResourceChangeEvent event of type EVENT_ADD to all registered listeners + *
    + *

    + * @param profileName Name of the system profile the connection is to be added to. + * @param systemType system type matching one of the system type names defined via the + * systemtype extension point. + * @param connectionName unique connection name. + * @param hostName ip name of host. + * @param description optional description of the connection. Can be null. + * @param defaultUserId userId to use as the default for the subsystems. + * @param defaultUserIdLocation one of the constants in {@link org.eclipse.rse.core.ISystemUserIdConstants ISystemUserIdConstants} + * that tells us where to set the user Id + * @param newConnectionWizardPages when called from the New Connection wizard this is union of the list of additional + * wizard pages supplied by the subsystem factories that pertain to the specified system type. Else null. + * @return SystemConnection object, or null if it failed to create. This is typically + * because the connectionName is not unique. Call getLastException() if necessary. + */ + public IHost createHost( + String profileName, + String systemType, + String connectionName, + String hostName, + String description, + String defaultUserId, + int defaultUserIdLocation, + ISystemNewConnectionWizardPage[] newConnectionWizardPages) + throws Exception + { + lastException = null; + ISystemHostPool pool = getHostPool(profileName); + IHost conn = null; + boolean promptable = false; // systemType.equals(ISystemTypes.SYSTEMTYPE_PROMPT); + try + { + // create, register and save new connection... + if ((defaultUserId != null) && (defaultUserId.length() == 0)) + defaultUserId = null; + conn = pool.createHost(systemType, connectionName, hostName, description, defaultUserId, defaultUserIdLocation); + if (promptable) + conn.setPromptable(true); + } + catch (Exception exc) + { + lastException = exc; + SystemBasePlugin.logError("Exception in createConnection for " + connectionName, exc); + throw exc; + } + if ((lastException == null) && !promptable) + { + // only 1 factory used per service type + ISubSystemConfiguration[] factories = getSubSystemConfigurationsBySystemType(systemType, true); + ISubSystem subSystems[] = new ISubSystem[factories.length]; + for (int idx = 0; idx < factories.length; idx++) + { + subSystems[idx] = factories[idx].createSubSystem(conn, true, getApplicableWizardPages(factories[idx], newConnectionWizardPages)); // give it the opportunity to create a subsystem + } + + + //int eventType = ISystemResourceChangeEvent.EVENT_ADD; + int eventType = ISystemResourceChangeEvents.EVENT_ADD_RELATIVE; + SystemResourceChangeEvent event = new SystemResourceChangeEvent(conn, eventType, this); + //event.setPosition(pool.getConnectionPosition(conn)); + //event.setPosition(getConnectionPositionInView(conn)); + event.setRelativePrevious(getPreviousHost(conn)); + fireEvent(event); + fireModelChangeEvent(SYSTEM_RESOURCE_ADDED, SYSTEM_RESOURCETYPE_CONNECTION, conn, null); + + for (int s = 0; s < subSystems.length; s++) + { + ISubSystem ss = subSystems[s]; + fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_ADDED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_SUBSYSTEM, ss, null); + } + + + } + SystemPreferencesManager.getPreferencesManager().setConnectionNamesOrder(); // update preferences order list + return conn; + } + private ISystemNewConnectionWizardPage[] getApplicableWizardPages(ISubSystemConfiguration ssf, ISystemNewConnectionWizardPage[] allPages) + { + if ((allPages == null) || (allPages.length == 0)) + return null; + int count = 0; + for (int idx = 0; idx < allPages.length; idx++) + if (allPages[idx].getSubSystemFactory() == ssf) + ++count; + if (count == 0) + return null; + ISystemNewConnectionWizardPage[] subPages = new ISystemNewConnectionWizardPage[count]; + count = 0; + for (int idx = 0; idx < allPages.length; idx++) + if (allPages[idx].getSubSystemFactory() == ssf) + subPages[count++] = allPages[idx]; + return subPages; + } + /** + * Create a connection object. This is a simplified version + *

    + * THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU, IN + * THE PROFILE YOU SPECIFY. THE PROFILE IS ALSO SAVED TO DISK. + *

    + * This method: + *

      + *
    • creates and saves a new connection within the given profile + *
    • calls all subsystem factories to give them a chance to create a subsystem instance + *
    • fires an ISystemResourceChangeEvent event of type EVENT_ADD to all registered listeners + *
    + *

    + * @param profileName Name of the system profile the connection is to be added to. + * @param systemType system type matching one of the system type names defined via the + * systemtype extension point. + * @param connectionName unique connection name. + * @param hostName ip name of host. + * @param description optional description of the connection. Can be null. + * @return SystemConnection object, or null if it failed to create. This is typically + * because the connectionName is not unique. Call getLastException() if necessary. + */ + public IHost createHost(String profileName, String systemType, String connectionName, String hostName, String description) + throws Exception + { + return createHost(profileName, systemType, connectionName, hostName, description, null, ISystemUserIdConstants.USERID_LOCATION_CONNECTION, null); + } + /** + * Create a connection object. This is a very simplified version that defaults to the user's + * private profile, or the first active profile if there is no private profile. + *

    + * THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU, IN + * THE DEFAULT PRIVATE PROFILE, WHICH IS SAVED TO DISK. + *

    + * This method: + *

      + *
    • creates and saves a new connection within the given profile + *
    • calls all subsystem factories to give them a chance to create a subsystem instance + *
    • fires an ISystemResourceChangeEvent event of type EVENT_ADD to all registered listeners + *
    + *

    + * @param systemType system type matching one of the system type names defined via the + * systemtype extension point. + * @param connectionName unique connection name. + * @param hostName ip name of host. + * @param description optional description of the connection. Can be null. + * @return SystemConnection object, or null if it failed to create. This is typically + * because the connectionName is not unique. Call getLastException() if necessary. + */ + public IHost createHost(String systemType, String connectionName, String hostName, String description) + throws Exception + { + ISystemProfile profile = getSystemProfileManager().getDefaultPrivateSystemProfile(); + if (profile == null) + profile = getSystemProfileManager().getActiveSystemProfiles()[0]; + return createHost(profile.getName(), systemType, connectionName, hostName, description, null, ISystemUserIdConstants.USERID_LOCATION_CONNECTION, null); + } + /** + * Return the previous connection as would be shown in the view + */ + protected IHost getPreviousHost(IHost conn) + { + IHost prevConn = null; + ISystemHostPool pool = conn.getHostPool(); + int pos = pool.getHostPosition(conn); + if (pos > 0) + prevConn = pool.getHost(pos - 1); + else + { + IHost allConns[] = getHosts(); + if (allConns != null) + { + pos = getHostPositionInView(conn); + if (pos > 0) + prevConn = allConns[pos - 1]; + } + } + return prevConn; + } + /** + * Update an existing connection given the new information. + * This method: + *

      + *
    • calls the setXXX methods on the given connection object, updating the information in it. + *
    • save the connection's connection pool to disk + *
    • fires an ISystemResourceChangeEvent event of type EVENT_CHANGE to all registered listeners + *
    • if the systemtype or hostname is changed, calls disconnect on each associated subsystem. + * We must do this because a hostname changes fundamentally affects the connection, + * rendering any information currently displayed under + * that connection obsolete. That is, the user will have to reconnect. + *
    + *

    + * @param conn SystemConnection to be updated + * @param systemType system type matching one of the system type names defined via the + * systemtype extension point. + * @param connectionName unique connection name. + * @param hostName ip name of host. + * @param description optional description of the connection. Can be null. + * @param defaultUserId userId to use as the default for the subsystems. + * @param defaultUserIdLocation one of the constants in {@link org.eclipse.rse.core.ISystemUserIdConstants ISystemUserIdConstants} + * that tells us where to set the user Id + */ + public void updateHost(Shell shell, IHost conn, String systemType, String connectionName, String hostName, String description, String defaultUserId, int defaultUserIdLocation) + { + lastException = null; + String orgUserId = conn.getDefaultUserId(); + boolean connectionNameChanged = !connectionName.equalsIgnoreCase(conn.getAliasName()); + boolean hostNameChanged = !hostName.equalsIgnoreCase(conn.getHostName()); + String orgDefaultUserId = conn.getDefaultUserId(); + boolean defaultUserIdChanged = false; + if ((defaultUserId == null) || (orgDefaultUserId == null)) + { + if (orgDefaultUserId != defaultUserId) + defaultUserIdChanged = true; + } + else + defaultUserIdChanged = !conn.compareUserIds(defaultUserId, orgDefaultUserId); // d43219 + //!defaultUserId.equalsIgnoreCase(orgDefaultUserId); + + try + { + if (connectionNameChanged) + renameHost(conn, connectionName); + conn.getHostPool().updateHost(conn, systemType, connectionName, hostName, description, defaultUserId, defaultUserIdLocation); + } + catch (SystemMessageException exc) + { + SystemBasePlugin.logError("Exception in updateConnection for " + connectionName, exc); + lastException = exc; + return; + } + catch (Exception exc) + { + SystemBasePlugin.logError("Exception in updateConnection for " + connectionName, exc); + lastException = exc; + return; + } + boolean skipUpdate = (defaultUserIdChanged && !hostNameChanged && !connectionNameChanged); + if (!skipUpdate) fireEvent(new org.eclipse.rse.model.SystemResourceChangeEvent( + //conn,ISystemResourceChangeEvent.EVENT_CHANGE,this)); + conn, ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE, this)); // only update simple property sheet values here + if (!skipUpdate) fireModelChangeEvent(SYSTEM_RESOURCE_CHANGED, SYSTEM_RESOURCETYPE_CONNECTION, conn, null); + + if (hostNameChanged || defaultUserIdChanged) + { + ISubSystem[] subsystems = getSubSystems(conn); // get list of related subsystems + for (int idx = 0; idx < subsystems.length; idx++) + { + if (hostNameChanged || (subsystems[idx].getLocalUserId() == null)) + { + try + { + if (subsystems[idx].isConnected()) subsystems[idx].disconnect(shell); // MJB: added conditional for defect 45754 + if (defaultUserIdChanged) + { + subsystems[idx].getConnectorService().clearUserIdCache(); + } + subsystems[idx].getConnectorService().clearPasswordCache(); + } + catch (Exception exc) + { + } // msg already shown + } + } + } + } + + /** + * Update the workoffline attribute for a connection. + * + * @param conn SystemConnection to change + * @param offline true if connection should be set offline, false if it should be set online + */ + public void setHostOffline(IHost conn, boolean offline) + { + if (conn.isOffline() != offline) + { + conn.setOffline(offline); + saveHost(conn); + fireEvent(new SystemResourceChangeEvent(conn, ISystemResourceChangeEvents.EVENT_PROPERTYSHEET_UPDATE, null)); + } + } + + /** + * Delete an existing connection. + *

    + * Lots to do here: + *

      + *
    • Delete all subsystem objects for this connection, including their file's on disk. + *
    • Delete this connection's private filter pool, if exists + *
    • Delete the connection from memory. + *
    • Delete the connection's folder from disk. + *
    + * Assumption: firing the delete event is done elsewhere. Specifically, the doDelete method of SystemView. + */ + public void deleteHost(IHost conn) + { + Vector affectedSubSystemFactories = getSubSystemFactories(conn); + for (int idx = 0; idx < affectedSubSystemFactories.size(); idx++) + { + ((ISubSystemConfiguration) affectedSubSystemFactories.elementAt(idx)).deleteSubSystemsByConnection(conn); + } + conn.getHostPool().deleteHost(conn); // delete from memory and from disk. + SystemPreferencesManager.getPreferencesManager().setConnectionNamesOrder(); // update preferences order list + fireModelChangeEvent(SYSTEM_RESOURCE_REMOVED, SYSTEM_RESOURCETYPE_CONNECTION, conn, null); + } + + /** + * Renames an existing connection. + *

    + * Lots to do here: + *

      + *
    • Reset the conn name for all subsystem objects for this connection + *
    • Rename the connection in memory. + *
    • Rename the connection's folder on disk. + *
    + * Assumption: firing the rename event is done elsewhere. Specifically, the doRename method of SystemView. + */ + public void renameHost(IHost conn, String newName) throws Exception + { + // first, pre-test for folder-in-use error: + + // it looks good, so proceed... + String oldName = conn.getAliasName(); + Vector affectedSubSystemFactories = getSubSystemFactories(conn); + for (int idx = 0; idx < affectedSubSystemFactories.size(); idx++) + ((ISubSystemConfiguration) affectedSubSystemFactories.elementAt(idx)).renameSubSystemsByConnection(conn, newName); + conn.getHostPool().renameHost(conn, newName); // rename in memory and disk + SystemPreferencesManager.getPreferencesManager().setConnectionNamesOrder(); // update preferences order list + fireModelChangeEvent(SYSTEM_RESOURCE_RENAMED, SYSTEM_RESOURCETYPE_CONNECTION, conn, oldName); + } + + /** + * Move existing connections a given number of positions in the same profile. + * 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.

    + *

      + *
    • After the move, the pool containing the moved connection is saved to disk. + *
    • The connection's connection name must be unique in pool. + *
    • Fires a single ISystemResourceChangeEvent event of type EVENT_MOVE, if the pool is the private pool. + *
    + * TODO PROBLEM: CAN'T RE-ORDER FOLDERS SO CAN WE SUPPORT THIS ACTION? + * @param conns Array of SystemConnections to move. + * @param newPosition new zero-based position for the connection + */ + public void moveHosts(String profileName, IHost conns[], int delta) + { + ISystemHostPool pool = getHostPool(profileName); + pool.moveHosts(conns, delta); + SystemPreferencesManager.getPreferencesManager().setConnectionNamesOrder(); + //fireEvent(new SystemResourceChangeEvent(pool.getSystemConnections(),ISystemResourceChangeEvent.EVENT_MOVE_MANY,this)); + SystemResourceChangeEvent event = new SystemResourceChangeEvent(conns, ISystemResourceChangeEvents.EVENT_MOVE_MANY, this); + event.setPosition(delta); + fireEvent(event); + // fire new model change event, which BPs might listen for... + for (int idx=0; idx 0)) + { + for (int jdx = 0; jdx < subsystems.length; jdx++) + { + msg += ": subsystem " + subsystems[jdx].getName(); + //monitor.subTask(msg); + SystemBasePlugin.logDebugMessage(this.getClass().getName(), msg); + factory = subsystems[jdx].getSubSystemConfiguration(); + factory.cloneSubSystem(subsystems[jdx], newConn, false); // false=>copy connection op vs copy profile op + //try { java.lang.Thread.sleep(3000l); } catch (InterruptedException e) {} + } + } + //monitor.worked(1); + } + catch (Exception exc) + { + failed = true; + lastExc = exc; + } + // if anything failed, we have to back out what worked. Ouch! + if (failed) + { + try + { + if (newConn != null) + deleteHost(newConn); + } + catch (Exception exc) + { + SystemBasePlugin.logError("Exception (ignored) cleaning up from copy-connection exception.", exc); + } + throw (lastExc); + } + SystemBasePlugin.logDebugMessage(this.getClass().getName(), "Copy of system connection " + oldName + " to " + newName + " successful"); + if (getSystemProfileManager().isSystemProfileActive(targetProfile.getName())) + { + int eventType = ISystemResourceChangeEvents.EVENT_ADD_RELATIVE; + SystemResourceChangeEvent event = new SystemResourceChangeEvent(newConn, eventType, this); + event.setRelativePrevious(getPreviousHost(newConn)); + //SystemResourceChangeEvent event = new SystemResourceChangeEvent(newConn,ISystemResourceChangeEvent.EVENT_ADD,this); + //event.setPosition(getConnectionPositionInView(newConn)); + fireEvent(event); + } + fireModelChangeEvent(SYSTEM_RESOURCE_ADDED, SYSTEM_RESOURCETYPE_CONNECTION, newConn, null); + return newConn; + } + + /** + * Move a SystemConnection to another profile. All subsystems are moved, and all connection data is moved. + * This is actually accomplished by doing a copy operation first, and if successful deleting the original. + * @param monitor Progress monitor to reflect each step of the operation + * @param conn The connection to move + * @param targetProfile What profile to move into + * @param newName Unique name to give copied profile. Typically this is the same as the original name, but + * will be different on name collisions + * @return new SystemConnection object + */ + public IHost moveHost(IProgressMonitor monitor, IHost conn, ISystemProfile targetProfile, String newName) throws Exception + { + IHost newConn = null; + try + { + newConn = copyHost(monitor, conn, targetProfile, newName); + if (newConn != null) + { + deleteHost(conn); // delete old connection now that new one created successfully + SystemBasePlugin.logDebugMessage(this.getClass().getName(), "Move of system connection " + conn.getAliasName() + " to profile " + targetProfile.getName() + " successful"); + fireEvent(new SystemResourceChangeEvent(conn, ISystemResourceChangeEvents.EVENT_DELETE, this)); + } + } + catch (Exception exc) + { + //SystemPlugin.logError("Exception moving system connection " + conn.getAliasName() + " to profile " + targetProfile.getName(), exc); + throw exc; + } + return newConn; + } + + /** + * Return true if any of the subsystems for the given connection are currently connected + */ + public boolean isAnySubSystemConnected(IHost conn) + { + boolean any = false; + ISubSystem[] subsystems = getSubSystemsLazily(conn); + if (subsystems == null) + return false; + for (int idx = 0; !any && (idx < subsystems.length); idx++) + { + ISubSystem ss = subsystems[idx]; + if (ss.isConnected()) + any = true; + } + return any; + } + + /** + * Return true if all of the subsystems for the given connection are currently connected + */ + public boolean areAllSubSystemsConnected(IHost conn) + { + boolean all = true; + ISubSystem[] subsystems = getSubSystemsLazily(conn); + if (subsystems == null) + return false; + + for (int idx = 0; all && (idx < subsystems.length); idx++) + { + ISubSystem ss = subsystems[idx]; + if (!ss.isConnected()) + { + return false; + } + } + return all; + } + /** + * Disconnect all subsystems for the given connection, if they are currently connected. + */ + public void disconnectAllSubSystems(IHost conn) + { + // FIXME - save profile + save(); + + ISubSystem[] subsystems = getSubSystemsLazily(conn); + if (subsystems == null) + return; + + // dy: defect 47281, user repeaetedly prompted to disconnect if there is an open file + // and they keep hitting cancel. + boolean cancelled = false; + for (int idx = 0; idx < subsystems.length && !cancelled; idx++) + { + ISubSystem ss = subsystems[idx]; + if (ss.isConnected()) + { + try + { + //ss.getConnectorService().disconnect(); defect 40675 + Shell shell = null; + if (Display.getCurrent() != null) + shell = Display.getCurrent().getActiveShell(); + ss.disconnect(shell); + } + catch (InterruptedException exc) + { + System.out.println("Cacnelled"); + cancelled = true; + } + catch (Exception exc) + { + } + } + } + } + + /** + * Inform the world when the connection status changes for a subsystem within a connection. + * Update properties for the subsystem and its connection + */ + public void connectedStatusChange(ISubSystem subsystem, boolean connected, boolean wasConnected) + { + connectedStatusChange(subsystem, connected, wasConnected, true); + } + + /** + * Inform the world when the connection status changes for a subsystem within a connection. + * Update properties for the subsystem and its connection + */ + public void connectedStatusChange(ISubSystem subsystem, boolean connected, boolean wasConnected, boolean collapseTree) + { + //System.out.println("INSIDE CONNECTEDSTATUSCHANGE: "+connected+" vs "+wasConnected); + IHost conn = subsystem.getHost(); + //int eventId = ISystemResourceChangeEvent.EVENT_CHANGE; + //int eventId = ISystemResourceChangeEvent.EVENT_PROPERTY_CHANGE; + if (connected != wasConnected) + { + int eventId = ISystemResourceChangeEvents.EVENT_ICON_CHANGE; + fireEvent(new SystemResourceChangeEvent(conn, eventId, this)); + + SystemResourceChangeEvent event = new SystemResourceChangeEvent(subsystem, eventId, conn); + fireEvent(event); + + // DKM + // fire for each subsystem + ISubSystem[] sses = getSubSystems(conn); + for (int i = 0; i < sses.length; i++) + { + ISubSystem ss = sses[i]; + if (ss != subsystem) + { + SystemResourceChangeEvent sevent = new SystemResourceChangeEvent(ss, eventId, conn); + fireEvent(sevent); + + sevent.setType(ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE); // update vrm + fireEvent(sevent); + } + } + + + // DY: Conditioning of property change event type has been removed so + // that the connected property is updated on a disconnect. + //if (connected) + event.setType(ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE); // update vrm + + fireEvent(event); + } + if (!connected && wasConnected && collapseTree) + { + invalidateFiltersFor(subsystem); + fireEvent(new SystemResourceChangeEvent(subsystem, ISystemResourceChangeEvents.EVENT_MUST_COLLAPSE, this)); + + ISubSystem[] sses = getSubSystems(conn); + for (int i = 0; i < sses.length; i++) + { + ISubSystem ss = sses[i]; + if (ss != subsystem && !ss.isConnected()) + { + invalidateFiltersFor(ss); + SystemResourceChangeEvent sevent = new SystemResourceChangeEvent(ss, ISystemResourceChangeEvents.EVENT_MUST_COLLAPSE, conn); + fireEvent(sevent); + } + } + } + } + + // ---------------------------- + // RESOURCE EVENT METHODS... + // ---------------------------- + + /** + * Register your interest in being told when a system resource such as a connection is changed. + */ + public void addSystemResourceChangeListener(ISystemResourceChangeListener l) + { + listenerManager.addSystemResourceChangeListener(l); + listenerCount++; + } + /** + * De-Register your interest in being told when a system resource such as a connection is changed. + */ + public void removeSystemResourceChangeListener(ISystemResourceChangeListener l) + { + listenerManager.removeSystemResourceChangeListener(l); + listenerCount--; + } + /** + * Query if the ISystemResourceChangeListener is already listening for SystemResourceChange events + */ + public boolean isRegisteredSystemResourceChangeListener(ISystemResourceChangeListener l) + { + return listenerManager.isRegisteredSystemResourceChangeListener(l); + } + /** + * Notify all listeners of a change to a system resource such as a connection. + * You would not normally call this as the methods in this class call it when appropriate. + */ + public void fireEvent(ISystemResourceChangeEvent event) + { + Object src = event.getSource(); + if (src instanceof ISystemFilter) + { + ISystemBaseReferencingObject[] references = ((ISystemFilter)src).getReferencingObjects(); + for (int i = 0; i < references.length; i++) + { + ISystemBaseReferencingObject ref = references[i]; + if (ref instanceof ISystemContainer) + { + ((ISystemContainer)ref).markStale(true); + } + } + + } + listenerManager.notify(event); + } + /** + * Notify a specific listener of a change to a system resource such as a connection. + */ + public void fireEvent(ISystemResourceChangeListener l, ISystemResourceChangeEvent event) + { + l.systemResourceChanged(event); + } + /** + * Notify all listeners of a change to a system resource such as a connection. + * You would not normally call this as the methods in this class call it when appropriate. + *

    + * This version calls fireEvent at the next reasonable opportunity, leveraging SWT's + * Display.asyncExec() method. + */ + public void postEvent(ISystemResourceChangeEvent event) + { + listenerManager.postNotify(event); + } + /** + * Notify a specific listener of a change to a system resource such as a connection. + *

    + * This version calls fireEvent at the next reasonable opportunity, leveraging SWT's + * Display.asyncExec() method. + */ + public void postEvent(ISystemResourceChangeListener listener, ISystemResourceChangeEvent event) + { + SystemPostableEventNotifier runnable = new SystemPostableEventNotifier(listener, event); + } + + // ---------------------------- + // MODEL RESOURCE EVENT METHODS... + // ---------------------------- + + /** + * Register your interest in being told when an RSE model resource is changed. + * These are model events, not GUI-optimized events. + */ + public void addSystemModelChangeListener(ISystemModelChangeListener l) + { + modelListenerManager.addSystemModelChangeListener(l); + modelListenerCount++; + } + /** + * De-Register your interest in being told when an RSE model resource is changed. + */ + public void removeSystemModelChangeListener(ISystemModelChangeListener l) + { + modelListenerManager.removeSystemModelChangeListener(l); + modelListenerCount--; + } + /** + * Notify all listeners of a change to a system model resource such as a connection. + * You would not normally call this as the methods in this class call it when appropriate. + */ + public void fireEvent(ISystemModelChangeEvent event) + { + modelListenerManager.notify(event); + } + /** + * Notify all listeners of a change to a system model resource such as a connection. + * This one takes the information needed and creates the event for you. + */ + public void fireModelChangeEvent(int eventType, int resourceType, Object resource, String oldName) + { + if (modelEvent == null) + modelEvent = new SystemModelChangeEvent(); + modelEvent.setEventType(eventType); + modelEvent.setResourceType(resourceType); + modelEvent.setResource(resource); + modelEvent.setOldName(oldName); + modelListenerManager.notify(modelEvent); + } + /** + * Notify a specific listener of a change to a system model resource such as a connection. + */ + public void fireEvent(ISystemModelChangeListener l, ISystemModelChangeEvent event) + { + l.systemModelResourceChanged(event); + } + + // -------------------------------- + // REMOTE RESOURCE EVENT METHODS... + // -------------------------------- + + /** + * Register your interest in being told when a remote resource is changed. + * These are model events, not GUI-optimized events. + */ + public void addSystemRemoteChangeListener(ISystemRemoteChangeListener l) + { + remoteListManager.addSystemRemoteChangeListener(l); + remoteListCount++; + } + /** + * De-Register your interest in being told when a remote resource is changed. + */ + public void removeSystemRemoteChangeListener(ISystemRemoteChangeListener l) + { + remoteListManager.removeSystemRemoteChangeListener(l); + remoteListCount--; + } + /** + * Notify all listeners of a change to a remote resource such as a file. + * You would not normally call this as the methods in this class call it when appropriate. + */ + public void fireEvent(ISystemRemoteChangeEvent event) + { + remoteListManager.notify(event); + } + /** + * Notify all listeners of a change to a remote resource such as a file. + * This one takes the information needed and creates the event for you. + * @param eventType - one of the constants from {@link org.eclipse.rse.model.ISystemRemoteChangeEvents} + * @param resource - the remote resource object, or absolute name of the resource as would be given by calling getAbsoluteName on its remote adapter + * @param resourceParent - the remote resource's parent object, or absolute name, if that is known. If it is non-null, this will aid in refreshing occurences of that parent. + * @param subsystem - the subsystem which contains this remote resource. This allows the search for impacts to be + * limited to subsystems of the same parent factory, and to connections with the same hostname as the subsystem's connection. + * @param oldName - on a rename operation, this is the absolute name of the resource prior to the rename + * @param originatingViewer - optional. If set, this gives the viewer a clue that it should select the affected resource after refreshing its parent. + * This saves sending a separate event to reveal and select the new created resource on a create event, for example. + */ + public void fireRemoteResourceChangeEvent(int eventType, Object resource, Object resourceParent, ISubSystem subsystem, String oldName, Viewer originatingViewer) + { + if (resourceParent instanceof ISystemContainer) + { + ((ISystemContainer)resourceParent).markStale(true); + } + // mark stale any filters that reference this object + invalidateFiltersFor(resourceParent, subsystem); + + if (remoteEvent == null) + remoteEvent = new SystemRemoteChangeEvent(); + remoteEvent.setEventType(eventType); + remoteEvent.setResource(resource); + remoteEvent.setResourceParent(resourceParent); + remoteEvent.setOldName(oldName); + remoteEvent.setSubSystem(subsystem); + remoteEvent.setOriginatingViewer(originatingViewer); + remoteListManager.notify(remoteEvent); + } + + /** + * 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); + } + + private String getRemoteResourceAbsoluteName(Object remoteResource) + { + if (remoteResource == null) + return null; + String remoteResourceName = null; + if (remoteResource instanceof String) + remoteResourceName = (String)remoteResource; + else + { + ISystemRemoteElementAdapter ra = getRemoteAdapter(remoteResource); + if (ra == null) + return null; + remoteResourceName = ra.getAbsoluteName(remoteResource); + } + return remoteResourceName; + } + + private List findFilterReferencesFor(ISubSystem subsystem) + { + List results = new ArrayList(); + if (subsystem != null) + { + ISystemFilterPoolReferenceManager refmgr = subsystem.getFilterPoolReferenceManager(); + if (refmgr != null) + { + ISystemFilterReference[] refs = refmgr.getSystemFilterReferences(subsystem); + for (int i = 0; i < refs.length; i++) + { + ISystemFilterReference filterRef = refs[i]; + + if (!filterRef.isStale() && filterRef.hasContents(SystemChildrenContentsType.getInstance())) + { + results.add(filterRef); + } + } + + } + } + return results; + + } + + public List findFilterReferencesFor(Object resource, ISubSystem subsystem) + { + String elementName = getRemoteResourceAbsoluteName(resource); + List results = new ArrayList(); + if (subsystem != null && elementName != null) + { + ISystemFilterReference[] refs = subsystem.getFilterPoolReferenceManager().getSystemFilterReferences(subsystem); + for (int i = 0; i < refs.length; i++) + { + ISystemFilterReference filterRef = refs[i]; + + if (!filterRef.isStale() && filterRef.hasContents(SystemChildrenContentsType.getInstance())) + { + // #1 + if (subsystem.doesFilterMatch(filterRef.getReferencedFilter(), elementName)) + { + results.add(filterRef); // found a match! + + } + // #2 + else if (subsystem.doesFilterListContentsOf(filterRef.getReferencedFilter(),elementName)) + { + results.add(filterRef); // found a match! + } + } + } + + + } + return results; + + } + + public void invalidateFiltersFor(ISubSystem subsystem) + { + if (subsystem != null) + { + + List results = findFilterReferencesFor(subsystem); + for (int i = 0; i < results.size(); i++) + { + ((ISystemFilterReference)results.get(i)).markStale(true); + } + } + } + + public void invalidateFiltersFor(Object resourceParent, ISubSystem subsystem) + { + if (subsystem != null) + { + + List results = findFilterReferencesFor(resourceParent, subsystem); + for (int i = 0; i < results.size(); i++) + { + ((ISystemFilterReference)results.get(i)).markStale(true); + } + } + } + + /** + * Notify a specific listener of a change to a remote resource such as a file. + */ + public void fireEvent(ISystemRemoteChangeListener l, ISystemRemoteChangeEvent event) + { + l.systemRemoteResourceChanged(event); + } + + // ---------------------------- + // PREFERENCE EVENT METHODS... + // ---------------------------- + + /** + * Register your interest in being told when a system preference changes + */ + public void addSystemPreferenceChangeListener(ISystemPreferenceChangeListener l) + { + preferenceListManager.addSystemPreferenceChangeListener(l); + } + /** + * De-Register your interest in being told when a system preference changes + */ + public void removeSystemPreferenceChangeListener(ISystemPreferenceChangeListener l) + { + preferenceListManager.removeSystemPreferenceChangeListener(l); + } + /** + * Notify all listeners of a change to a system preference + * You would not normally call this as the methods in this class call it when appropriate. + */ + public void fireEvent(ISystemPreferenceChangeEvent event) + { + preferenceListManager.notify(event); + } + /** + * Notify a specific listener of a change to a system preference + */ + public void fireEvent(ISystemPreferenceChangeListener l, ISystemPreferenceChangeEvent event) + { + l.systemPreferenceChanged(event); + } + + // ---------------------------- + // MISCELLANEOUS METHODS... + // ---------------------------- + + /** + * Load everything into memory. Needed for pervasive operations like rename and copy + */ + public void loadAll() + { + // step 0_a: force every subsystem factory to be active + ISubSystemConfigurationProxy[] proxies = getSubSystemConfigurationProxies(); + if (proxies != null) + { + for (int idx = 0; idx < proxies.length; idx++) + proxies[idx].getSubSystemFactory(); + } + + // step 0_b: force every subsystem of every connection to be active! + IHost[] connections = getHosts(); + for (int idx = 0; idx < connections.length; idx++) + getSubSystems(connections[idx]); + } + + /** + * Return last exception object caught in any method, or null if no exception. + * This has the side effect of clearing the last exception. + */ + public Exception getLastException() + { + Exception last = lastException; + lastException = null; + return last; + } + + // ---------------------------- + // SAVE / RESTORE METHODS... + // ---------------------------- + + /** + * Save everything! + */ + public boolean save() + { + ISystemProfileManager profileManager = getSystemProfileManager(); + return SystemPlugin.getThePersistenceManager().commit(profileManager); + } + + /** + * Save specific connection pool + * @return true if saved ok, false if error encountered. If false, call getLastException(). + */ + public boolean saveHostPool(ISystemHostPool pool) + { + return SystemPlugin.getThePersistenceManager().commit(pool); + } + + /** + * Save specific connection + * @return true if saved ok, false if error encountered. If false, call getLastException(). + */ + public boolean saveHost(IHost conn) + { + return SystemPlugin.getThePersistenceManager().commit(conn); + } + + /** + * Restore all connections within active profiles + * @return true if restored ok, false if error encountered. If false, call getLastException(). + */ + public boolean restore() + { + boolean ok = true; + lastException = null; + /* + SystemProfileManager profileManager = SystemStartHere.getSystemProfileManager(); + + SystemHostPool pool = null; + SystemPreferencesManager prefmgr = SystemPreferencesManager.getPreferencesManager(); + if (!SystemPlugin.getThePersistenceManager().restore(profileManager)) + { + SystemProfile[] profiles = profileManager.getActiveSystemProfiles(); + for (int idx = 0; idx < profiles.length; idx++) + { + try + { + pool = SystemHostPoolImpl.getSystemConnectionPool(profiles[idx]); + Host[] conns = pool.getHosts(); + pool.orderHosts(prefmgr.getConnectionNamesOrder(conns, pool.getName())); + } + catch (Exception exc) + { + lastException = exc; + SystemPlugin.logError("Exception in restore for connection pool " + profiles[idx].getName(), exc); + } + } + } + */ + return ok; + } + public boolean contains(ISchedulingRule rule) + { + return rule == this; + } + public boolean isConflicting(ISchedulingRule rule) + { + return rule == this; + } +}//SystemRegistryImpl \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemRemoteChangeEventManager.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemRemoteChangeEventManager.java new file mode 100644 index 00000000000..a9cc1a718f6 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemRemoteChangeEventManager.java @@ -0,0 +1,70 @@ +/******************************************************************************** + * 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.internal.model; +import java.util.Vector; + +import org.eclipse.rse.model.ISystemRemoteChangeEvent; +import org.eclipse.rse.model.ISystemRemoteChangeListener; + + +/** + * Manages the list of registered remote resource change listeners. + */ +public class SystemRemoteChangeEventManager +{ + private Vector listeners = new Vector(); + + /** + * Constructor + */ + public SystemRemoteChangeEventManager() + { + } + + /** + * Add a listener to list of listeners. If this object is already in + * the list, this does nothing. + */ + public void addSystemRemoteChangeListener(ISystemRemoteChangeListener l) + { + if (!listeners.contains(l)) + listeners.addElement(l); + } + + /** + * Remove a listener to list of listeners. If this object is not in + * the list, this does nothing. + */ + public void removeSystemRemoteChangeListener(ISystemRemoteChangeListener l) + { + if (listeners.contains(l)) + listeners.removeElement(l); + } + + /** + * Notify all registered listeners of the given event + */ + public void notify(ISystemRemoteChangeEvent event) + { + for (int idx=0; idx + * Note: Any task that reuses the monitor must be a proper subtask of the parent + * task. i.e The subtask must start after the parent task and stop before the parent + * task. + */ +public class SystemRunnableContextWrapper implements IRunnableContext { + + // Inner class for running the first runable, used for grabbing the progress monitor during + // execution of the first runnable context. + private class SystemRunnableWithProgress implements IRunnableWithProgress + { + private IRunnableWithProgress _runnable; + private IProgressMonitor monitor; + + /** + * Constructor + */ + private SystemRunnableWithProgress(IRunnableWithProgress runnable) + { + _runnable = runnable; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor) + */ + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException + { + // invoked through an IRunnableContext so we need to grab the progress monitor and forward the request + // store the monitor + this.monitor = monitor; + + // start executing the real runnable + _runnable.run(monitor); + } + + } // end of class SystemRunnableWithProgress + + // Inner class for running second instance + private class InternalRunnable implements Runnable + { + private Exception _e; + private boolean _fork; + private IRunnableWithProgress _runnable; + private IProgressMonitor _monitor; + + private InternalRunnable(IRunnableWithProgress runnable, boolean fork, IProgressMonitor monitor) + { + _runnable = runnable; + _fork = fork; + _monitor = monitor; + } + + /* (non-Javadoc) + * @see java.lang.Runnable#run() + */ + public void run() + { + Display display = Display.getCurrent(); + try + { + ModalContext.run(_runnable, _fork, _monitor, display); + } + catch (InterruptedException e) + { + _e = e; + } + catch (InvocationTargetException e) + { + _e = e; + } + } + + private Exception getException() + { + return _e; + } + } + + // Instance variable + private IRunnableContext _runnableContext; + private SystemRunnableWithProgress _runnable; + + /** + * Constructor + */ + public SystemRunnableContextWrapper(IRunnableContext runnableContext) + { + _runnableContext = runnableContext; + } + + /* (non-Javadoc) + * @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 + { + boolean first = false; + + synchronized(this) + { + if (_runnable == null) + { + // first code to use this runable context so we need to use the SystemRunnableWithProgress to capture the monitor + _runnable = new SystemRunnableWithProgress(runnable); + first = true; + } + } + + if (first) + { + _runnableContext.run(fork, cancelable, _runnable); + } + else + { + // wait for monitor to be initialized by the first task before proceeding + while (_runnable.monitor == null) + { + Thread.sleep(100); + } + + // we want to reuse the montior from the previous runnable + SubProgressMonitor submonitor = new SubProgressMonitor(_runnable.monitor, 0); + + Display display = Display.getCurrent(); + if (display != null) + { + ModalContext.run(runnable, fork, submonitor, display); + } + else + { + InternalRunnable internalRunnable = new InternalRunnable(runnable, fork, submonitor); + Display.getDefault().syncExec(internalRunnable); + Exception e = internalRunnable.getException(); + if (e != null) + { + if (e instanceof InterruptedException) + throw (InterruptedException) e; + else if (e instanceof InvocationTargetException) + throw (InvocationTargetException) e; + } + } + } + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemScratchpad.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemScratchpad.java new file mode 100644 index 00000000000..678e8ba3200 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemScratchpad.java @@ -0,0 +1,94 @@ +/******************************************************************************** + * 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.internal.model; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.rse.ui.view.ISystemDragDropAdapter; +import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; +import org.eclipse.rse.ui.view.ISystemViewElementAdapter; +import org.eclipse.rse.ui.view.SystemViewScratchpadAdapter; +import org.eclipse.ui.views.properties.IPropertySource; + + +/** + * This is the root object for the Remote Scratchpad view. + */ +public class SystemScratchpad implements IAdaptable +{ + public List _children; + public static SystemViewScratchpadAdapter _adapter; + + public SystemScratchpad() + { + _children = new ArrayList(); + } + + public boolean hasChildren() + { + return !_children.isEmpty(); + } + + public boolean contains(Object obj) + { + return _children.contains(obj); + } + + public Object[] getChildren() + { + Object[] children = new Object[_children.size()]; + for (int i = 0; i < _children.size(); i++) + { + children[i] = _children.get(i); + } + return children; + } + + public void addChild(Object child) + { + _children.add(child); + } + + public void removeChild(Object child) + { + _children.remove(child); + } + + public void clearChildren() + { + _children.clear(); + } + + public Object getAdapter(Class adapterType) + { + if (adapterType == IPropertySource.class || + adapterType == ISystemViewElementAdapter.class || + adapterType == ISystemRemoteElementAdapter.class || + adapterType == ISystemDragDropAdapter.class) + { + if (_adapter == null) + { + _adapter = new SystemViewScratchpadAdapter(); + } + return _adapter; + } + return Platform.getAdapterManager().getAdapter(this, adapterType); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/AbstractSystemResourceSet.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/AbstractSystemResourceSet.java new file mode 100644 index 00000000000..bd58ea3768c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/AbstractSystemResourceSet.java @@ -0,0 +1,144 @@ +/******************************************************************************** + * 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.model; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.rse.services.clientserver.messages.SystemMessage; + + + + +public class AbstractSystemResourceSet implements ISystemResourceSet +{ + private List _resourceSet; + private SystemMessage _message; + private long _byteSize; + + public AbstractSystemResourceSet() + { + _resourceSet = new ArrayList(); + } + + public AbstractSystemResourceSet(Object[] set) + { + _resourceSet = new ArrayList(); + if (set != null) + { + for (int i = 0; i < set.length; i++) + { + addResource(set[i]); + } + } + } + + public AbstractSystemResourceSet(List set) + { + _resourceSet = set; + } + + public int size() + { + return _resourceSet.size(); + } + + public Object get(String absoluteName) + { + for (int i = 0; i < _resourceSet.size(); i++) + { + String path = pathFor(_resourceSet.get(i)); + if (path.equals(absoluteName)) + { + return _resourceSet.get(i); + } + } + return null; + } + + public Object get(int index) + { + return _resourceSet.get(index); + } + + public List getResourceSet() + { + return _resourceSet; + } + + public void addResource(Object src) + { + _resourceSet.add(src); + } + + public void removeResource(Object src) + { + _resourceSet.remove(src); + } + + public String pathFor(Object resource) + { + return resource.toString(); + } + + public String toString() + { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < _resourceSet.size(); i++) + { + Object resource = (Object)_resourceSet.get(i); + buf.append(pathFor(resource)); + if (i < _resourceSet.size()) + { + buf.append(", "); + } + buf.append('\n'); + } + return buf.toString(); + } + + + public void setMessage(SystemMessage message) + { + _message = message; + } + + public SystemMessage getMessage() + { + return _message; + } + + public boolean hasMessage() + { + return _message != null; + } + + public boolean hasByteSize() + { + return (_byteSize > 0); + } + + public long byteSize() + { + return _byteSize; + } + + public void setByteSize(long byteSize) + { + _byteSize = byteSize; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/DummyHost.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/DummyHost.java new file mode 100644 index 00000000000..289a52de373 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/DummyHost.java @@ -0,0 +1,266 @@ +/******************************************************************************** + * 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.model; +import org.eclipse.rse.core.subsystems.IConnectorService; +import org.eclipse.rse.core.subsystems.ISubSystem; + +public class DummyHost implements IHost +{ + protected String _hostName; + protected String _systemType; + + public DummyHost(String hostName, String systemType) + { + _hostName = hostName; + _systemType = systemType; + } + public ISystemProfile getSystemProfile() + { + // TODO Auto-generated method stub + return null; + } + + public String getSystemProfileName() + { + // TODO Auto-generated method stub + return null; + } + + public void setHostPool(ISystemHostPool pool) + { + // TODO Auto-generated method stub + + } + + public ISystemHostPool getHostPool() + { + // TODO Auto-generated method stub + return null; + } + + public ISubSystem[] getSubSystems() + { + // TODO Auto-generated method stub + return null; + } + + + + public String getLocalDefaultUserId() + { + // TODO Auto-generated method stub + return null; + } + + public void clearLocalDefaultUserId() + { + // TODO Auto-generated method stub + + } + + public void deletingHost() + { + // TODO Auto-generated method stub + + } + + public void renamingSystemProfile(String oldName, String newName) + { + // TODO Auto-generated method stub + + } + + public boolean getForceUserIdToUpperCase() + { + // TODO Auto-generated method stub + return false; + } + + public boolean compareUserIds(String userId1, String userId2) + { + // TODO Auto-generated method stub + return false; + } + + public String getSystemType() + { + return _systemType; + } + + public void setSystemType(String value) + { + // TODO Auto-generated method stub + + } + + public String getAliasName() + { + // TODO Auto-generated method stub + return null; + } + + public void setAliasName(String value) + { + // TODO Auto-generated method stub + + } + + public String getHostName() + { + return _hostName; + } + + public void setHostName(String value) + { + // TODO Auto-generated method stub + + } + + public String getDescription() + { + // TODO Auto-generated method stub + return null; + } + + public void setDescription(String value) + { + // TODO Auto-generated method stub + + } + + public String getDefaultUserId() + { + // TODO Auto-generated method stub + return null; + } + + public void setDefaultUserId(String value) + { + // TODO Auto-generated method stub + + } + + public boolean isPromptable() + { + // TODO Auto-generated method stub + return false; + } + + public void setPromptable(boolean value) + { + // TODO Auto-generated method stub + + } + + public boolean isOffline() + { + // TODO Auto-generated method stub + return false; + } + + public void setOffline(boolean value) + { + // TODO Auto-generated method stub + + } + + public IConnectorService[] getConnectorServices() + { + // TODO Auto-generated method stub + return null; + } + + public String getName() + { + // TODO Auto-generated method stub + return null; + } + + public IPropertySet[] getPropertySets() + { + // TODO Auto-generated method stub + return null; + } + + public IPropertySet getPropertySet(String name) + { + // TODO Auto-generated method stub + return null; + } + + public IPropertySet createPropertySet(String name, String description) + { + // TODO Auto-generated method stub + return null; + } + + public IPropertySet createPropertySet(String name) + { + // TODO Auto-generated method stub + return null; + } + + + public boolean addPropertySet(IPropertySet set) + { + // TODO Auto-generated method stub + return false; + } + + public boolean addPropertySets(IPropertySet[] sets) + { + // TODO Auto-generated method stub + return false; + } + + public boolean removePropertySet(String name) + { + // TODO Auto-generated method stub + return false; + } + + public boolean isDirty() + { + // TODO Auto-generated method stub + return false; + } + + public void setDirty(boolean flag) + { + // TODO Auto-generated method stub + + } + + public boolean commit() + { + // TODO Auto-generated method stub + return false; + } + + public boolean wasRestored() + { + // TODO Auto-generated method stub + return false; + } + + public void setWasRestored(boolean flag) + { + // TODO Auto-generated method stub + + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/IHost.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/IHost.java new file mode 100644 index 00000000000..546aa4344ae --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/IHost.java @@ -0,0 +1,213 @@ +/******************************************************************************** + * 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.model; + + + + +import org.eclipse.rse.core.subsystems.IConnectorService; +import org.eclipse.rse.core.subsystems.ISubSystem; +// + +/** + * Interface for SystemConnection objects. + * A SystemConnect holds information identifying a remote system. It also logically contains + * SubSystem objects, although this containment is achievable programmatically versus via + * object oriented containment. + *

    + */ +/** + * @lastgen interface SystemConnection {} + */ +public interface IHost extends IRSEModelObject +{ + /** + * Return the system profile that owns this connection + */ + public ISystemProfile getSystemProfile(); + + /** + * Return the name of the system profile that owns this connection + */ + public String getSystemProfileName(); + + /** + * Set the parent connection pool this is owned by. + * Connection pools are internal management objects, one per profile. + */ + public void setHostPool(ISystemHostPool pool); + /** + * Set the parent connection pool this is owned by. + * Connection pools are internal management objects, one per profile. + */ + public ISystemHostPool getHostPool(); + + /** + * Return the subsystem instances under this connection. + * Just a shortcut to {@link org.eclipse.rse.model.ISystemRegistry#getSubSystems(IHost)} + */ + public ISubSystem[] getSubSystems(); + + /** + * Return the local default user Id without resolving up the food chain. + * @see #getDefaultUserId() + */ + public String getLocalDefaultUserId(); + /** + * Clear the local default user Id so next query will return the value from + * the preference store. + *

    + * Same as calling setDefaultUserId(null) + * @see #setDefaultUserId(String) + */ + public void clearLocalDefaultUserId(); + + /** + * Private method called when this connection is being deleted, so + * we can do any pre-death cleanup we need. + *

    + * What we need to do is delete our entry in the preference store for our default userId. + */ + public void deletingHost(); + + /** + * Private method called when this connection's profile is being rename, so + * we can do any pre-death cleanup we need. + *

    + * What we need to do is rename our entry in the preference store for our default userId. + */ + public void renamingSystemProfile(String oldName, String newName); + /** + * Call this to query whether the default userId is to be uppercased. + */ + public boolean getForceUserIdToUpperCase(); + /** + * Call this to compare two userIds taking case sensitivity + */ + public boolean compareUserIds(String userId1, String userId2); +/** + * @return The value of the SystemType attribute + */ + public String getSystemType(); + +/** + * @param value The new value of the SystemType attribute + */ + public void setSystemType(String value); + +/** + * @return The value of the AliasName attribute + * The unique key for this object. Unique per connection pool + */ + public String getAliasName(); + +/** + * @param value The new value of the AliasName attribute + */ + public void setAliasName(String value); + +/** + * @return The value of the HostName attribute + */ + public String getHostName(); + +/** + * @param value The new value of the HostName attribute + */ + public void setHostName(String value); + +/** + * @return The value of the Description attribute + */ + public String getDescription(); + +/** + * @param value The new value of the Description attribute + */ + public void setDescription(String value); + +/** + * We return the default user Id. Note that we don't store it directly in + * the mof-modelled attribute, as we don't want the team to share it. Rather, + * we store the actual user Id in the preference store keyed by this connection's + * unique name (profile.connName) and store that key in this attribute. + *

    + * Further, it is possible that there is no default user id. If so, this + * method will go to the preference store and will try to get the default user + * Id per this connection's system type. + *

    + * This is all transparent to the caller though. + *

    + * @return The value of the DefaultUserId attribute + */ + public String getDefaultUserId(); + +/** + * Intercept of setDefaultUserId so we can force it to uppercase. + * Also, we do not store the user Id per se in the attribute, but rather + * we store it in the preference with a key name unique to this connection. + * We store that key name in this attribute. However, this is all transparent to + * the caller. + * @param value The new value of the DefaultUserId attribute + */ + public void setDefaultUserId(String value); + + /** + * @generated This field/method will be replaced during code generation + * @return The value of the Promptable attribute + */ + boolean isPromptable(); + + /** + * @generated This field/method will be replaced during code generation + * @param value The new value of the Promptable attribute + */ + void setPromptable(boolean value); + + /** + * Returns the value of the 'Offline' attribute. + * + *

    + * Is this connection offline? If so, there is no live connection. Subsystems + * decide how much to enable while offline. + *

    + * + * @return the value of the 'Offline' attribute. + * @see #setOffline(boolean) + * @see org.eclipse.rse.model.ModelPackage#getSystemConnection_Offline() + * @model + * @generated + */ + boolean isOffline(); + + /** + * Sets the value of the '{@link org.eclipse.rse.model.IHost#isOffline Offline}' attribute. + * + * + * @param value the new value of the 'Offline' attribute. + * @see #isOffline() + * @generated + */ + void setOffline(boolean value); + + /** + * Returns all the connector services provided + * for this host + * @return the connector services + */ + IConnectorService[] getConnectorServices(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/IProperty.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/IProperty.java new file mode 100644 index 00000000000..567a84d91a0 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/IProperty.java @@ -0,0 +1,36 @@ +/******************************************************************************** + * 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.model; + +import org.eclipse.rse.internal.model.IPropertyType; + +public interface IProperty +{ + public String getKey(); + + public String getLabel(); + public void setLabel(String label); + + public void setValue(String value); + public String getValue(); + + public void setType(IPropertyType type); + public IPropertyType getType(); + + public void setEnabled(boolean flag); + public boolean isEnabled(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/IPropertySet.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/IPropertySet.java new file mode 100644 index 00000000000..35adb70f33b --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/IPropertySet.java @@ -0,0 +1,40 @@ +/******************************************************************************** + * 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.model; + +import java.util.Map; + +import org.eclipse.rse.internal.model.IPropertyType; + + +public interface IPropertySet +{ + public String getName(); + public String getDescription(); + public IProperty getProperty(String key); + public String getPropertyValue(String key); + public String[] getPropertyKeys(); + public IPropertyType getPropertyType(String key); + + public void setName(String name); + public void setProperties(Map map); + + public IProperty addProperty(String key, String value); + public IProperty addProperty(String key, String value, IPropertyType type); + public boolean removeProperty(String key); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/IPropertySetContainer.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/IPropertySetContainer.java new file mode 100644 index 00000000000..13c53f778b9 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/IPropertySetContainer.java @@ -0,0 +1,30 @@ +/******************************************************************************** + * 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.model; + +public interface IPropertySetContainer +{ + public IPropertySet[] getPropertySets(); + public IPropertySet getPropertySet(String name); + + public IPropertySet createPropertySet(String name); + public IPropertySet createPropertySet(String name, String description); + public boolean addPropertySet(IPropertySet set); + public boolean addPropertySets(IPropertySet[] sets); + public boolean removePropertySet(String name); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/IRSEModelObject.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/IRSEModelObject.java new file mode 100644 index 00000000000..d3ef518dee0 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/IRSEModelObject.java @@ -0,0 +1,25 @@ +/******************************************************************************** + * 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.model; + +import org.eclipse.rse.persistence.IRSEPersistableContainer; + +public interface IRSEModelObject extends IPropertySetContainer, IRSEPersistableContainer +{ + String getName(); + String getDescription(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISubSystemFactoryCategories.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISubSystemFactoryCategories.java new file mode 100644 index 00000000000..a839c56cba7 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISubSystemFactoryCategories.java @@ -0,0 +1,37 @@ +/******************************************************************************** + * 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.model; +/** + * Constants for pre-defined subsystem factory categories. + * Use these in calls to {@link org.eclipse.rse.model.ISystemRegistry#getHostsBySubSystemConfigurationCategory(String)}. + */ +public interface ISubSystemFactoryCategories +{ + /** + * Job subsystems + */ + public static final String SUBSYSTEM_CATEGORY_JOBS = "jobs"; + /** + * File subsystems + */ + public static final String SUBSYSTEM_CATEGORY_FILES = "files"; + /** + * Command subsystems + */ + public static final String SUBSYSTEM_CATEGORY_CMDS = "commands"; + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemContainer.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemContainer.java new file mode 100644 index 00000000000..71c4091c946 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemContainer.java @@ -0,0 +1,59 @@ +/******************************************************************************** + * 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.model; + +/** + * @author dmcknigh + */ +public interface ISystemContainer +{ + + /** + * Returns whether the object has contents of a particular type. + * @param contentsType type of contents + * @return true if the object has contents, false otherwise. + */ + public boolean hasContents(ISystemContentsType contentsType); + + /** + * Returns all the contents of the object (combining results of all filters + * @param contentsType type of contents + * @return an array of contents. + */ + public Object[] getContents(ISystemContentsType contentsType); + + + /** + * Indicates whether the cached object is stale + * @return whether the container is stale + */ + public boolean isStale(); + + /** + * Marks the object as stale or not + * @param isStale whether the object is to be marked stale or not + */ + public void markStale(boolean isStale); + + /** + * Marks the object as stale or not + * @param isStale whether the object is to be marked stale or not + * @param indicates whether or not to clear the cache + */ + public void markStale(boolean isStale, boolean clearCache); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemContentsType.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemContentsType.java new file mode 100644 index 00000000000..2fd7c9c07fe --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemContentsType.java @@ -0,0 +1,36 @@ +/******************************************************************************** + * 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.model; + +/* + * Common interface for representing different contents types of + * artifacts that can be stored in an IRemoteContainer + */ +public interface ISystemContentsType +{ + /* + * Indicates the type of this contents + */ + public String getType(); + + /* + * Indicates whether or not the contents + * can be flushed or not when a container becomes + * stale. + */ + public boolean isPersistent(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemHostPool.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemHostPool.java new file mode 100644 index 00000000000..8f8db3798ab --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemHostPool.java @@ -0,0 +1,179 @@ +/******************************************************************************** + * 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.model; + +import java.util.List; + +import org.eclipse.rse.persistence.IRSEPersistableContainer; + + +// +/** + * A list of connections. + */ +/** + * @lastgen interface SystemConnectionPool {} + */ + +public interface ISystemHostPool extends IRSEPersistableContainer +{ + + + + /** + * Return the system profile that owns this connection pool + */ + public ISystemProfile getSystemProfile(); + /** + * Rename this connection pool. + */ + public void renameHostPool(String newName); + /** + * Return array of connections in this pool + */ + public IHost[] getHosts(); + /** + * Create a connection. + */ + public IHost createHost(String systemType, String aliasName, String hostName) + throws Exception; + /** + * Create a connection. + */ + public IHost createHost(String systemType, String aliasName, String hostName, String description) + throws Exception; + /** + * Create a connection. + */ + public IHost createHost(String systemType, String aliasName, String hostName, String description, + String defaultUserId, int defaultUserIdLocation) + throws Exception; + /** + * Update an existing connection given the new information. + * This method: + *
      + *
    • calls the setXXX methods on the given connection object, updating the information in it. + *
    • saves the connection to disk (renaming its folder if needed) + *
    + *

    + * @param conn SystemConnection to be updated + * @param systemType system type matching one of the system type names defined via the + * systemtype extension point. + * @param aliasName unique connection name. + * @param hostName ip name of host. + * @param description optional description of the connection. Can be null. + * @param defaultUserId userId to use as the default for the subsystems. + * @param defaultUserIdLocation where to set the given default user Id. See ISystemUserIdConstants + */ + public void updateHost(IHost conn, String systemType, + String aliasName, String hostName, + String description,String defaultUserId, int defaultUserIdLocation) + throws Exception; + + /** + * Return a connection given its name. + */ + public IHost getHost(String aliasName); + /** + * Return the connection at the given zero-based offset + */ + public IHost getHost(int pos); + /** + * Add a new connection to the list. + */ + public boolean addHost(IHost conn); + /** + * Removes a given connection from the list and deletes it from disk. + *

    + * This will: + *

      + *
    • Delete the connection in memory + *
    • Delete the underlying folder + *
    + *

    + * @param conn SystemConnection object to remove + */ + public void deleteHost(IHost conn); + /** + * Renames a given connection in the list. + * This will: + *

      + *
    • Rename the profile in memory + *
    • Rename the underlying folder + *
    • Update the user preferences if this profile is currently active. + *
    + * @param conn SystemConnection object to rename + * @param newName The new name to give that connection. + */ + public void renameHost(IHost conn, String newName) throws Exception; + /** + * Return the zero-based position of a SystemConnection object within its profile. + */ + public int getHostPosition(IHost conn); + /** + * Return the number of SystemConnection objects within this pool. + */ + public int getHostCount(); + + /** + * Duplicates a given connection in this list within this list or another list. + * @param targetPool The SystemConnectionPool to hold the copied connection. Can equal this connection, as long as alias name is unique + * @param conn SystemConnection object (within our pool) to clone + * @param alias New, unique, alias name to give this connection. Clone will fail if this is not unique. + */ + public IHost cloneHost(ISystemHostPool targetPool, IHost conn, String aliasName) + throws Exception; + + /** + * Move existing connections a given number of positions in the same pool. + * 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.

    + *

      + *
    • After the move, the pool containing the moved connection is saved to disk. + *
    • The connection's alias name must be unique in pool. + *
    + * TODO PROBLEM: CAN'T RE-ORDER FOLDERS SO CAN WE SUPPORT THIS ACTION? + * @param conns Array of SystemConnections to move. + * @param newPosition new zero-based position for the connection + */ + public void moveHosts(IHost conns[], int delta); + + /** + * Order connections according to user preferences. + * Called after restore. + */ + public void orderHosts(String[] names); + + /** + * @generated This field/method will be replaced during code generation + * @return The value of the Name attribute + */ + String getName(); + + /** + * @generated This field/method will be replaced during code generation + * @param value The new value of the Name attribute + */ + void setName(String value); + + /** + * @generated This field/method will be replaced during code generation + * @return The list of Connections references + */ + List getHostList(); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemMessageObject.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemMessageObject.java new file mode 100644 index 00000000000..fd5e15093f2 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemMessageObject.java @@ -0,0 +1,74 @@ +/******************************************************************************** + * 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.model; +/** + * This interface represents a message we wish to display as child node in the tree view. + *

    + * Related adapter is {@link org.eclipse.rse.ui.view.SystemViewMessageAdapter} + */ +public interface ISystemMessageObject +{ + /** + * 0. An error occurred. + */ + public static final int MSGTYPE_ERROR = 0; + /** + * 1. User canceled + */ + public static final int MSGTYPE_CANCEL= 1; + /** + * 3. Informational text + */ + public static final int MSGTYPE_INFO = 2; + /** + * 4. Empty list. Eg "Nothing meets subset criteria" + */ + public static final int MSGTYPE_EMPTY = 3; + /** + * 5. Object created successfully. + */ + public static final int MSGTYPE_OBJECTCREATED = 4; + + /** + * Return the message text shown for the label. + * The translated text is pre-determined from the message type. + */ + public String getMessage(); + /** + * Return the type of message: + *

      + *
    • {@link #MSGTYPE_ERROR} + *
    • {@link #MSGTYPE_CANCEL} + *
    • {@link #MSGTYPE_INFO} + *
    • {@link #MSGTYPE_EMPTY} + *
    • {@link #MSGTYPE_OBJECTCREATED} + *
    + */ + public int getType(); + /** + * Return the parent object in the tree. That is, what was expanded to produce this message + */ + public Object getParent(); + + /** + * isTransient determines if the message should be removed from the + * tree when the parent item in the tree is collapsed. + * + * @return true if the item should be removed, false if it should not + */ + public boolean isTransient(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemModelChangeEvent.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemModelChangeEvent.java new file mode 100644 index 00000000000..b52f179673c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemModelChangeEvent.java @@ -0,0 +1,43 @@ +/******************************************************************************** + * 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.model; + +/** + * A change event passed to you when listening for RSE model changes. + * Note these are post-events, sent after the fact. + */ +public interface ISystemModelChangeEvent +{ + /** + * Get the event type, such as {@link org.eclipse.rse.model.ISystemModelChangeEvents#SYSTEM_RESOURCE_ADDED}. + * @see org.eclipse.rse.model.ISystemModelChangeEvents + */ + public int getEventType(); + /** + * Get the resource type, such as {@link org.eclipse.rse.model.ISystemModelChangeEvents#SYSTEM_RESOURCETYPE_CONNECTION}. + * @see org.eclipse.rse.model.ISystemModelChangeEvents + */ + public int getResourceType(); + /** + * Get the resource that this event applies to + */ + public Object getResource(); + /** + * Get the old name of the resource, in the event of a resource rename. Null for other event types. + */ + public String getOldName(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemModelChangeEvents.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemModelChangeEvents.java new file mode 100644 index 00000000000..e09a3c66cd3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemModelChangeEvents.java @@ -0,0 +1,104 @@ +/******************************************************************************** + * 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.model; + +/** + * The event IDs sent when local resources in the RSE model change. + * You should monitor for these events in your view if you display any of the resource types listed here. + *

    + * To monitor, implement interface {@link org.eclipse.rse.model.ISystemModelChangeListener} and + * call {@link org.eclipse.rse.model.ISystemRegistry#addSystemModelChangeListener(ISystemModelChangeListener)} + * and in your dispose method, call {@link org.eclipse.rse.model.ISystemRegistry#removeSystemModelChangeListener(ISystemModelChangeListener)}. + *

    + * If you are interesting in firing model change events, see + * {@link org.eclipse.rse.model.ISystemRegistry#fireModelChangeEvent(int, int, Object, String)}. + */ +public interface ISystemModelChangeEvents +{ + + /** + * Event Type: a resource was added + */ + public static final int SYSTEM_RESOURCE_ADDED = 1; + + /** + * Event Type: a resource was removed + */ + public static final int SYSTEM_RESOURCE_REMOVED = 2; + + /** + * Event Type: a resource was changed + */ + public static final int SYSTEM_RESOURCE_CHANGED = 4; + + /** + * Event Type: a resource was renamed + */ + public static final int SYSTEM_RESOURCE_RENAMED = 8; + /** + * Event Type: a resource was reordered relative to its siblings + */ + public static final int SYSTEM_RESOURCE_REORDERED = 16; + + /** + * Event Type: all resource were reloaded from the workspace: you need to refresh your viewer! + * This is fired after the user selects the Reload RSE action in the Team view, after recieving files from the repository. + */ + public static final int SYSTEM_RESOURCE_ALL_RELOADED = 128; + + + /** + * Resource Type: profile + */ + public static final int SYSTEM_RESOURCETYPE_PROFILE = 1; + /** + * Resource Type: connection + */ + public static final int SYSTEM_RESOURCETYPE_CONNECTION = 2; + /** + * Resource Type: subsystem + */ + public static final int SYSTEM_RESOURCETYPE_SUBSYSTEM = 4; + /** + * Resource Type: filter pool + */ + public static final int SYSTEM_RESOURCETYPE_FILTERPOOL = 8; + /** + * Resource Type: filter pool reference. These are what subsystems contain... references to filter pools. + */ + public static final int SYSTEM_RESOURCETYPE_FILTERPOOLREF = 16; + /** + * Resource Type: filter + */ + public static final int SYSTEM_RESOURCETYPE_FILTER = 32; + /** + * Resource Type: user action + */ + public static final int SYSTEM_RESOURCETYPE_USERACTION = 128; + /** + * Resource Type: named type, which are used in user actions + */ + public static final int SYSTEM_RESOURCETYPE_NAMEDTYPE = 256; + /** + * Resource Type: compile command + */ + public static final int SYSTEM_RESOURCETYPE_COMPILECMD = 512; + /** + * Resource Type: ALL. Used with SYSTEM_RESOURCE_ALL_RELOADED + */ + public static final int SYSTEM_RESOURCETYPE_ALL = 9999; +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemModelChangeListener.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemModelChangeListener.java new file mode 100644 index 00000000000..c1b8dfeb6f5 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemModelChangeListener.java @@ -0,0 +1,40 @@ +/******************************************************************************** + * 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.model; +/** + * Interface that listeners interesting in changes to local resources in the RSE model + * implement, and subsequently register their interest, via SystemRegistry. + *

    + * If you list any of the resource types defined in {@link org.eclipse.rse.model.ISystemModelChangeEvents} + * you should monitor by implementing this interface, and registering with the + * system registry via {@link org.eclipse.rse.model.ISystemRegistry#addSystemModelChangeListener(ISystemModelChangeListener)}. + * In your view's dispose method, you must also de-register by calling + * {@link org.eclipse.rse.model.ISystemRegistry#removeSystemModelChangeListener(ISystemModelChangeListener)}. + *

    + * If you are interesting in firing model change events, see + * {@link org.eclipse.rse.model.ISystemRegistry#fireModelChangeEvent(int, int, Object, String)}. + */ +public interface ISystemModelChangeListener +{ + + /** + * 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); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemPreferenceChangeEvent.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemPreferenceChangeEvent.java new file mode 100644 index 00000000000..e604ecccc94 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemPreferenceChangeEvent.java @@ -0,0 +1,45 @@ +/******************************************************************************** + * 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.model; +/** + * Interface of event sent when a remote system preference changes. + * @see org.eclipse.rse.model.ISystemPreferenceChangeEvents + */ +public interface ISystemPreferenceChangeEvent extends ISystemResourceChangeEvents +{ + + /** + * Returns the type of the event. + * @see org.eclipse.rse.model.ISystemPreferenceChangeEvents + * @return a type that is one of the constants in this interface + */ + public int getType(); + /** + * Set the type + * @see org.eclipse.rse.model.ISystemPreferenceChangeEvents + */ + public void setType(int type); + /** + * Get the old value. For boolean will be a Boolean object + */ + public Object getOldValue(); + /** + * Get the new value. For boolean will be a Boolean object + */ + public Object getNewValue(); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemPreferenceChangeEvents.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemPreferenceChangeEvents.java new file mode 100644 index 00000000000..ee8a6afb74f --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemPreferenceChangeEvents.java @@ -0,0 +1,49 @@ +/******************************************************************************** + * 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.model; +/** + * Interface of event ID constants for preferences changed + */ +public interface ISystemPreferenceChangeEvents +{ + /** + * The Show Filter Pools preference has changed + */ + public static final int EVENT_SHOWFILTERPOOLS = 5; + /** + * The Show Filter String preference has changed + */ + public static final int EVENT_SHOWFILTERSTRINGS = 10; + /** + * The Qualify Connection Names preference has changed + */ + public static final int EVENT_QUALIFYCONNECTIONNAMES = 15; + /** + * The Restore State preference has changed + */ + public static final int EVENT_RESTORESTATE = 20; + + /** + * A connection type has been enabled or disabled + */ + public static final int EVENT_ENABLED_CONNECTIONS_CHANGED = 25; + + /** + * The range 10000-10999 is reserved for IBM product use. We'll find a way to + * register these eventually. + */ +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemPreferenceChangeListener.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemPreferenceChangeListener.java new file mode 100644 index 00000000000..da2e5a163bc --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemPreferenceChangeListener.java @@ -0,0 +1,33 @@ +/******************************************************************************** + * 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.model; +import java.util.EventListener; + +/** + * Interface that listeners interesting in changes to remote + * system preferences can implement and subsequently register + * their interest in via SystemRegistry. + */ +public interface ISystemPreferenceChangeListener extends EventListener +{ + /** + * This is the method in your class that will be called when a + * system resource changes. + * @see ISystemPreferenceChangeEvent + */ + public void systemPreferenceChanged(ISystemPreferenceChangeEvent event); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemProfile.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemProfile.java new file mode 100644 index 00000000000..46adf389cce --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemProfile.java @@ -0,0 +1,95 @@ +/******************************************************************************** + * 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.model; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.filters.ISystemFilterPool; + +// + +/** + * The interface that RSE system profiles implement. + *

    + * A profile represents a user or name which is used to key important user-data + * by: + *

      + *
    • Hosts + *
    • Filter pools + *
    • User actions + *
    • Compile commands + *
    + * + *

    + * @lastgen interface SystemProfile {} + */ +public interface ISystemProfile extends IRSEModelObject +{ + + /** + * Set the in-memory pointer back to the parent system profile manager + */ + public void setProfileManager(ISystemProfileManager mgr); + /** + * Get the in-memory pointer back to the parent system profile manager + */ + public ISystemProfileManager getProfileManager(); + + /** + * Convenience method for create a new connection within this profile. + * Shortcut for {@link ISystemRegistry#createHost(String,String,String,String)} + */ + public IHost createHost(String systemType, String connectionName, String hostName, String description) throws Exception; + + /** + * @return The value of the Name attribute + */ + String getName(); + + /** + * @param value The new value of the Name attribute + */ + void setName(String value); + + /** + * @return The value of the DefaultPrivate attribute + * Is this profile created automatically, and is it the profile + * that is unique for this developer? + */ + boolean isDefaultPrivate(); + + /** + * @generated This field/method will be replaced during code generation + * @param value The new value of the DefaultPrivate attribute + */ + void setDefaultPrivate(boolean value); + + /** + * Return all connections for this profile + */ + public IHost[] getHosts(); + /** + * Return all filter pools for this profile + */ + public ISystemFilterPool[] getFilterPools(); + /** + * Return all filter pools for this profile, scoped by a given subsystem factory + */ + public ISystemFilterPool[] getFilterPools(ISubSystemConfiguration ssf); + /** + * Return true if this profile is currently active for this user + */ + public boolean isActive(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemProfileManager.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemProfileManager.java new file mode 100644 index 00000000000..b4bb713207e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemProfileManager.java @@ -0,0 +1,126 @@ +/******************************************************************************** + * 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.model; +import java.util.Vector; + +import org.eclipse.rse.ui.validators.ISystemValidator; + + +/** + * A class that manages a list of SystemProfile objects. + */ +/** + * @lastgen interface SystemProfileManager {} + */ + +public interface ISystemProfileManager { + + + /** + * Create a new profile with the given name, and add to the list. + * The name must be unique within the existing list. + *

    + * The underlying folder is created in the file system. + *

    + * @param name What to name this profile + * @param makeActive true if this profile is to be added to the active profile list. + * @return new profile, or null if name not unique. + */ + public ISystemProfile createSystemProfile(String name, boolean makeActive); + /** + * Toggle an existing profile's state between active and inactive + */ + public void makeSystemProfileActive(ISystemProfile profile, boolean makeActive); + /** + * Get an array of all existing profiles. + */ + public ISystemProfile[] getSystemProfiles(); + /** + * Get an array of all existing profile names. + */ + public String[] getSystemProfileNames(); + /** + * Get a vector of all existing profile names. + */ + public Vector getSystemProfileNamesVector(); + /** + * Get a profile given its name. + */ + public ISystemProfile getSystemProfile(String name); + /** + * Return the profiles identified via preferences as the active profiles... + */ + public ISystemProfile[] getActiveSystemProfiles(); + /** + * Return the profile names currently selected by the user as his "active" profiles + */ + public String[] getActiveSystemProfileNames(); + /** + * Return 0-based position of the given active profile within the list of active profiles. + */ + public int getActiveSystemProfilePosition(String profileName); + /** + * Return the default private profile created at first touch. + * Will return null if it has been renamed! + */ + public ISystemProfile getDefaultPrivateSystemProfile(); + /** + * Return the default team profile created at first touch. + * Will return null if it has been renamed! + */ + public ISystemProfile getDefaultTeamSystemProfile(); + /** + * Rename the given profile. + */ + public void renameSystemProfile(ISystemProfile profile, String newName); + /** + * Delete the given profile + */ + public void deleteSystemProfile(ISystemProfile profile); + /** + * Clone the given profile + */ + public ISystemProfile cloneSystemProfile(ISystemProfile profile, String newName); + /** + * Return true if the given profile is active + * @see ISystemProfile#isActive() + */ + public boolean isSystemProfileActive(String profileName); + + /** + * Reusable method to return a name validator for renaming a profile. + * @param the current profile name on updates. Can be null for new profiles. Used + * to remove from the existing name list the current connection. + */ + public ISystemValidator getProfileNameValidator(String profileName); + /** + * Reusable method to return a name validator for renaming a profile. + * @param the current profile object on updates. Can be null for new profiles. Used + * to remove from the existing name list the current connection. + */ + public ISystemValidator getProfileNameValidator(ISystemProfile profile); + + + + + /** + * @generated This field/method will be replaced during code generation + * @return The list of Profiles references + */ + java.util.List getProfiles(); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemPromptableObject.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemPromptableObject.java new file mode 100644 index 00000000000..0ea5aca9096 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemPromptableObject.java @@ -0,0 +1,73 @@ +/******************************************************************************** + * 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.model; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.widgets.Shell; + +/** + * This interface captures special-case objects in the SystemView that are only there to + * prompt the user to create something new. Eg "New Connection..." which when selected + * launches the new connection wizard. + *

    + * These promptables can either run when expanded, or they can show child promptable + * objects + *

    + * Related adapter is org.eclipse.rse.ui.view.SystemViewPromptableAdapter + */ +public interface ISystemPromptableObject extends IAdaptable +{ + + /** + * Get the parent object (within tree view) + */ + public Object getParent(); + /** + * Set the parent object so that we can respond to getParent requests + */ + public void setParent(Object parent); + /** + * Returns an image descriptor for the image. More efficient than getting the image. + * Calls getImage on the subsystem's owning factory. + */ + public ImageDescriptor getImageDescriptor(); + /** + * Return the label for this object + */ + public String getText(); + /** + * Return the type label for this object + */ + public String getType(); + + /** + * Run this prompt. This should return an appropriate ISystemMessageObject to show + * as the child, reflecting if it ran successfully, was cancelled or failed. + */ + public Object[] run(Shell shell); + + /** + * Return the child promptable objects. + * If this returns null, then SystemViewPromptableAdapter will subsequently + * call {@link #run(Shell)}. + */ + public ISystemPromptableObject[] getChildren(); + /** + * Return true if this is an expandable prompt + */ + public boolean hasChildren(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemRegistry.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemRegistry.java new file mode 100644 index 00000000000..1d72bd4d1e0 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemRegistry.java @@ -0,0 +1,844 @@ +/******************************************************************************** + * 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.model; + +import java.util.List; +import java.util.Vector; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.jobs.ISchedulingRule; +import org.eclipse.jface.operation.IRunnableContext; +import org.eclipse.jface.viewers.Viewer; +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.model.SystemScratchpad; +import org.eclipse.rse.ui.view.ISystemViewInputProvider; +import org.eclipse.rse.ui.wizards.ISystemNewConnectionWizardPage; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.widgets.Shell; + + +/** + * Registry or front door for all remote system connections. + * There is a singleton of the class implementation of this interface. + * To get it, call the {@link org.eclipse.rse.core.SystemPlugin#getTheSystemRegistry() getTheSystemRegistry} + * method in the SystemPlugin object. + *

    + * The idea here is that connections are grouped by system profile. At any + * time, there is a user-specified number of profiles "active" and connections + * from each active profile are worked with. + */ +public interface ISystemRegistry extends ISystemViewInputProvider, ISchedulingRule +{ + // ---------------------------------- + // UI METHODS... + // ---------------------------------- + /** + * Show the RSE perspective if it is not already showing + */ + public void showRSEPerspective(); + /** + * Expand the given connection in the RSE, if the RSE is the active perspective. + */ + public void expandHost(IHost conn); + /** + * Expand the given subsystem in the RSE, if the RSE is the active perspective. + */ + public void expandSubSystem(ISubSystem subsystem); + // ---------------------------------- + // ACTIVE PROGRESS MONITOR METHODS... + // ---------------------------------- + /** + * Set the current active runnable context to be used for a progress monitor + * by the subsystem methods that go to the host. Called by wizards and dialogs + * that have a built-in progress monitor and hence removes the need to popup + * an intrusive pm dialog. + *

    You must call clearRunnableContext when your dialog/wizard is disposed! + * @param shell The shell of the wizard/dialog. This is recorded so it can be tested if + * it is disposed before attempting to use the context + * @param context The dialog/wizard/view that implements IRunnableContext + */ + public void setRunnableContext(Shell shell, IRunnableContext context); + /** + * Clear the current active runnable context to be used for a progress monitor. + * Be sure to call this from you dispose method. + */ + public void clearRunnableContext(); + /** + * Return the current registered runnable context, or null if none registered. Use this + * for long running operations instead of an intrusive progress monitor dialog as it is + * more user friendly. Many dialogs/wizards have these built in so it behooves us to use it. + */ + public IRunnableContext getRunnableContext(); + // ---------------------------- + // SUBSYSTEM FACTORY METHODS... + // ---------------------------- + /** + * Private method used by SystemPlugin to tell registry all registered subsystem + * factories. This way, all code can use this registry to access them versus the + * SystemPlugin. + */ + public void setSubSystemConfigurationProxies(ISubSystemConfigurationProxy[] proxies); + /** + * Public method to retrieve list of subsystem factory proxies registered by extension points. + */ + public ISubSystemConfigurationProxy[] getSubSystemConfigurationProxies(); + /** + * Return all subsystem factory proxies matching a subsystem factory category. + * @see ISubSystemFactoryCategories + */ + public ISubSystemConfigurationProxy[] getSubSystemConfigurationProxiesByCategory(String factoryCategory); + /** + * Return all subsystem factories. Be careful when you call this, as it activates all + * subsystem factories. + */ + public ISubSystemConfiguration[] getSubSystemConfigurations(); + + /** + * Return the parent subsystemconfiguration given a subsystem object. + */ + public ISubSystemConfiguration getSubSystemConfiguration(ISubSystem subsystem); + /** + * Return the subsystemconfiguration, given its plugin.xml-declared id. + */ + public ISubSystemConfiguration getSubSystemConfiguration(String id); + /** + * Return all subsystem factories which have declared themselves part of the given category. + *

    + * This looks for a match on the "category" of the subsystem factory's xml declaration + * in its plugin.xml file. Thus, it is effecient as it need not bring to life a + * subsystem factory just to test its parent class type. + * + * @see ISubSystemFactoryCategories + */ + public ISubSystemConfiguration[] getSubSystemConfigurationsByCategory(String factoryCategory); + /** + * Return all subsystem factories which support the given system type. If the type is null, + * returns all. + * + */ + public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(String systemType); + + /** + * Return all subsystem factories which support the given system type. If the type is null, + * returns all. + */ + public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(String systemType, boolean filterDuplicateServiceSubSystemFactories); + + + // ---------------------------- + // USER PREFERENCE METHODS... + // ---------------------------- + /** + * Are connection names to be qualified by profile name? + */ + public boolean getQualifiedHostNames(); + /** + * Set if connection names are to be qualified by profile name + */ + public void setQualifiedHostNames(boolean set); + /** + * Reflect the user changing the preference for showing filter pools. + */ + public void setShowFilterPools(boolean show); + /* + * Reflect the user changing the preference for showing filter strings. + * + public void setShowFilterStrings(boolean show); + */ + /** + * Reflect the user changing the preference for showing new connection prompt + */ + public void setShowNewHostPrompt(boolean show); + + // ---------------------------- + // PROFILE METHODS... + // ---------------------------- + /** + * Return singleton profile manager + */ + public ISystemProfileManager getSystemProfileManager(); + /** + * Return the profiles currently selected by the user as his "active" profiles + */ + public ISystemProfile[] getActiveSystemProfiles(); + /** + * Return the profile names currently selected by the user as his "active" profiles + */ + public String[] getActiveSystemProfileNames(); + /** + * Return all defined profiles + */ + public ISystemProfile[] getAllSystemProfiles(); + /** + * Return all defined profile names + */ + public String[] getAllSystemProfileNames(); + /** + * Return all defined profile names as a vector + */ + public Vector getAllSystemProfileNamesVector(); + /** + * Get a SystemProfile given its name + */ + public ISystemProfile getSystemProfile(String profileName); + /** + * Create a SystemProfile given its name and whether or not to make it active + */ + public ISystemProfile createSystemProfile(String profileName, boolean makeActive) + throws Exception; + /** + * Copy a SystemProfile. All connections connection data is copied. + * @param monitor Progress monitor to reflect each step of the operation + * @param profile Source profile to copy + * @param newName Unique name to give copied profile + * @param makeActive whether to make the copied profile active or not + * @return new SystemProfile object + */ + public ISystemProfile copySystemProfile(IProgressMonitor monitor, ISystemProfile profile, String newName, boolean makeActive) + throws Exception; + /** + * Rename a SystemProfile. Rename is propogated to all subsystem factories so + * they can rename their filter pool managers and whatever else is required. + */ + public void renameSystemProfile(ISystemProfile profile, String newName) + throws Exception; + /** + * Delete a SystemProfile. Prior to physically deleting the profile, we delete all + * the connections it has, all the subsystems they have. + *

    + * As well, all the filter pools for this profile are deleted, and subsequently any + * cross references from subsystems in connections in other profiles are removed. + *

    + * A delete event is fired for every connection deleted. + */ + public void deleteSystemProfile(ISystemProfile profile) + throws Exception; + /** + * Make or unmake the given profile active + */ + public void setSystemProfileActive(ISystemProfile profile, boolean makeActive); + + + /** + * Return the list of connector services provided for the given host + * @param conn the host + * @return the list of connector services + */ + public IConnectorService[] getConnectorServices(IHost conn); + + // ---------------------------- + // SUBSYSTEM METHODS... + // ---------------------------- + + /** + * Return list of subsystem objects for a given connection. If the subsystems have + * not all been read into memory, this loads them up + */ + public ISubSystem[] getSubSystems(IHost conn); + + /** + * Return list of subsystem objects for a given connection. Use the force + * flag to indicate whether or not to restore from disk + */ + public ISubSystem[] getSubSystems(IHost conn, boolean force); + + public ISubSystem[] getServiceSubSystems(Class serviceType, IHost connection); + + /** + * Resolve a subsystem from it's profile, connection and subsystem name. + * + * @param srcProfileName the name of the profile + * @param srcConnectionName the name of the connection + * @param subsystemFactoryId the id of the subsystem + * + * @return the subsystem + */ + public ISubSystem getSubSystem(String srcProfileName, String srcConnectionName, String subsystemFactoryId); + + /** + * Resolve a subsystem from it's absolute name + * + * @param absoluteSubSystemName the name of the subsystem + * + * @return the subsystem + */ + public ISubSystem getSubSystem(String absoluteSubSystemName); + + /** + * Return the absolute name for the specified subsystem + * @param the subsystem + * @return the absolute name of the subsystem + */ + public String getAbsoluteNameForSubSystem(ISubSystem subsystem); + + /** + * Return the absolute name for the specified connection + * @param the connection + * @return the absolute name of the connection + */ + public String getAbsoluteNameForConnection(IHost connection); + + /** + * Get a list of subsystem objects owned by the subsystem factory identified by + * its given plugin.xml-described id. Array is never null, but may be of length 0. + *

    + * This is a list that of all subsystems for all connections owned by the factory. + */ + public ISubSystem[] getSubSystems(String factoryId); + /** + * Get a list of subsystem objects for given connection, owned by the subsystem factory + * identified by its given plugin.xml-described id. Array will never be null but may be length zero. + */ + public ISubSystem[] getSubSystems(String factoryId, IHost connection); + /** + * Get a list of subsystem objects for given connection, owned by a subsystem factory + * that is of the given category. Array will never be null but may be length zero. + *

    + * This looks for a match on the "category" of the subsystem factory's xml declaration + * in its plugin.xml file. + * + * @see org.eclipse.rse.model.ISubSystemFactoryCategories + */ + public ISubSystem[] getSubSystemsBySubSystemConfigurationCategory(String factoryCategory, IHost connection); + + /** + * Delete a subsystem object. This code finds the factory that owns it and + * delegates the request to that factory. + */ + public boolean deleteSubSystem(ISubSystem subsystem); + + // ---------------------------- + // CONNECTION METHODS... + // ---------------------------- + /** + * Return the first connection to localhost we can find. While we always create a default one in + * the user's profile, it is possible that this profile is not active or the connection was deleted. + * However, since any connection to localHost will usually do, we just search all active profiles + * until we find one, and return it.
    + * If no localhost connection is found, this will return null. If one is needed, it can be created + * easily by calling {@link #createLocalHost(ISystemProfile, String, String)}. + */ + public IHost getLocalHost(); + + /** + * Return all connections in all active profiles. + */ + public IHost[] getHosts(); + /** + * Return all connections in a given profile name. + */ + public IHost[] getHostsByProfile(ISystemProfile profile); + /** + * Return all connections in a given profile. + */ + public IHost[] getHostsByProfile(String profileName); + /** + * Return all connections for which there exists one or more subsystems owned + * by a given subsystem factory. + * @see #getSubSystemConfiguration(String) + */ + public IHost[] getHostsBySubSystemConfiguration(ISubSystemConfiguration factory); + /** + * Return all connections for which there exists one or more subsystems owned + * by a given subsystem factory, identified by factory Id + */ + public IHost[] getHostsBySubSystemConfigurationId(String factoryId); + /** + * Return all connections for which there exists one or more subsystems owned + * by any a given subsystem factory that is of the given category. + *

    + * This looks for a match on the "category" of the subsystem factory's xml declaration + * in its plugin.xml file. Thus, it is effecient as it need not bring to life a + * subsystem factory just to test its parent class type. + * + * @see org.eclipse.rse.model.ISubSystemFactoryCategories + */ + public IHost[] getHostsBySubSystemConfigurationCategory(String factoryCategory); + /** + * Return all connections for all active profiles, for the given system type. + */ + public IHost[] getHostsBySystemType(String systemType); + /** + * Return all connections for all active profiles, for the given system types. + */ + public IHost[] getHostsBySystemTypes(String[] systemTypes); + /** + * Return a SystemConnection object given a system profile containing it, + * and a connection name uniquely identifying it. + */ + public IHost getHost(ISystemProfile profile, String connectionName); + /** + * Return the zero-based position of a SystemConnection object within its profile. + */ + public int getHostPosition(IHost conn); + /** + * Return the number of SystemConnection objects within the given profile + */ + public int getHostCount(String profileName); + /** + * Return the number of SystemConnection objects within the given connection's owning profile + */ + public int getHostCountWithinProfile(IHost conn); + /** + * Return the number of SystemConnection objects within all active profiles + */ + public int getHostCount(); + /** + * Return a vector of previously-used connection names in the given named profile. + * @return Vector of String objects. + */ + public Vector getHostAliasNames(String profileName); + /** + * Return a vector of previously-used connection names in the given profile. + * @return Vector of String objects. + */ + public Vector getHostAliasNames(ISystemProfile profile); + /** + * Return a vector of previously-used connection names in all active profiles. + */ + public Vector getHostAliasNamesForAllActiveProfiles(); + + /** + * Return array of all previously specified hostnames. + */ + public String[] getHostNames(); + /** + * Return array of previously specified hostnames for a given system type. + */ + public String[] getHostNames(String systemType); + + /** + * Returns the clipboard used for copy actions + */ + public Clipboard getSystemClipboard(); + + /** + * Returns the list of objects on the system clipboard + * @param srcType the transfer type + * @return the list of clipboard objects + */ + public List getSystemClipboardObjects(int srcType); + + /* + * Returns the remote systems scratchpad root + */ + public SystemScratchpad getSystemScratchPad(); + + /** + * Convenience method to create a local connection, as it often that one is needed + * for access to the local file system. + * @param profile - the profile to create this connection in. If null is passed, we first + * try to find the default private profile and use it, else we take the first active profile. + * @param name - the name to give this profile. Must be unique and non-null. + * @param userId - the user ID to use as the default for the subsystems. Can be null. + */ + public IHost createLocalHost(ISystemProfile profile, String name, String userId); + + /** + * Create a connection object, given the connection pool and given all the possible attributes. + *

    + * THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU, IN + * THE POOL YOU SPECIFY. THE POOL IS ALSO SAVED TO DISK. + *

    + * This method: + *

      + *
    • creates and saves a new connection within the given profile + *
    • calls all subsystem factories to give them a chance to create a subsystem instance + *
    • fires an ISystemResourceChangeEvent event of type EVENT_ADD to all registered listeners + *
    + *

    + * @param profileName Name of the system profile the connection is to be added to. + * @param systemType system type matching one of the system type names defined via the + * systemtype extension point. + * @param connectionName unique connection name. + * @param hostName ip name of host. + * @param description optional description of the connection. Can be null. + * @param defaultUserId userId to use as the default for the subsystems. + * @param defaultUserIdLocation one of the constants in {@link org.eclipse.rse.core.ISystemUserIdConstants ISystemUserIdConstants} + * that tells us where to set the user Id + * @param newConnectionWizardPages when called from the New Connection wizard this is union of the list of additional + * wizard pages supplied by the subsystem factories that pertain to the specified system type. Else null. + * @return SystemConnection object, or null if it failed to create. This is typically + * because the connectionName is not unique. Call getLastException() if necessary. + */ + public IHost createHost(String profileName, String systemType, + String connectionName, String hostName, + String description,String defaultUserId, int defaultUserIdLocation, + ISystemNewConnectionWizardPage[] newConnectionWizardPages) + throws Exception; + /** + * Create a connection object. This is a simplified version + *

    + * THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU, IN + * THE PROFILE YOU SPECIFY. THE PROFILE IS ALSO SAVED TO DISK. + *

    + * This method: + *

      + *
    • creates and saves a new connection within the given profile + *
    • calls all subsystem factories to give them a chance to create a subsystem instance + *
    • fires an ISystemResourceChangeEvent event of type EVENT_ADD to all registered listeners + *
    + *

    + * @param profileName Name of the system profile the connection is to be added to. + * @param systemType system type matching one of the system type names defined via the + * systemtype extension point. + * @param connectionName unique connection name. + * @param hostName ip name of host. + * @param description optional description of the connection. Can be null. + * @return SystemConnection object, or null if it failed to create. This is typically + * because the connectionName is not unique. Call getLastException() if necessary. + */ + public IHost createHost(String profileName, String systemType, String connectionName, String hostName, String description) + throws Exception; + + /** + * Create a connection object. This is a very simplified version that defaults to the user's + * private profile, or the first active profile if there is no private profile. + *

    + * THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU, IN + * THE DEFAULT PRIVATE PROFILE, WHICH IS SAVED TO DISK. + *

    + * This method: + *

      + *
    • creates and saves a new connection within the given profile + *
    • calls all subsystem factories to give them a chance to create a subsystem instance + *
    • fires an ISystemResourceChangeEvent event of type EVENT_ADD to all registered listeners + *
    + *

    + * @param systemType system type matching one of the system type names defined via the + * systemtype extension point. + * @param connectionName unique connection name. + * @param hostName ip name of host. + * @param description optional description of the connection. Can be null. + * @return SystemConnection object, or null if it failed to create. This is typically + * because the connectionName is not unique. Call getLastException() if necessary. + */ + public IHost createHost(String systemType, String connectionName, String hostName, String description) + throws Exception; + + /** + * Update an existing connection given the new information. + * This method: + *

      + *
    • calls the setXXX methods on the given connection object, updating the information in it. + *
    • save the connection's connection pool to disk + *
    • fires an ISystemResourceChangeEvent event of type EVENT_CHANGE to all registered listeners + *
    • if the systemtype or hostname is changed, calls disconnect on each associated subsystem. + * We must do this because a hostname changes fundamentally affects the connection, + * rendering any information currently displayed under + * that connection obsolete. That is, the user will have to reconnect. + *
    + *

    + * @param conn SystemConnection to be updated + * @param systemType system type matching one of the system type names defined via the + * systemtype extension point. + * @param connectionName unique connection name. + * @param hostName ip name of host. + * @param description optional description of the connection. Can be null. + * @param defaultUserIdLocation one of the constants in {@link org.eclipse.rse.core.ISystemUserIdConstants ISystemUserIdConstants} + * that tells us where to set the user Id + * @param defaultUserId userId to use as the default for the subsystems. + */ + public void updateHost(Shell shell, IHost conn, String systemType, + String connectionName, String hostName, + String description,String defaultUserId, int defaultUserIdLocation); + + /** + * Update the workoffline mode for a connection. + * + * @param conn SystemConnection to change + * @param offline true if connection should be set offline, false if it should be set online + */ + public void setHostOffline(IHost conn, boolean offline); + + /** + * Delete an existing connection. + *

    + * Lots to do here: + *

      + *
    • Delete all subsystem objects for this connection, including their file's on disk. + *
    • Delete the connection from memory. + *
    • Delete the connection's folder from disk. + *
    + * Assumption: firing the delete event is done elsewhere. Specifically, the doDelete method of SystemView. + */ + public void deleteHost(IHost conn); + /** + * Renames an existing connection. + *

    + * Lots to do here: + *

      + *
    • Reset the conn name for all subsystem objects for this connection + *
    • Rename the connection in memory. + *
    • Rename the connection's folder on disk. + *
    + * Assumption: firing the rename event is done elsewhere. Specifically, the doRename method of SystemView. + */ + public void renameHost(IHost conn, String newName) throws Exception; + /** + * Move existing connections a given number of positions in the same profile. + * 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.

    + *

      + *
    • After the move, the pool containing the moved connection is saved to disk. + *
    • The connection's name must be unique in pool. + *
    • Fires a single ISystemResourceChangeEvent event of type EVENT_MOVE, if the pool is the private pool. + *
    + * TODO PROBLEM: CAN'T RE-ORDER FOLDERS SO CAN WE SUPPORT THIS ACTION? + * @param conns Array of SystemConnections to move. + * @param newPosition new zero-based position for the connection + */ + public void moveHosts(String profileName, IHost conns[], int delta); + /** + * Copy a SystemConnection. All subsystems are copied, and all connection data is copied. + * @param monitor Progress monitor to reflect each step of the operation + * @param conn The connection to copy + * @param targetProfile What profile to copy into + * @param newName Unique name to give copied profile + * @return new SystemConnection object + */ + public IHost copyHost(IProgressMonitor monitor, IHost conn, + ISystemProfile targetProfile, String newName) + throws Exception; + /** + * Move a SystemConnection to another profile. All subsystems are copied, and all connection data is copied. + * @param monitor Progress monitor to reflect each step of the operation + * @param conn The connection to move + * @param targetProfile What profile to move to + * @param newName Unique name to give moved profile + * @return new SystemConnection object + */ + public IHost moveHost(IProgressMonitor monitor, IHost conn, + ISystemProfile targetProfile, String newName) + throws Exception; + + /** + * Return true if any of the subsystems for the given connection are currently connected + */ + public boolean isAnySubSystemConnected(IHost conn); + + /** + * Return true if all of the subsystems for the given connection are currently connected + */ + public boolean areAllSubSystemsConnected(IHost conn); + + /** + * Disconnect all subsystems for the given connection, if they are currently connected. + */ + public void disconnectAllSubSystems(IHost conn); + + /** + * Inform the world when the connection status changes for a subsystem within a connection + */ + public void connectedStatusChange(ISubSystem subsystem, boolean connected, boolean wasConnected); + + /** + * Inform the world when the connection status changes for a subsystem within a connection + */ + public void connectedStatusChange(ISubSystem subsystem, boolean connected, boolean wasConnected, boolean collapseTree); + + // ---------------------------- + // EVENT METHODS... + // ---------------------------- + + /** + * Register your interest in being told when a system resource such as a connection is changed. + */ + public void addSystemResourceChangeListener(ISystemResourceChangeListener l); + /** + * De-Register your interest in being told when a system resource such as a connection is changed. + */ + public void removeSystemResourceChangeListener(ISystemResourceChangeListener l); + /** + * Query if the ISystemResourceChangeListener is already listening for SystemResourceChange events + */ + public boolean isRegisteredSystemResourceChangeListener(ISystemResourceChangeListener l); + /** + * Notify all listeners of a change to a system resource such as a connection. + * You would not normally call this as the methods in this class call it when appropriate. + */ + public void fireEvent(ISystemResourceChangeEvent event); + /** + * Notify a specific listener of a change to a system resource such as a connection. + */ + public void fireEvent(ISystemResourceChangeListener l, ISystemResourceChangeEvent event); + /** + * Notify all listeners of a change to a system resource such as a connection. + * You would not normally call this as the methods in this class call it when appropriate. + *

    + * This version calls fireEvent at the next reasonable opportunity, leveraging SWT's + * Display.asyncExec() method. + */ + public void postEvent(ISystemResourceChangeEvent event); + /** + * Notify a specific listener of a change to a system resource such as a connection. + *

    + * This version calls fireEvent at the next reasonable opportunity, leveraging SWT's + * Display.asyncExec() method. + */ + public void postEvent(ISystemResourceChangeListener l, ISystemResourceChangeEvent event); + + // ---------------------------- + // PREFERENCE EVENT METHODS... + // ---------------------------- + + /** + * Register your interest in being told when a system preference changes + */ + public void addSystemPreferenceChangeListener(ISystemPreferenceChangeListener l); + /** + * De-Register your interest in being told when a system preference changes + */ + public void removeSystemPreferenceChangeListener(ISystemPreferenceChangeListener l); + /** + * Notify all listeners of a change to a system preference + * You would not normally call this as the methods in this class call it when appropriate. + */ + public void fireEvent(ISystemPreferenceChangeEvent event); + /** + * Notify a specific listener of a change to a system preference + */ + public void fireEvent(ISystemPreferenceChangeListener l, ISystemPreferenceChangeEvent event); + + // ---------------------------- + // MODEL RESOURCE EVENT METHODS... + // ---------------------------- + + /** + * Register your interest in being told when an RSE model resource is changed. + * These are model events, not GUI-optimized events. + */ + public void addSystemModelChangeListener(ISystemModelChangeListener l); + + /** + * De-Register your interest in being told when an RSE model resource is changed. + */ + public void removeSystemModelChangeListener(ISystemModelChangeListener l); + + /** + * Notify all listeners of a change to a system model resource such as a connection. + * You would not normally call this as the methods in this class call it when appropriate. + */ + public void fireEvent(ISystemModelChangeEvent event); + /** + * Notify all listeners of a change to a system model resource such as a connection. + * This one takes the information needed and creates the event for you. + */ + public void fireModelChangeEvent(int eventType, int resourceType, Object resource, String oldName); + + /** + * Notify a specific listener of a change to a system model resource such as a connection. + */ + public void fireEvent(ISystemModelChangeListener l, ISystemModelChangeEvent event); + + // -------------------------------- + // REMOTE RESOURCE EVENT METHODS... + // -------------------------------- + + /** + * Register your interest in being told when a remote resource is changed. + * These are model events, not GUI-optimized events. + */ + public void addSystemRemoteChangeListener(ISystemRemoteChangeListener l); + + /** + * De-Register your interest in being told when a remote resource is changed. + */ + public void removeSystemRemoteChangeListener(ISystemRemoteChangeListener l); + + /** + * Notify all listeners of a change to a remote resource such as a file. + * You would not normally call this as the methods in this class call it when appropriate. + */ + public void fireEvent(ISystemRemoteChangeEvent event); + + /** + * Notify all listeners of a change to a remote resource such as a file. + * This one takes the information needed and creates the event for you. + * @param eventType - one of the constants from {@link org.eclipse.rse.model.ISystemRemoteChangeEvents} + * @param resource - the remote resource object, or absolute name of the resource as would be given by calling getAbsoluteName on its remote adapter + * @param resourceParent - the remote resource's parent object, or absolute name, if that is known. If it is non-null, this will aid in refreshing occurences of that parent. + * @param subsystem - the subsystem which contains this remote resource. This allows the search for impacts to be + * limited to subsystems of the same parent factory, and to connections with the same hostname as the subsystem's connection. + * @param oldName - on a rename operation, this is the absolute name of the resource prior to the rename + * @param originatingViewer - optional. If set, this gives the viewer a clue that it should select the affected resource after refreshing its parent. + * This saves sending a separate event to reveal and select the new created resource on a create event, for example. + */ + public void fireRemoteResourceChangeEvent(int eventType, Object resource, Object resourceParent, ISubSystem subsystem, String oldName, Viewer originatingViewer); + + /** + * Notify a specific listener of a change to a remote resource such as a file. + */ + public void fireEvent(ISystemRemoteChangeListener l, ISystemRemoteChangeEvent event); + + // ---------------------------- + // MISCELLANEOUS METHODS... + // ---------------------------- + + /** + * Returns filter references associated with this resource under the subsystem + */ + public List findFilterReferencesFor(Object resource, ISubSystem subsystem); + + /** + * Marks all filters for this subsystem as stale to prevent caching + * @param subsystem + */ + public void invalidateFiltersFor(ISubSystem subsystem); + + /** + * Marks all filters for this subsystem the contain resourceParent as stale to prevent caching + * @param resourceParent + * @param subsystem + */ + public void invalidateFiltersFor(Object resourceParent, ISubSystem subsystem); + + + + /** + * Return last exception object caught in any method, or null if no exception. + * This has the side effect of clearing the last exception. + */ + public Exception getLastException(); + + // ---------------------------- + // SAVE / RESTORE METHODS... + // ---------------------------- + + /** + * Save everything! + */ + public boolean save(); + /** + * Save specific connection pool + * @return true if saved ok, false if error encountered. If false, call getLastException(). + */ + public boolean saveHostPool(ISystemHostPool pool); + /** + * Save specific connection + * @return true if saved ok, false if error encountered. If false, call getLastException(). + */ + public boolean saveHost(IHost conn); + /** + * Restore all connections within active profiles + * @return true if restored ok, false if error encountered. If false, call getLastException(). + */ + public boolean restore(); +} //SystemRegistry \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemRemoteChangeEvent.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemRemoteChangeEvent.java new file mode 100644 index 00000000000..2af19fc4c23 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemRemoteChangeEvent.java @@ -0,0 +1,64 @@ +/******************************************************************************** + * 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.model; + +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.rse.core.subsystems.ISubSystem; + + +/** + * A change event passed to you when listening for remote resource changes. + * Note these are post-events, sent after the fact. + */ +public interface ISystemRemoteChangeEvent +{ + /** + * Get the event type, such as {@link org.eclipse.rse.model.ISystemRemoteChangeEvents#SYSTEM_REMOTE_RESOURCE_CREATED}. + * @see org.eclipse.rse.model.ISystemRemoteChangeEvents + */ + public int getEventType(); + + /** + * Get the resource that this event applies to. + * It must either be the binary object of the resource, or the absolute name of the resource. + */ + public Object getResource(); + /** + * Get the parent remote object for the affected remote object. This is not always known, + * but when it is (ie, non null) then it can be used to refresh all expanded occurrences of that parent + */ + public Object getResourceParent(); + + /** + * Get the old name of the resource, in the event of a resource rename. Null for other event types. + */ + public String getOldName(); + + /** + * Get the subsystem in which this resource resides. + * This allows the search for impacts to be limited to subsystems of the same parent factory, and to connections + * with the same hostname as the subsystem's connection. + */ + public ISubSystem getSubSystem(); + + /** + * Get the originating viewer from which this remote resource change event comes from. The combination of this, + * if non-null, plus the selected parent, allows viewers to decide whether to update the selection within the + * parent resource, after refreshing that resource. + */ + public Viewer getOriginatingViewer(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemRemoteChangeEvents.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemRemoteChangeEvents.java new file mode 100644 index 00000000000..3132ba51f12 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemRemoteChangeEvents.java @@ -0,0 +1,46 @@ +/******************************************************************************** + * 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.model; + +/** + * The event IDs sent when remote resources in the model change + */ +public interface ISystemRemoteChangeEvents +{ + + /** + * Event Type: a remote resource was added + */ + public static final int SYSTEM_REMOTE_RESOURCE_CREATED = 1; + + /** + * Event Type: a remote resource was removed + */ + public static final int SYSTEM_REMOTE_RESOURCE_DELETED = 2; + + /** + * Event Type: a remote resource was changed + */ + public static final int SYSTEM_REMOTE_RESOURCE_CHANGED = 4; + + /** + * Event Type: a remote resource was renamed + */ + public static final int SYSTEM_REMOTE_RESOURCE_RENAMED = 8; + + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemRemoteChangeListener.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemRemoteChangeListener.java new file mode 100644 index 00000000000..bf26b41d46c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemRemoteChangeListener.java @@ -0,0 +1,31 @@ +/******************************************************************************** + * 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.model; +/** + * Interface that listeners interesting in changes to remote resources + * implement, and subsequently register their interest, in via SystemRegistry. + */ +public interface ISystemRemoteChangeListener +{ + + /** + * 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 ISystemRemoteChangeEvent + */ + public void systemRemoteResourceChanged(ISystemRemoteChangeEvent event); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemResourceChangeEvent.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemResourceChangeEvent.java new file mode 100644 index 00000000000..5a6d3492a7d --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemResourceChangeEvent.java @@ -0,0 +1,113 @@ +/******************************************************************************** + * 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.model; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.swt.widgets.Item; + +/** + * Interface of event sent when a remote system resource changes. + * These events are mainly for internal use. BPs/ISVs should instead + * fire and monitor for {@link org.eclipse.rse.model.ISystemModelChangeEvent}. + * @see org.eclipse.rse.model.ISystemResourceChangeEvents + */ +public interface ISystemResourceChangeEvent extends ISystemResourceChangeEvents +{ + /** + * Returns an object identifying the source of this event. + * + * @return an object identifying the source of this event + * @see java.util.EventObject + */ + public Object getSource(); + + /** + * For multi-target events, return the array of source targets. + */ + public Object[] getMultiSource(); + + /** + * Returns the parent of the object source. Only quaranteed to + * be set for additions and deletions. + * + * @return an object identifying the parent of the source of this event + */ + public Object getParent(); + /** + * Set the parent + */ + public void setParent(Object parent); + + /** + * Returns the grandparent of the object source. Only quaranteed to + * be set for special case events, which have a special contract with + * the SystemView + * + * @return an object identifying the grandparent of the source of this event + */ + public Object getGrandParent(); + /** + * Return the position value. Used in ADD events. + * @return position to add the new item to. A negative number indicates an append operation + */ + public int getPosition(); + /** + * Set the position value. Used in ADD events. + * @param position zero-based position to insert the new item. A negative number indicates an append operation + */ + public void setPosition(int position); + + /** + * For relative add events, return the previous node this is being added after + */ + public Object getRelativePrevious(); + /** + * For relative add events, set the previous node this is being added after + */ + public void setRelativePrevious(Object previousObject); + + /** + * Returns the type of the event. + * @see org.eclipse.rse.model.ISystemResourceChangeEvents + * @return a type that is one of the constants in this interface + */ + public int getType(); + /** + * Set the type + * @see org.eclipse.rse.model.ISystemResourceChangeEvents + */ + public void setType(int type); + + /** + * Set the originating viewer. For some events, this allows responding viewers to decide if the event applies to them + */ + public void setOriginatingViewer(Viewer viewer); + /** + * Get the originating viewer. For some events, this allows responding viewers to decide if the event applies to them + */ + public Viewer getOriginatingViewer(); + + /** + * Set the viewer Item of the currently selected object. This is a clue when we want to + * expand and select only the specific instance of this widget in this view. + */ + public void setViewerItem(Item item); + /** + * Get the viewer Item of the currently selected object. This is a clue when we want to + * expand and select only the specific instance of this widget in this view. + */ + public Item getViewerItem(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemResourceChangeEvents.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemResourceChangeEvents.java new file mode 100644 index 00000000000..9f44245b2e6 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemResourceChangeEvents.java @@ -0,0 +1,247 @@ +/******************************************************************************** + * 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.model; +/** + * Interface of event ID constants + */ +public interface ISystemResourceChangeEvents +{ + /** + * The event is specifically a filter reference add (filter added) + */ + public static final int EVENT_ADD_FILTER_REFERENCE = 10; + /** + * The event is specifically a filter reference rename (filter renamed) + */ + public static final int EVENT_RENAME_FILTER_REFERENCE = 15; + /** + * The event is specifically a filter reference delete (filter deleted) + */ + public static final int EVENT_DELETE_FILTER_REFERENCE = 20; + /** + * The event is specifically a filter reference change (filter strings changes) + */ + public static final int EVENT_CHANGE_FILTER_REFERENCE = 25; + /** + * The event is specifically a filter reference move (filters reordered) + */ + public static final int EVENT_MOVE_FILTER_REFERENCES = 30; + + /** + * The event is specifically a filter string reference add (filterstring added) + */ + public static final int EVENT_ADD_FILTERSTRING_REFERENCE = 41; + /** + * The event is specifically a filter string reference delete (filterstring deleted) + */ + public static final int EVENT_DELETE_FILTERSTRING_REFERENCE = 42; + /** + * The event is specifically a filter string reference change (filterstring changed) + */ + public static final int EVENT_CHANGE_FILTERSTRING_REFERENCE = 43; + /** + * The event is specifically a filter string reference move (filterstrings reordered) + */ + public static final int EVENT_MOVE_FILTERSTRING_REFERENCES = 44; + + /** + * The event is a resource add. + */ + public static final int EVENT_ADD = 50; + /** + * The event is a multi-resource add. + */ + public static final int EVENT_ADD_MANY = 51; + + /** + * The event is a resource add. The resource is added relative to the "previous" attribute . + */ + public static final int EVENT_ADD_RELATIVE = 53; + /* + * The event is a multi-resource add. The resources are added relative to the "previous" attribute + * + public static final int EVENT_ADD_MANY_RELATIVE = 54; + */ + + /** + * After an add, you wish to expand the parent to reveal and select the new child. + * This is a harmless operation if the parent was already expanded when EVENT_ADD was sent. + */ + public static final int EVENT_REVEAL_AND_SELECT = 52; + /** + * The event is a single resource deletion. + */ + public static final int EVENT_DELETE = 55; + /* + * The event is a single remote resource deletion. You need only set the source, not the parent + * + public static final int EVENT_DELETE_REMOTE = 56; */ + + /** + * The event is a multiple resource deletion. + */ + public static final int EVENT_DELETE_MANY = 60; + /* + * The event is a multiple resource deletion. You need only set the multisource, not the parent + * + public static final int EVENT_DELETE_REMOTE_MANY = 61; */ + + /** + * The event is a resource rename. + */ + public static final int EVENT_RENAME = 65; + /* + * The event is a remote resource rename. You need only set the source, not the parent + * + public static final int EVENT_RENAME_REMOTE = 66; */ + + /** + * The event is a resource move within the same children set + */ + //public static final int EVENT_MOVE = 70; + /** + * The event is a multiple resource move within the same children set + */ + public static final int EVENT_MOVE_MANY = 75; + /** + * The event is a resource change. This results in a shallow refresh: only direct children are refreshed. + */ + //public static final int EVENT_CHANGE = 80; + /** + * The event is an icon change event + */ + public static final int EVENT_ICON_CHANGE = 81; + /** + * The event is a full refresh event: all expanded sub-nodes are re-queried for their children, unexpanded nodes lose their children cache. + */ + public static final int EVENT_REFRESH = 82; + /** + * The event is a selection-dependent refresh event: all expanded sub-nodes are re-queried for their children, unexpanded nodes lose their children cache. + */ + public static final int EVENT_REFRESH_SELECTED = 83; + /** + * The event is a selection-dependent refresh event: refreshes the parent of the current selections + */ + public static final int EVENT_REFRESH_SELECTED_PARENT = 84; + /** + * The event is a selection-dependent refresh event: from the filter level, all expanded sub-nodes are re-queried for their children, unexpanded nodes lose their children cache. + */ + public static final int EVENT_REFRESH_SELECTED_FILTER = 135; + /** + * The event is refreshes a remote object (has an ISystemViewRemoteElementAdapter) given either the remote object or a string that will match on getAbsoluteName. + * The tricky part about remote objects is their actual memory object changes on each refresh, so to find one in the tree we must use something + * more permanent: hence the use of getAbsoluteName to find it. + *

    + * You can optionally pass a child remote object, or string, or vector of objects or strings, in the parent parameter, and it/they will be selected after the refresh. + * If it a string then it must be the result of getAbsoluteName on the adapter. + */ + public static final int EVENT_REFRESH_REMOTE = 85; + + /** + * The event is a resource property change. + */ + public static final int EVENT_PROPERTY_CHANGE = 86; + /** + * The event is a request to update the property sheet of whatever is currently selected. + */ + public static final int EVENT_PROPERTYSHEET_UPDATE = 87; + + /** + * The event is a resource property change that invalidates child nodes + * in the GUI (eg, hostname change means the expanded information should + * be collapsed) + */ + public static final int EVENT_MUST_COLLAPSE = 90; + /** + * The event is a full collapse of the RSE tree + * Pass "false" for the src value to prevent the memory flush, else + * pass any dummy value for the src to prevent crash, but it is ignored + */ + public static final int EVENT_COLLAPSE_ALL = 91; + /** + * The event is a collapse of the selected elements in the tree + * Pass any dummy value for the src to prevent crash, but it is ignored + */ + public static final int EVENT_COLLAPSE_SELECTED = 92; + /** + * The event is an expand of the selected elements in the tree + * Pass any dummy value for the src to prevent crash, but it is ignored + */ + public static final int EVENT_EXPAND_SELECTED = 93; + /** + * The event is a generic notification that the children have changed + * and must be refreshed. + */ + public static final int EVENT_CHANGE_CHILDREN = 95; + /** + * The event is simply to force selection of the given object. + */ + public static final int EVENT_SELECT = 100; + /** + * The event is to select a remote object + */ + public static final int EVENT_SELECT_REMOTE = 101; + + /** + * The event is to both select and expand the given object. + */ + public static final int EVENT_SELECT_EXPAND = 105; + /** + * The event is to log a command that has been run + */ + public static final int EVENT_COMMAND_RUN = 110; + /** + * The event is to log a message from a command that has been run + */ + public static final int EVENT_COMMAND_MESSAGE = 115; + /** + * The event is to replace the children (similar to EVENT_ADD_MANY), it will + * expand also + */ + public static final int EVENT_REPLACE_CHILDREN = 120; + /** + * The event is to log a command that has been run + */ + public static final int EVENT_COMPILE_COMMAND_RUN = 125; + /** + * The event is to update the command history drop-down in the Commands view + */ + public static final int EVENT_COMMAND_HISTORY_UPDATE = 130; + + /** + * The event is to update the commands view when a command is finished + * @deprecated use EVENT_COMMAND_SHELL_FINISHED + */ + public static final int EVENT_COMMAND_FINISHED = 140; + + /** + * The event is to update the commands view when a command is finished + */ + public static final int EVENT_COMMAND_SHELL_FINISHED = 140; + public static final int EVENT_COMMAND_SHELL_REMOVED = 141; + + /** + * The event is to update the search view when a search is finished + */ + public static final int EVENT_SEARCH_FINISHED = 150; + + /** + * Predefined event object for a property sheet update. + */ + public static final ISystemResourceChangeEvent PROPERTYSHEET_UPDATE_EVENT = + new SystemResourceChangeEvent("dummy",EVENT_PROPERTYSHEET_UPDATE,null); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemResourceChangeListener.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemResourceChangeListener.java new file mode 100644 index 00000000000..2634701d2cd --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemResourceChangeListener.java @@ -0,0 +1,40 @@ +/******************************************************************************** + * 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.model; +import java.util.EventListener; + +import org.eclipse.swt.widgets.Shell; + +/** + * Interface that listeners interesting in changes to remote + * system connections and subsystems can listen implement and + * subsequently register their interest in via SystemRegistry. + */ +public interface ISystemResourceChangeListener extends EventListener +{ + /** + * This is the method in your class that will be called when a + * system resource changes. + * @see ISystemResourceChangeEvent + */ + public void systemResourceChanged(ISystemResourceChangeEvent event); + /** + * This is the method in your class that will be called to return the + * shell for your viewer + */ + public Shell getShell(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemResourceSet.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemResourceSet.java new file mode 100644 index 00000000000..2df0464a7fb --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/ISystemResourceSet.java @@ -0,0 +1,36 @@ +/******************************************************************************** + * 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.model; + +import java.util.List; + +import org.eclipse.rse.services.clientserver.messages.SystemMessage; + + +public interface ISystemResourceSet +{ + public int size(); + public Object get(String absoluteName); + public String pathFor(Object obj); + public Object get(int index); + public List getResourceSet(); + public SystemMessage getMessage(); + public boolean hasMessage(); + public boolean hasByteSize(); + public long byteSize(); + public void setByteSize(long byteSize); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/PropertyType.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/PropertyType.java new file mode 100644 index 00000000000..366a92748a6 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/PropertyType.java @@ -0,0 +1,123 @@ +/******************************************************************************** + * 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.model; + +import org.eclipse.rse.internal.model.IPropertyType; + + +public class PropertyType implements IPropertyType +{ + private final String ENUMERATION_STR = "enumeration:"; + + private int _type = 0; + + + private String[] _enumValues; + + public PropertyType(int type) + { + _type = type; + } + + public PropertyType(String typeStr) + { + if (typeStr.equals(String.class.toString())) + { + setType(TYPE_STRING); + } + else if (typeStr.equals(Integer.class.toString())) + { + setType(TYPE_INTEGER); + } + else if (typeStr.startsWith(ENUMERATION_STR)) + { + setType(TYPE_ENUM); + String subString = typeStr.substring(ENUMERATION_STR.length()); + String[] enumValues = subString.split(","); + setEnumValues(enumValues); + } + else + { + setType(TYPE_STRING); + } + } + + public int getType() + { + return _type; + } + + public void setType(int type) + { + _type = type; + } + + public boolean isString() + { + return _type == TYPE_STRING; + } + + public boolean isInteger() + { + return _type == TYPE_INTEGER; + } + + public boolean isEnum() + { + return _type == TYPE_ENUM; + } + + public void setEnumValues(String[] enumValues) + { + _enumValues = enumValues; + } + + + public String[] getEnumValues() + { + return _enumValues; + } + + public String toString() + { + if (isString()) + { + return String.class.getName(); + } + else if (isInteger()) + { + return Integer.class.getName(); + } + else if (isEnum()) + { + StringBuffer buf = new StringBuffer(); + buf.append(ENUMERATION_STR); + String[] enumValues = getEnumValues(); + for (int i = 0; i < enumValues.length; i++) + { + buf.append(enumValues[i]); + if (i + 1 < enumValues.length) + { + buf.append(","); + } + } + return buf.toString(); + } + return super.toString(); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemChildrenContentsType.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemChildrenContentsType.java new file mode 100644 index 00000000000..8b44ec77c29 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemChildrenContentsType.java @@ -0,0 +1,50 @@ +/******************************************************************************** + * 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.model; + + +/** + * Represents contents that are children of a container + */ +public class SystemChildrenContentsType implements ISystemContentsType +{ + public static String CONTENTS_TYPE_CHILDREN = "contents_children"; + public static SystemChildrenContentsType _instance = new SystemChildrenContentsType(); + + public static SystemChildrenContentsType getInstance() + { + return _instance; + } + + /* (non-Javadoc) + * @see com.ibm.etools.systems.subsystems.IRemoteContentsType#getType() + */ + public String getType() + { + return CONTENTS_TYPE_CHILDREN; + } + + /* (non-Javadoc) + * @see com.ibm.etools.systems.subsystems.IRemoteContentsType#isPersistent() + */ + public boolean isPersistent() + { + return false; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemEscapeCharHelper.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemEscapeCharHelper.java new file mode 100644 index 00000000000..2634a700635 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemEscapeCharHelper.java @@ -0,0 +1,179 @@ +/******************************************************************************** + * 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.model; + +public class SystemEscapeCharHelper { + + + private static char ESCAPE_CHAR = '#'; + + private char changedChars[]; + private int escapeStringLength; + + + /** + * Constructor. + * @param chars array of chars to be escaped. + */ + public SystemEscapeCharHelper (char[] chars) + { + changedChars = new char[chars.length+1]; + + for (int i = 0; i < chars.length; i++) + { + changedChars[i]=chars[i]; + } + + // add the escape character itself so that it itself can be escaped + changedChars[chars.length]=ESCAPE_CHAR; + + escapeStringLength = 4; + + } + + public String getStringForFileName(String name) + { + String fileName = name; + + int i = 0; + while (i < fileName.length()) + { + for (int j = 0; j < changedChars.length; j++) + { + if (fileName.charAt(i) == changedChars[j]) + { + if ((fileName.length()-1) >= i) + { + fileName = fileName.substring(0, i) + escapeString(changedChars[j]) + fileName.substring(i+1); + } + else + { + fileName = fileName.substring(0, i) + escapeString(changedChars[j]); + } + i = i + escapeStringLength-1; + } + } + i++; + } + + return fileName; + + } + + public String getStringFromFileName(String fileName) + { + String name = fileName; + + int i = 0; + while (i < name.length()) + { + if (name.charAt(i) == ESCAPE_CHAR) + { + if ((name.length()-2) >= i) + { + name = name.substring(0, i) + originalString(name.substring(i+1, i+escapeStringLength)) + name.substring(i+escapeStringLength); + } + else + { + name = name.substring(0, i) + originalString(name.substring(i+1)); + } + } + i++; + } + + return name; + } + + private String escapeString(char c) + { + /* for (int i = 0; i < changedChars.length; i++) + { + if (changedChars[i]== c) + { + return ""+ESCAPE_CHAR+i; + } + } + return ""+c; + */ + + int intValue = (int)c; + String returnStr=""+ESCAPE_CHAR; + + if (intValue < 10) + returnStr = returnStr+"00"; + else if (intValue < 100) + returnStr = returnStr+"0"; + + return returnStr + intValue; + + } + + private String originalString(String s) + { + // return ""+changedChars[Integer.parseInt(s)]; + + char c = (char)Integer.parseInt(s); + + return ""+c; + } + + + +/* TEST HARNESS */ +/* public static void main(String[] args) + { + try { + char [] charArray = new char[1]; + + charArray[0]='\''; + SystemEscapeCharHelper helper = new +SystemEscapeCharHelper(charArray); + + System.out.println(">>>>>start>>>>>"); + + + String[] strings = {"'hello_world'", "'", "'abc'", "bca", "ca'_'b"}; + for (int i = 0; i < strings.length; i++) + { + String escaped = helper.getStringForFileName(strings[i]); + + System.out.println("escaped:"+escaped+":"); + + String unescaped = helper.getStringFromFileName(escaped); + + System.out.println("unescaped:"+unescaped+":"); + System.out.println("***"); + } + System.out.println("*****end*****"); + + + } catch (Exception e){ + System.out.println(""+e.toString()); + +// try{ +// System.in.read(); +// }catch(Exception ex) +// { +// } + + } +// try{ +// System.in.read(); +// }catch(Exception e) +// {} +}*/ +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemFilterStringContentsType.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemFilterStringContentsType.java new file mode 100644 index 00000000000..8f33456fb13 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemFilterStringContentsType.java @@ -0,0 +1,47 @@ +/******************************************************************************** + * 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.model; +/** + * Represents contents that are children of a container + */ +public class SystemFilterStringContentsType implements ISystemContentsType +{ + public static String CONTENTS_TYPE_CHILDREN_PARENTS = "contents_children_parents"; + public static SystemFilterStringContentsType _instance = new SystemFilterStringContentsType(); + + public static SystemFilterStringContentsType getInstance() + { + return _instance; + } + + /* (non-Javadoc) + * @see com.ibm.etools.systems.subsystems.IRemoteContentsType#getType() + */ + public String getType() + { + return CONTENTS_TYPE_CHILDREN_PARENTS; + } + + /* (non-Javadoc) + * @see com.ibm.etools.systems.subsystems.IRemoteContentsType#isPersistent() + */ + public boolean isPersistent() + { + return false; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemMessageObject.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemMessageObject.java new file mode 100644 index 00000000000..b3b3f6f4ed3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemMessageObject.java @@ -0,0 +1,104 @@ +/******************************************************************************** + * 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.model; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; + +/** + * This class captures a message we wish to display as child node in the tree view. + */ +public class SystemMessageObject implements ISystemMessageObject, IAdaptable, Comparable +{ + + SystemMessage systemMessage; + protected String message; + protected int type; + protected Object parent; + + /** + * Constructor when using SystemMessage + * @param msgObj The system message from which to retrieve text to show in the tree viewer + * @param type The message severity, dictating the icon. + * @param parent The parent node of this within the tree view + * @see org.eclipse.rse.model.ISystemMessageObject + */ + public SystemMessageObject(SystemMessage msgObj, int type, Object parent) + { + this.systemMessage = msgObj; + this.message = msgObj.getLevelOneText(); + this.type = type; + this.parent = parent; + } + + /** + * Get the message to display in the tree viewer + */ + public String getMessage() + { + return message; + } + + /** + * Message type. + * @see org.eclipse.rse.model.ISystemMessageObject + */ + public int getType() + { + return type; + } + + /** + * Get the parent object (within tree view) + */ + public Object getParent() + { + return parent; + } + + /** + * 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); + } + /** + * @see ISystemMessageObject#isTransient() + */ + public boolean isTransient() { + return true; + } + + /** + * Return the SystemMessage for this SystemMessageObject. + */ + public SystemMessage getSystemMessage() + { + return systemMessage; + } + + /** + * @see java.lang.Comparable#compareTo(java.lang.Object) + */ + public int compareTo(Object o) { + ISystemMessageObject other = (ISystemMessageObject)o; + return getMessage().compareTo(other.getMessage()); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRemoteChangeEvent.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRemoteChangeEvent.java new file mode 100644 index 00000000000..74a4e49adcb --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRemoteChangeEvent.java @@ -0,0 +1,170 @@ +/******************************************************************************** + * 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.model; + +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.rse.core.subsystems.ISubSystem; + + +/** + * For listeners interested in changes with remote resources. + * These events are designed to state what the change to the resource was, not to + * optimize those events for a GUI (eg, a delete event versus a refresh event) + */ +public class SystemRemoteChangeEvent implements ISystemRemoteChangeEvent, ISystemRemoteChangeEvents +{ + private int eventType; + private Object resource, parent; + private String oldName; + private ISubSystem subsystem; + private Viewer originatingViewer; + + /** + * Constructor for non-rename event + * @param eventType - one of the constants from {@link org.eclipse.rse.model.ISystemRemoteChangeEvents} + * @param resource - the remote resource object, or absolute name of the resource as would be given by calling getAbsoluteName on its remote adapter + * @param resourceParent - the remote resource's parent object, or absolute name, if that is known. If it is non-null, this will aid in refreshing occurences of that parent. + * @param subsystem - the subsystem which contains this remote resource. This allows the search for impacts to be + * limited to subsystems of the same parent factory, and to connections with the same hostname as the subsystem's connection. + */ + public SystemRemoteChangeEvent(int eventType, Object resource, Object resourceParent, ISubSystem subsystem) + { + super(); + this.eventType = eventType; + this.resource = resource; + this.parent = resourceParent; + this.subsystem = subsystem; + } + /** + * Constructor for a rename event. + * @param eventType - one of the constants from {@link org.eclipse.rse.model.ISystemRemoteChangeEvents} + * @param resource - the remote resource object, or absolute name of the resource as would be given by calling getAbsoluteName on its remote adapter + * @param resourceParent - the remote resource's parent object, or absolute name, if that is known. If it is non-null, this will aid in refreshing occurences of that parent. + * @param subsystem - the subsystem which contains this remote resource. This allows the search for impacts to be + * limited to subsystems of the same parent factory, and to connections with the same hostname as the subsystem's connection. + * @param oldName - on a rename operation, this is the absolute name of the resource prior to the rename + */ + public SystemRemoteChangeEvent(int eventType, Object resource, Object resourceParent, ISubSystem subsystem, String oldName) + { + this(eventType, resource, resourceParent, subsystem); + this.oldName = oldName; + } + /** + * Constructor you shouldn't use unless you intend to call the setters + */ + public SystemRemoteChangeEvent() + { + } + + /** + * Reset the event type + */ + public void setEventType(int eventType) + { + this.eventType = eventType; + } + /** + * Reset the resource + */ + public void setResource(Object resource) + { + this.resource = resource; + } + /** + * Reset the resource's remote resource parent + */ + public void setResourceParent(Object resourceParent) + { + this.parent = resourceParent; + } + + /** + * Reset the subsystem + */ + public void setSubSystem(ISubSystem subsystem) + { + this.subsystem = subsystem; + } + /** + * Reset the old name on a rename event + */ + public void setOldName(String oldName) + { + this.oldName = oldName; + } + + /** + * Set the originating viewer. Only this viewer is candidate for updating the selection. Eg, on a + * create event, if this and the resource parent is set, the newly created object is selected after + * the parent's contents are refreshed, for the originating viewer. + */ + public void setOriginatingViewer(Viewer originatingViewer) + { + this.originatingViewer = originatingViewer; + } + + /** + * Get the event type, such as {@link org.eclipse.rse.model.ISystemRemoteChangeEvents#SYSTEM_REMOTE_RESOURCE_CREATED}. + * @see org.eclipse.rse.model.ISystemRemoteChangeEvents + */ + public int getEventType() + { + return eventType; + } + /** + * Get the resource that this event applies to + * It must either be the binary object of the resource, or the absolute name of the resource. + */ + public Object getResource() + { + return resource; + } + /** + * Get the parent remote object for the affected remote object. This is not always known, + * but when it is (ie, non null) then it can be used to refresh all expanded occurrences of that parent + */ + public Object getResourceParent() + { + return parent; + } + /** + * Get the subsystem in which this resource resides. + * This allows the search for impacts to be limited to subsystems of the same parent factory, and to connections + * with the same hostname as the subsystem's connection. + */ + public ISubSystem getSubSystem() + { + return subsystem; + } + /** + * Get the old name of the resource, in the event of a resource rename. Null for other event types. + */ + public String getOldName() + { + return oldName; + } + + /** + * Get the originating viewer from which this remote resource change event comes from. The combination of this, + * if non-null, plus the resource parent, allows viewers to decide whether to update the selection within the + * parent resource, after refreshing that resource. + */ + public Viewer getOriginatingViewer() + { + return originatingViewer; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRemoteElementResourceSet.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRemoteElementResourceSet.java new file mode 100644 index 00000000000..b3753dc92e8 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRemoteElementResourceSet.java @@ -0,0 +1,89 @@ +/******************************************************************************** + * 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.model; + +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.ui.view.ISystemViewElementAdapter; + +public class SystemRemoteElementResourceSet extends AbstractSystemResourceSet +{ + private ISubSystem _subSystem; + private ISystemViewElementAdapter _adapter; + + public SystemRemoteElementResourceSet(ISubSystem subSystem) + { + super(); + _subSystem = subSystem; + } + + public SystemRemoteElementResourceSet(ISubSystem subSystem, ISystemViewElementAdapter adapter) + { + super(); + _subSystem = subSystem; + _adapter = adapter; + } + + public SystemRemoteElementResourceSet(ISubSystem subSystem, ISystemViewElementAdapter adapter, Object[] objects) + { + super(objects); + _subSystem = subSystem; + _adapter = adapter; + } + + public SystemRemoteElementResourceSet(ISubSystem subSystem, ISystemViewElementAdapter adapter, List objects) + { + super(objects); + _subSystem = subSystem; + _adapter = adapter; + } + + public SystemRemoteElementResourceSet(ISubSystem subSystem, Object[] objects) + { + super(objects); + _subSystem = subSystem; + } + + public SystemRemoteElementResourceSet(ISubSystem subSystem, List objects) + { + super(objects); + _subSystem = subSystem; + } + + public ISystemViewElementAdapter getAdapter() + { + return _adapter; + } + + public ISubSystem getSubSystem() + { + return _subSystem; + } + + public String pathFor(Object resource) + { + if (_adapter == null) + { + _adapter = (ISystemViewElementAdapter)((IAdaptable)resource).getAdapter(ISystemViewElementAdapter.class); + } + + return _adapter.getAbsoluteName(resource); + } + +} diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRemoteResourceSet.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRemoteResourceSet.java new file mode 100644 index 00000000000..e63eb74d980 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRemoteResourceSet.java @@ -0,0 +1,92 @@ +/******************************************************************************** + * 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.model; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.ui.view.ISystemDragDropAdapter; + + +public class SystemRemoteResourceSet extends AbstractSystemResourceSet +{ + private ISubSystem _subSystem; + private ISystemDragDropAdapter _adapter; + + + + public SystemRemoteResourceSet(ISubSystem subSystem) + { + super(); + _subSystem = subSystem; + } + + public SystemRemoteResourceSet(ISubSystem subSystem, ISystemDragDropAdapter adapter) + { + super(); + _subSystem = subSystem; + _adapter = adapter; + } + + public SystemRemoteResourceSet(ISubSystem subSystem, ISystemDragDropAdapter adapter, Object[] objects) + { + super(objects); + _subSystem = subSystem; + _adapter = adapter; + } + + public SystemRemoteResourceSet(ISubSystem subSystem, ISystemDragDropAdapter adapter, List objects) + { + super(objects); + _subSystem = subSystem; + _adapter = adapter; + } + + public SystemRemoteResourceSet(ISubSystem subSystem, Object[] objects) + { + super(objects); + _subSystem = subSystem; + } + + public SystemRemoteResourceSet(ISubSystem subSystem, List objects) + { + super(objects); + _subSystem = subSystem; + } + + public ISystemDragDropAdapter getAdapter() + { + return _adapter; + } + + public ISubSystem getSubSystem() + { + return _subSystem; + } + + public String pathFor(Object resource) + { + if (_adapter == null) + { + _adapter = (ISystemDragDropAdapter)((IAdaptable)resource).getAdapter(ISystemDragDropAdapter.class); + } + + return _adapter.getAbsoluteName(resource); + } + + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemResourceChangeEvent.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemResourceChangeEvent.java new file mode 100644 index 00000000000..1b4c1225e32 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemResourceChangeEvent.java @@ -0,0 +1,190 @@ +/******************************************************************************** + * 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.model; +import java.util.EventObject; + +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.swt.widgets.Item; + + +/** + * Event object sent to SystemResourceChangeListeners when a + * remote system object is created, changed, removed, etc. + * @see org.eclipse.rse.model.ISystemResourceChangeEvents + */ +public class SystemResourceChangeEvent + extends EventObject + implements ISystemResourceChangeEvent +{ + private Object parent,grandparent, prevObj; + private Object[] multiSource; + private Viewer originatingViewer; + private int type; + private int position = -1; + private Item item; + + /** + * Constructor for SystemResourceChangeEvent. + * @see org.eclipse.rse.model.ISystemResourceChangeEvents + * @param source The object that was added,deleted,renamed,changed. + * @param type The type of event, one of ISystemChangeEvent constants. + * @param parent The parent of the object that was added or deleted. + */ + public SystemResourceChangeEvent(Object source, int type, Object parent) + { + super(source); + setType(type); + setParent(parent); + } + /** + * Constructor for SystemResourceChangeEvent when the source is multipe resources. + * @see org.eclipse.rse.model.ISystemResourceChangeEvents + * @param source The array of objects that were added,deleted,renamed,changed. + * @param type The type of event, one of ISystemChangeEvent constants. + * @param parent The parent of the object that was added or deleted. + */ + public SystemResourceChangeEvent(Object[] source, int type, Object parent) + { + super(((source!=null) && (source.length>0)) ? source[0] : "nada"); // defect 42112 + this.multiSource = source; + this.type = type; + this.parent = parent; + } + + /** + * For multi-target events, return the array of source targets. + */ + public Object[] getMultiSource() + { + return multiSource; + } + + /** + * Return the parent of the object added or removed. + * @see ISystemResourceChangeEvent#getParent() + */ + public Object getParent() + { + return parent; + } + /** + * Set the parent + */ + public void setParent(Object parent) + { + this.parent = parent; + } + + /** + * Return the grand parent of the object added or removed. + * @see ISystemResourceChangeEvent#getParent() + */ + public Object getGrandParent() + { + return grandparent; + } + /** + * Set the grand parent of the object added or removed. + */ + public void setGrandParent(Object grandparent) + { + this.grandparent = grandparent; + } + /** + * Return the position value. Used in ADD events. + * @return position to add the new item to. A negative number indicates an append operation + */ + public int getPosition() + { + return position; + } + /** + * Set the position value. Used in ADD events. + * @param position zero-based position to insert the new item. A negative number indicates an append operation + */ + public void setPosition(int position) + { + this.position = position; + } + /** + * Set the viewer Item of the currently selected object. This is a clue when we want to + * expand and select only the specific instance of this widget in this view. + */ + public void setViewerItem(Item item) + { + this.item = item; + } + + + /** + * Return the type of the event (add, change, remove, rename, change, property change). + * @see org.eclipse.rse.model.ISystemResourceChangeEvents + * @see org.eclipse.rse.model.ISystemResourceChangeEvent + * @see org.eclipse.rse.model.ISystemResourceChangeEvent#getType() + */ + public int getType() + { + return type; + } + /** + * Set the type + * @see org.eclipse.rse.model.ISystemResourceChangeEvents + */ + public void setType(int type) + { + this.type = type; + } + + /** + * For relative add events, return the previous node this is being added after + */ + public Object getRelativePrevious() + { + return prevObj; + } + /** + * For relative add events, set the previous node this is being added after + */ + public void setRelativePrevious(Object previousObject) + { + this.prevObj = previousObject; + } + + /** + * Set the originating viewer. For some events, this allows responding viewers to decide if the event applies to them + */ + public void setOriginatingViewer(Viewer viewer) + { + this.originatingViewer = viewer; + } + /** + * Get the originating viewer. For some events, this allows responding viewers to decide if the event applies to them + */ + public Viewer getOriginatingViewer() + { + return originatingViewer; + } + /** + * Get the viewer Item of the currently selected object. This is a clue when we want to + * expand and select only the specific instance of this widget in this view. + */ + public Item getViewerItem() + { + return item; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemSignonInformation.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemSignonInformation.java new file mode 100644 index 00000000000..fb38eedb209 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemSignonInformation.java @@ -0,0 +1,121 @@ +/******************************************************************************** + * 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.model; + + +/** + * This class encapsulates the signon information required for a remote system. This class + * must be secure and never disclose the password for the remote system in its unencrypted form. + * However the encrypted form of the password is not considered secret information and can be + * accessed by anyone. + * + * @author yantzi + */ +public final class SystemSignonInformation { + + + private String _hostname, _userid, _systemType, _password; + + /** + * Default no-arg constructor + */ + public SystemSignonInformation() + { + } + + /** + * Constructor for SystemSignonInformation. + */ + public SystemSignonInformation(String hostname, String userid, String systemType) { + _hostname = hostname;//SystemPlugin.getQualifiedHostName(hostname).toUpperCase(); + _userid = userid; + _systemType = systemType; + } + + /** + * Constructor for SystemSignonInformation. + */ + public SystemSignonInformation(String hostname, String userid, String password, String systemType) { + _hostname = hostname;//SystemPlugin.getQualifiedHostName(hostname).toUpperCase(); + _userid = userid; + _password = password; + _systemType = systemType; + } + + /** + * Returns the hostname of the remote system + * @return String + */ + public String getHostname() { + return _hostname; + } + + /** + * Returns the systemType of the remote system + * @return String + */ + public String getSystemType() { + return _systemType; + } + + /** + * Returns the userid for the remote system + * @return String + */ + public String getUserid() { + return _userid; + } + + /** + * Return the password for the remote system + */ + public String getPassword() { + return _password; + } + + /** + * Sets the password for the remote system + */ + public void setPassword(String string) { + _password = string; + } + + /** + * Sets the hostname. + * @param hostname The hostname to set + */ + public void setHostname(String hostname) { + _hostname = hostname;//SystemPlugin.getQualifiedHostName(hostname).toUpperCase(); + } + + /** + * Sets the systemType. + * @param systemType The systemType to set + */ + public void setSystemType(String systemType) { + _systemType = systemType; + } + + /** + * Sets the userid. + * @param userid The userid to set + */ + public void setUserid(String userid) { + _userid = userid; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemStartHere.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemStartHere.java new file mode 100644 index 00000000000..523d0baf806 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemStartHere.java @@ -0,0 +1,176 @@ +/******************************************************************************** + * 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.model; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.internal.model.SystemProfileManager; + + +/** + * It all begins RIGHT HERE! + */ +public class SystemStartHere +{ + /** + * STEP 1. Get system registry singleton + *

    + * SAME AS: SystemPlugin.getTheSystemRegistry + */ + public static ISystemRegistry getSystemRegistry() + { + return SystemPlugin.getTheSystemRegistry(); + } + + /** + * STEP 2a. Get connections for all system types + *

    + * SAME AS: getSystemRegistry().getConnections() + * @see #getConnectionsBySystemType(String) + */ + public static IHost[] getConnections() + { + return getSystemRegistry().getHosts(); + } + + /** + * STEP 2b. Get all connections for the given system type. + *

    + * SAME AS: getSystemRegistry().getConnectionsBySystemType(systemType) + * @param systemType One of the system types defined via system type extension point: + *

      + *
    • "iSeries" + *
    • "Windows" + *
    • "z/OS" + *
    • "Unix" + *
    • "Linux" + *
    • "Local" + *
    + * @see org.eclipse.rse.core.ISystemTypes + * @see org.eclipse.rse.model.ISystemRegistry#getHostsBySystemType(String) + */ + public static IHost[] getConnectionsBySystemType(String systemType) + { + return getSystemRegistry().getHostsBySystemType(systemType); + } + + /** + * STEP 2c. Get all connections for your subsystem factory + *

    + * SAME AS: getSystemRegistry().getConnectionsBySubSystemFactory(factory) + * @param factory A subsystem factory object. + * @see org.eclipse.rse.model.ISystemRegistry#getHostsBySubSystemConfiguration(ISubSystemConfiguration) + * @see #getConnectionsBySubSystemFactory(String) + */ + public static IHost[] getConnectionsBySubSystemFactory(ISubSystemConfiguration factory) + { + return getSystemRegistry().getHostsBySubSystemConfiguration(factory); + } + /** + * STEP 2d. Get all connections for your subsystem factory, identified by factory Id. + *

    + * SAME AS: getSystemRegistry().getConnectionsBySubSystemFactory(getSubSystemFactory(factoryId)) + * @param factoryId The id of the subsystem factory as given in its plugin.xml id attribute for the subsystemconfiguration extension point + * @see #getSubSystemFactory(String) + * @see #getConnectionsBySubSystemFactory(ISubSystemConfiguration) + */ + public static IHost[] getConnectionsBySubSystemFactory(String factoryId) + { + return getSystemRegistry().getHostsBySubSystemConfiguration(getSubSystemFactory(factoryId)); + } + + /** + * STEP 3a. Get all subsystems for all connections for your subsystem factory, identified by factory Id. + *

    + * SAME AS: getSystemRegistry().getSubSystems(factoryId) + * @param factoryId The subsystem factory id as given in its plugin.xml id attribute for the subsystemconfiguration extension point + * @see org.eclipse.rse.model.ISystemRegistry#getSubSystems(String) + * @see org.eclipse.rse.core.subsystems.ISubSystemConfiguration#getId() + */ + public static ISubSystem[] getSubSystems(String factoryId) + { + return getSystemRegistry().getSubSystems(factoryId); + } + /** + * STEP 3b. Get all subsystems for the given connection for your subsystem factory, identified by factory Id. + *

    + * SAME AS: getSystemRegistry().getSubSystems(factoryId, connection) + * @param factoryId The subsystem factory id as given in its plugin.xml id attribute for the subsystemconfiguration extension point + * @param connection The connection object you wish to get the subsystems for. Typically there is only one subsystem per object. + * @see org.eclipse.rse.model.ISystemRegistry#getSubSystems(String, IHost) + * @see org.eclipse.rse.core.subsystems.ISubSystemConfiguration#getId() + */ + public static ISubSystem[] getSubSystems(String factoryId, IHost connection) + { + return getSystemRegistry().getSubSystems(factoryId, connection); + } + /** + * STEP 3c. Same as {@link #getSubSystems(String,IHost)} by used when you know + * the subsystem factory only supports a single subsystem per connection. + * @param factoryId The subsystem factory id as given in its plugin.xml id attribute for the subsystemconfiguration extension point + * @param connection The connection object you wish to get the subsystems for. Typically there is only one subsystem per object. + * @see #getSubSystems(String, IHost) + * @see org.eclipse.rse.core.subsystems.ISubSystemConfiguration#getId() + */ + public static ISubSystem getSubSystem(String factoryId, IHost connection) + { + ISubSystem[] subsystems = getSystemRegistry().getSubSystems(factoryId, connection); + if ((subsystems == null) || (subsystems.length==0)) + return null; + else + return subsystems[0]; + } + + + + // ---------------------------- + // MISCELLANEOUS: + // ---------------------------- + /** + * Miscallenous Helper. Return the subsystem factory object for the given subsystem factory Id + *

    + * SAME AS: getSystemRegistry().getSubSystemFactory(factoryId) + * @param factoryId The id of the subsystem factory as given in its plugin.xml id attribute for the subsystemconfiguration extension point + */ + public static ISubSystemConfiguration getSubSystemFactory(String factoryId) + { + return getSystemRegistry().getSubSystemConfiguration(factoryId); + } + + /** + * Miscallenous Helper. Return singleton profile manager + * SAME AS: getSystemRegistry().getSystemProfileManager() + */ + public static ISystemProfileManager getSystemProfileManager() + { + return SystemProfileManager.getSystemProfileManager(); + } + + /** + * Return all active profiles. + *

    + * A team might have many profiles, at least one per developer. + * However, typically only one or two are activated at a time, and + * we only return connections for those which are active. + *

    + * SAME AS: getSystemRegistry().getActiveSystemProfiles() + */ + public static ISystemProfile[] getActiveSystemProfiles() + { + return getSystemRegistry().getActiveSystemProfiles(); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemWorkspaceResourceSet.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemWorkspaceResourceSet.java new file mode 100644 index 00000000000..6d412e488f1 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemWorkspaceResourceSet.java @@ -0,0 +1,41 @@ +/******************************************************************************** + * 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.model; +import java.util.List; + +import org.eclipse.core.resources.IResource; + + + +public class SystemWorkspaceResourceSet extends AbstractSystemResourceSet +{ + + public SystemWorkspaceResourceSet() + { + super(); + } + + public SystemWorkspaceResourceSet(List resources) + { + super(resources); + } + + public SystemWorkspaceResourceSet(IResource[] resources) + { + super(resources); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/internal/persistence/RSEPersistenceManager.java b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/internal/persistence/RSEPersistenceManager.java new file mode 100644 index 00000000000..75e5ac16987 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/internal/persistence/RSEPersistenceManager.java @@ -0,0 +1,427 @@ +/******************************************************************************** + * 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.internal.persistence; + +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.rse.core.SystemPlugin; +import org.eclipse.rse.core.SystemResourceManager; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider; +import org.eclipse.rse.internal.filters.SystemFilterPoolManager; +import org.eclipse.rse.internal.persistence.dom.RSEDOMExporter; +import org.eclipse.rse.internal.persistence.dom.RSEDOMImporter; +import org.eclipse.rse.logging.Logger; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemHostPool; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.model.ISystemProfileManager; +import org.eclipse.rse.persistence.DefaultRSEPersistenceProvider; +import org.eclipse.rse.persistence.IRSEPersistenceManager; +import org.eclipse.rse.persistence.IRSEPersistenceProvider; +import org.eclipse.rse.persistence.dom.RSEDOM; + + +public class RSEPersistenceManager implements IRSEPersistenceManager +{ + public static final int STATE_NONE = 0; + public static final int STATE_IMPORTING = 1; + public static final int STATE_EXPORTING = 2; + + private int _currentState = STATE_NONE; + + private RSEDOMExporter _exporter; + private RSEDOMImporter _importer; + private IRSEPersistenceProvider _persistenceProvider; + + public RSEPersistenceManager() + { + _exporter = RSEDOMExporter.getInstance(); + _importer = RSEDOMImporter.getInstance(); + } + + public void registerRSEPersistenceProvider(IRSEPersistenceProvider provider) + { + _persistenceProvider = provider; + } + + public IRSEPersistenceProvider getRSEPersistanceProvider() + { + if (_persistenceProvider == null) + { + _persistenceProvider = new DefaultRSEPersistenceProvider(); + } + return _persistenceProvider; + } + + + public boolean restore(ISystemProfileManager profileManager) + { + return load(profileManager); + } + + /** + * Restore a profile of a given name from disk... + */ + protected ISystemProfile restoreProfile(ISystemProfileManager mgr, String name) + throws Exception + { + /* + * FIXME String fileName = mgr.getRootSaveFileName(name); java.util.List + * ext = null;//FIXME + * getMOFHelpers().restore(SystemResourceManager.getProfileFolder(name),fileName); + * // should be exactly one profile... Iterator iList = ext.iterator(); + * SystemProfile profile = (SystemProfile)iList.next(); + * mgr.initialize(profile, name); return profile; + */ + return null; + } + + /** + * Save all profiles to disk + */ + public boolean commit(ISystemProfileManager profileManager) + { + + ISystemProfile[] profiles = profileManager.getSystemProfiles(); + for (int idx = 0; idx < profiles.length; idx++) + { + try + { + commit(profiles[idx]); + } + catch (Exception exc) + { + exc.printStackTrace(); + System.out.println("Error saving profile " + profiles[idx] + + ": " + exc.getClass().getName() + " " + + exc.getMessage()); + return false; + } + } + + return true; + } + + + + public boolean restore(ISystemHostPool connectionPool) + { + return false; + } + + /** + * Restore a connection of a given name from disk... + */ + protected IHost restoreHost(ISystemHostPool hostPool, String connectionName) + throws Exception + { + /* + * FIXME //System.out.println("in SystemConnectionPoolImpl#restore for + * connection " + connectionName); String fileName = + * getRootSaveFileName(connectionName); + * //System.out.println(".......fileName = " + fileName); + * //System.out.println(".......folderName = " + + * getConnectionFolder(connectionName).getName()); java.util.List ext = + * getMOFHelpers().restore(getConnectionFolder(connectionName),fileName); + * // should be exactly one profile... Iterator iList = ext.iterator(); + * SystemConnection connection = (SystemConnection)iList.next(); if + * (connection != null) { if + * (!connection.getAliasName().equalsIgnoreCase(connectionName)) { + * SystemPlugin.logDebugMessage(this.getClass().getName(),"Incorrect + * alias name found in connections.xmi file for " + connectionName+". + * Name was reset"); connection.setAliasName(connectionName); // just in + * case! } internalAddConnection(connection); } return connection; + */ + return null; + } + + public boolean commit(ISystemHostPool connectionPool) + { + if (connectionPool.isDirty()) + { + commit(connectionPool.getSystemProfile()); + connectionPool.setDirty(false); + } + /* + Host[] connections = connectionPool.getHosts(); + for (int idx = 0; idx < connections.length; idx++) + { + if (!saveHost(connectionPool, connections[idx])) + { + return false; + } + } + return true; + */ + return false; // all persistance should be at profile level + } + + public boolean commit(ISystemFilterPoolManager filterPoolManager) + { + if (filterPoolManager.isDirty()) + { + commit(filterPoolManager.getSystemProfile()); + filterPoolManager.setDirty(false); + } + return false; + } + + public boolean commit(ISystemFilterPool filterPool) + { + if (filterPool.isDirty()) + { + commit(filterPool.getSystemFilterPoolManager().getSystemProfile()); + filterPool.setDirty(false); + } + return false; + } + + public boolean restore(ISystemFilterPool filterPool) + { + System.out.println("restore filterpool"); + // TODO Auto-generated method stub + return false; + } + + + public boolean commit(ISystemFilter filter) + { + System.out.println("commit filter"); + /* + if (filter.isDirty()) + { + System.out.println("saving filter: "+filter.getName()); + filter.setDirty(false); + } + */ + /* FIXME + //initMOF(); assume caller did this! + String fileName = getRootSaveFileName(this); + IFolder folder = getFolder(this); + getMOFHelpers().save(folder,fileName, this); + */ + return false; + } + + public ISystemFilterPool restoreFilterPool(String name) + { + System.out.println("restore filter pool "+name); + // FIXME + return null; + } + + public boolean commit(ISubSystem subSystem) + { + + if (subSystem.isDirty()) + { + // System.out.println("updated " + subSystem.getName()); + try + { + // commit everything for now + ISystemProfileManager mgr = SystemPlugin.getTheSystemRegistry().getSystemProfileManager(); + commit(mgr); + subSystem.setDirty(false); + } + catch (Exception e) + { + e.printStackTrace(); + } + return true; + } + + /* + // FIXME + if (subSystem.isDirty()) + { + System.out.println("saving subsystem: "+subSystem.getName()); + } + */ + return false; + } + + + /** + * Restore the filter pools from disk. + * @param logger The logging object to log errors to + * @param mgrFolder folder containing filter pool folders, or single file for that save policy + * @param name the name of the manager to restore. File name is derived from it when saving to one file. + * @param savePolicy How to persist filters. See SystemFilterConstants. + * @param namingPolicy Naming prefix information for persisted data file names. + * @return the restored manager, or null if it does not exist. If anything else went + * wrong, an exception is thrown. + */ + public ISystemFilterPoolManager restoreFilterPoolManager(ISystemProfile profile, Logger logger, ISystemFilterPoolManagerProvider caller, String name) + { + + ISystemFilterPoolManager mgr = SystemFilterPoolManager.createManager(profile); + ((SystemFilterPoolManager)mgr).initialize(logger,caller,name); // core data + + return mgr; + } + + /** + * Attempt to save single profile to disk. + */ + public boolean commit(ISystemProfile profile) + { + if (profile != null) + { + String name = profile.getName(); + return save(profile, false); + } + return false; + } + + /** + * Loads and restores RSE artifacts from the last session + * @param profileManager + * @return + */ + public boolean load(ISystemProfileManager profileManager) + { + boolean successful = true; + if (isExporting() || isImporting()) + { + successful = false; + } + else + { + _currentState = STATE_IMPORTING; + IProject project = SystemResourceManager.getRemoteSystemsProject(); + + try + { + project.refreshLocal(IResource.DEPTH_ONE, null); + IResource[] folders = project.members(); + for (int f = 0; f < folders.length; f++) + { + + if (folders[f] instanceof IFolder) + { + IFolder folder = (IFolder)folders[f]; + IResource[] members = folder.members(); + for (int i = 0; i < members.length; i++) + { + IResource member = members[i]; + + if (member instanceof IFile && member.getFileExtension().equals("rsedom")) + { + String name = member.getName(); + String domName = member.getName().substring(0, name.length() - 7); + // read and restore dom + RSEDOM dom = importRSEDOM(profileManager, domName); + if (dom != null) + { + ISystemProfile restoredProfile = _importer.restoreProfile(profileManager, dom); + if (restoredProfile == null) + { + successful = false; + } + } + else + { + successful = false; + } + } + } + } + } + } + catch (Exception e) + { + e.printStackTrace(); + } + _currentState = STATE_NONE; + } + return successful; + } + + /** + * Saves the RSE artifacts from this session + */ + public boolean save(ISystemProfile profile, boolean force) + { + boolean result = false; + if (!isImporting() && !isExporting()) + { + + RSEDOM dom = exportRSEDOM(profile, force); + if (dom.needsSave() && !dom.saveScheduled()) + { + + IProject project = SystemResourceManager.getRemoteSystemsProject(); + + SaveRSEDOMJob job = new SaveRSEDOMJob(this, dom, getRSEPersistanceProvider()); + //job.setRule(project); + job.schedule(); + dom.markSaveScheduled(); + } + else + { + System.out.println("no save required"); + result = true; + } + } + return result; + } + + public boolean isExporting() + { + return _currentState == STATE_EXPORTING; + } + + public boolean isImporting() + { + return _currentState == STATE_IMPORTING; + } + + public void setState(int state) + { + _currentState = state; + } + + public RSEDOM exportRSEDOM(ISystemProfile profile, boolean force) + { + RSEDOM dom = null; + _currentState = STATE_EXPORTING; + dom = _exporter.createRSEDOM(profile, force); + + return dom; + } + + public RSEDOM importRSEDOM(ISystemProfileManager profileManager, String domName) + { + RSEDOM dom = getRSEPersistanceProvider().loadRSEDOM(profileManager, domName, null); + return dom; + } + + + public boolean commit(IHost host) + { + return commit(host.getSystemProfile()); + } + + + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/internal/persistence/SaveRSEDOMJob.java b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/internal/persistence/SaveRSEDOMJob.java new file mode 100644 index 00000000000..2db0e86e9fe --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/internal/persistence/SaveRSEDOMJob.java @@ -0,0 +1,57 @@ +/******************************************************************************** + * 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.internal.persistence; + +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.persistence.IRSEPersistenceProvider; +import org.eclipse.rse.persistence.dom.RSEDOM; + + + +public class SaveRSEDOMJob extends Job +{ + private RSEPersistenceManager _mgr; + private RSEDOM _dom; + private IRSEPersistenceProvider _provider; + + public SaveRSEDOMJob(RSEPersistenceManager mgr, RSEDOM dom, IRSEPersistenceProvider provider) + { + super("Saving RSE Profile: " + dom.getName()); + _dom = dom; + _mgr = mgr; + _provider = provider; + } + + protected IStatus run(IProgressMonitor monitor) + { + if (_dom.needsSave()) + { + _provider.saveRSEDOM(_dom, monitor); + _dom.markUpdated(); + _mgr.setState(RSEPersistenceManager.STATE_NONE); + return Status.OK_STATUS; + } + else + { + return Status.CANCEL_STATUS; + } + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/internal/persistence/dom/RSEDOMExporter.java b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/internal/persistence/dom/RSEDOMExporter.java new file mode 100644 index 00000000000..0cb7a5f5215 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/internal/persistence/dom/RSEDOMExporter.java @@ -0,0 +1,478 @@ +/******************************************************************************** + * 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.internal.persistence.dom; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +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.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; +import org.eclipse.rse.filters.ISystemFilterString; +import org.eclipse.rse.internal.model.IPropertyType; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.IPropertySet; +import org.eclipse.rse.model.IRSEModelObject; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.persistence.dom.IRSEDOMConstants; +import org.eclipse.rse.persistence.dom.IRSEDOMExporter; +import org.eclipse.rse.persistence.dom.RSEDOM; +import org.eclipse.rse.persistence.dom.RSEDOMNode; + + +public class RSEDOMExporter implements IRSEDOMExporter +{ + private static RSEDOMExporter _instance = new RSEDOMExporter(); + private Map _domMap; + + protected RSEDOMExporter() + { + _domMap = new HashMap(); + } + + public static RSEDOMExporter getInstance() + { + return _instance; + } + + /** + * Returns the RSEDOM for this profile iff it exists + * @param profile + * @return + */ + public RSEDOM getRSEDOM(ISystemProfile profile) + { + return (RSEDOM)_domMap.get(profile); + } + + /** + * Creates the RSE DOM for this profile + * @param profile + * @param clean indicates whether to create from scratch or merge with existing + * @return + */ + public RSEDOM createRSEDOM(ISystemProfile profile, boolean clean) + { + RSEDOM dom = getRSEDOM(profile); + if (dom == null) + { + dom = new RSEDOM(profile); + _domMap.put(profile, dom); + clean = true; + } + populateRSEDOM(dom, profile, clean); + + return dom; + } + + /** + * Creates an RSE DOM for use in persistance + * @param dom + * @param profile + * @return + */ + public RSEDOM populateRSEDOM(RSEDOM dom, ISystemProfile profile, boolean clean) + { + // for now we do complete refresh + // clean dom for fresh creation + if (clean) + { + dom.clearChildren(); + } + + if (clean || profile.isDirty() || dom.isDirty()) + { + dom.clearAttributes(); + + dom.addAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT_PRIVATE, getBooleanString(profile.isDefaultPrivate())); + dom.addAttribute(IRSEDOMConstants.ATTRIBUTE_IS_ACTIVE, getBooleanString(profile.isActive())); + } + + // create the dom using the profile + + // create filter pool nodes + ISystemFilterPool[] filterPools = profile.getFilterPools(); + for (int i = 0; i < filterPools.length; i++) + { + ISystemFilterPool pool = filterPools[i]; + createNode(dom, pool, clean); + } + + // create hosts nodes + + // old nodes to compare with + RSEDOMNode[] oldHostNodes = null; + if (!clean) + { + oldHostNodes = dom.getChildren(IRSEDOMConstants.TYPE_HOST); + } + + List missingNodes = new ArrayList(); + if (!clean) + { + for (int o = 0; o < oldHostNodes.length; o++) + { + missingNodes.add(oldHostNodes[o]); + } + } + + IHost[] hosts = profile.getHosts(); + for (int j = 0; j < hosts.length; j++) + { + IHost host = hosts[j]; + RSEDOMNode hnode = createNode(dom, host, clean); + + if (!clean) + { + // remove this one from the missing list + missingNodes.remove(hnode); + } + } + + if (!clean) + { + // remaining missingNodes are probably deleted now + for (int x = 0; x < missingNodes.size(); x++) + { + dom.removeChild((RSEDOMNode)missingNodes.get(x)); + } + } + + // create generic property set nodes + createPropertySetNodes(dom, profile, clean); + dom.setDirty(false); + + return dom; + } + + /** + * Creates DOM nodes for each associated property set + * @param parent + * @param modelObject + * @return + */ + public RSEDOMNode[] createPropertySetNodes(RSEDOMNode parent, IRSEModelObject modelObject, boolean clean) + { + IPropertySet[] propertySets = modelObject.getPropertySets(); + for (int i = 0; i < propertySets.length; i++) + { + IPropertySet set = propertySets[i]; + RSEDOMNode node = new RSEDOMNode(parent, IRSEDOMConstants.TYPE_PROPERTY_SET, set.getName()); + String[] keys = set.getPropertyKeys(); + for (int k = 0; k < keys.length; k++) + { + String key = keys[k]; + String value = set.getPropertyValue(key); + IPropertyType type = set.getPropertyType(key); + node.addAttribute(key, value, type.toString()); + + + } + + } + return parent.getChildren(); + } + + /** + * Create a DOM node representing a filter pool + * @param parent + * @param filterPool + * @return + */ + public RSEDOMNode createNode(RSEDOMNode parent, ISystemFilterPool filterPool, boolean clean) + { + RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_FILTER_POOL, filterPool, clean); + + if (clean || node.isDirty()) + { + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, filterPool.getType()); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_ID, filterPool.getId()); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_NESTED_FILTERS, getBooleanString(filterPool.supportsNestedFilters())); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DELETABLE, getBooleanString(filterPool.isDeletable())); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT, getBooleanString(filterPool.isDefault())); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_STRING_CASE_SENSITIVE, getBooleanString(filterPool.isSetStringsCaseSensitive())); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_DUPLICATE_FILTER_STRINGS,getBooleanString(filterPool.supportsDuplicateFilterStrings())); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_RELEASE, ""+filterPool.getRelease()); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY, getBooleanString(filterPool.isSetSingleFilterStringOnly())); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_OWNING_PARENT_NAME, filterPool.getOwningParentName()); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_NON_RENAMABLE, getBooleanString(filterPool.isNonRenamable())); + } + + ISystemFilter[] filters = filterPool.getSystemFilters(); + for (int i = 0; i < filters.length; i++) + { + createNode(node, filters[i], clean); + } + createPropertySetNodes(node, filterPool, clean); + node.setDirty(false); + return node; + } + + /** + * Creates a DOM node for a filter + * @param parent + * @param filter + * @return + */ + public RSEDOMNode createNode(RSEDOMNode parent, ISystemFilter filter, boolean clean) + { + RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_FILTER, filter, clean); + + if (clean || node.isDirty()) + { + // add attributes + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_ID, filter.getName()); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_NESTED_FILTERS, getBooleanString(filter.isSupportsNestedFilters())); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_RELATIVE_ORDER, "" + filter.getRelativeOrder()); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT, getBooleanString(filter.isDefault())); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_STRING_CASE_SENSITIVE, getBooleanString(filter.isSetStringsCaseSensitive())); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_PROMPTABLE, getBooleanString(filter.isPromptable())); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_DUPLICATE_FILTER_STRINGS,getBooleanString(filter.supportsDuplicateFilterStrings())); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_NON_DELETABLE, getBooleanString(filter.isNonDeletable())); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_NON_RENAMABLE, getBooleanString(filter.isNonRenamable())); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_NON_CHANGEABLE, getBooleanString(filter.isNonChangable())); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_STRINGS_NON_CHANGABLE, getBooleanString(filter.isStringsNonChangable())); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_RELEASE, ""+filter.getRelease()); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY, getBooleanString(filter.isSetSingleFilterStringOnly())); + } + + // add nested filters + ISystemFilter[] nestedFilters = filter.getSystemFilters(); + for (int i = 0; i < nestedFilters.length; i++) + { + createNode(node, nestedFilters[i], clean); + } + + // add filter strings + ISystemFilterString[] filterStrings = filter.getSystemFilterStrings(); + for (int j = 0; j < filterStrings.length; j++) + { + createNode(node, filterStrings[j], clean); + } + + createPropertySetNodes(node, filter, clean); + node.setDirty(false); + return node; + } + + /** + * Creates a DOM node for a filter string + * @param parent + * @param filterString + * @return + */ + public RSEDOMNode createNode(RSEDOMNode parent, ISystemFilterString filterString, boolean clean) + { + RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_FILTER_STRING, filterString, clean); + + if (clean || node.isDirty()) + { + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_STRING, filterString.getString()); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, filterString.getType()); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT, getBooleanString(filterString.isDefault())); + } + + createPropertySetNodes(node, filterString, clean); + return node; + } + + /** + * Create a DOM node representing a host + * @param parent + * @param host + * @return + */ + public RSEDOMNode createNode(RSEDOMNode parent, IHost host, boolean clean) + { + RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_HOST, host, clean); + + if (clean || node.isDirty()) + { + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, host.getSystemType()); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_OFFLINE, getBooleanString(host.isOffline())); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_PROMPTABLE, getBooleanString(host.isPromptable())); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_HOSTNAME, host.getHostName()); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DESCRIPTION, host.getDescription()); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_USER_ID, host.getDefaultUserId()); + } + + + IConnectorService[] connectorServices = host.getConnectorServices(); + for (int i = 0; i < connectorServices.length; i++) + { + IConnectorService service = connectorServices[i]; + createNode(node, service, clean); + } + + + createPropertySetNodes(node, host, clean); + node.setDirty(false); + return node; + } + + + /** + * Creates a DOM node for a connector service + * @param parent + * @param connectorService + * @return + */ + public RSEDOMNode createNode(RSEDOMNode parent, IConnectorService connectorService, boolean clean) + { + RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_CONNECTOR_SERVICE, connectorService, clean); + if (clean || node.isDirty()) + { + // store it's attributes + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, connectorService.getHostType()); + + + // can't do this til connector service owns the properties (right now it's still subsystem) + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_GROUP, connectorService.getName()); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_USE_SSL, getBooleanString(connectorService.isUsingSSL())); + } + // store the server launcher + // right now subsystem still owns the server launchers + // that will change later + + IServerLauncherProperties serverLauncher = connectorService.getRemoteServerLauncherProperties(); + if (serverLauncher != null) + { + createNode(node, serverLauncher, clean); + } + + // store each subsystem + ISubSystem[] subSystems = connectorService.getSubSystems(); + for (int i = 0; i < subSystems.length; i++) + { + createNode(node, subSystems[i], clean); + } + + createPropertySetNodes(node, connectorService, clean); + node.setDirty(false); + return node; + } + + /** + * Creates a DOM node for a server launcher + * @param parent + * @param serverLauncher + * @return + */ + public RSEDOMNode createNode(RSEDOMNode parent, IServerLauncherProperties serverLauncher, boolean clean) + { + RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_SERVER_LAUNCHER, serverLauncher, clean); + + if (clean || node.isDirty()) + { + } + + serverLauncher.saveToProperties(); + createPropertySetNodes(node, serverLauncher, clean); + return node; + } + + /** + * Creates a DOM node for a subsystem + * @param parent + * @param subSystem + * @return + */ + public RSEDOMNode createNode(RSEDOMNode parent, ISubSystem subSystem, boolean clean) + { + RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_SUBSYSTEM, subSystem, clean); + + if (clean || node.isDirty()) + { + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_HIDDEN, getBooleanString(subSystem.isHidden())); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, subSystem.getSubSystemConfiguration().getId()); + } + + // create filter pool reference nodes + ISystemFilterPoolReferenceManager refMgr = subSystem.getFilterPoolReferenceManager(); + if (refMgr != null) + { + ISystemFilterPoolReference[] references = refMgr.getSystemFilterPoolReferences(); + for (int i = 0; i < references.length; i++) + { + ISystemFilterPoolReference ref = references[i]; + createNode(node, ref, clean); + } + } + + createPropertySetNodes(node, subSystem, clean); + node.setDirty(false); + return node; + } + + /** + * Creates a DOM node for a filter pool reference + * @param parent + * @param filterPoolReference + * @return + */ + public RSEDOMNode createNode(RSEDOMNode parent, ISystemFilterPoolReference filterPoolReference, boolean clean) + { + RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_FILTER_POOL_REFERENCE, filterPoolReference, clean); + + if (clean || node.isDirty()) + { + ISystemFilterPool filterPool = filterPoolReference.getReferencedFilterPool(); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_REF_ID, filterPool.getId()); + } + + createPropertySetNodes(node, filterPoolReference, clean); + node.setDirty(false); + return node; + } + + private RSEDOMNode findOrCreateNode(RSEDOMNode parent, String type, IRSEModelObject modelObject, boolean clean) + { + RSEDOMNode node = null; + String name = modelObject.getName(); + if (!clean) + { + node = parent.getChild(type,name); + if (node != null && modelObject.isDirty()) + { + node.clearAttributes(); + node.setDirty(true); + } + } + boolean newNode = (node == null); + if (newNode) + { + node = new RSEDOMNode(parent, type, name); + } + return node; + } + + /** + * Helper to get either "true" or "false" based on boolean flag + * @param flag + * @return + */ + private String getBooleanString(boolean flag) + { + return flag ? IRSEDOMConstants.ATTRIBUTE_TRUE : IRSEDOMConstants.ATTRIBUTE_FALSE; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java new file mode 100644 index 00000000000..44245447689 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java @@ -0,0 +1,537 @@ +/******************************************************************************** + * 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.internal.persistence.dom; + +import java.util.Vector; + +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.internal.subsystems.SubSystemFilterNamingPolicy; +import org.eclipse.rse.core.servicesubsystem.IServiceSubSystem; +import org.eclipse.rse.core.servicesubsystem.IServiceSubSystemConfiguration; +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.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterConstants; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; +import org.eclipse.rse.filters.ISystemFilterString; +import org.eclipse.rse.filters.SystemFilterStartHere; +import org.eclipse.rse.internal.filters.SystemFilterPool; +import org.eclipse.rse.internal.model.IPropertyType; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.IPropertySet; +import org.eclipse.rse.model.IRSEModelObject; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.model.ISystemProfileManager; +import org.eclipse.rse.model.PropertyType; +import org.eclipse.rse.persistence.dom.IRSEDOMConstants; +import org.eclipse.rse.persistence.dom.IRSEDOMImporter; +import org.eclipse.rse.persistence.dom.RSEDOM; +import org.eclipse.rse.persistence.dom.RSEDOMNode; +import org.eclipse.rse.persistence.dom.RSEDOMNodeAttribute; + + +public class RSEDOMImporter implements IRSEDOMImporter +{ + private static RSEDOMImporter _instance = new RSEDOMImporter(); + + + public static RSEDOMImporter getInstance() + { + return _instance; + } + + public RSEDOMImporter() + { + } + + + /** + * Restores the profile represented by dom + * @param profileManager + * @param dom + * @return the restored profile + */ + public ISystemProfile restoreProfile(ISystemProfileManager profileManager, RSEDOM dom) + { + // create the profile + String profileName = dom.getName(); + boolean defaultPrivate = getBooleanValue(dom.getAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT_PRIVATE).getValue()); + boolean isActive = getBooleanValue(dom.getAttribute(IRSEDOMConstants.ATTRIBUTE_IS_ACTIVE).getValue()); + ISystemProfile profile = profileManager.createSystemProfile(profileName, isActive); + + + if (profile != null) + { + profile.setDefaultPrivate(defaultPrivate); + profileManager.makeSystemProfileActive(profile, isActive); + // restore the children for the profile + RSEDOMNode[] children = dom.getChildren(); + for (int i = 0;i < children.length; i++) + { + RSEDOMNode child = children[i]; + String type = child.getType(); + if (type.equals(IRSEDOMConstants.TYPE_HOST)) + { + restoreHost(profile, child); + } + else if (type.equals(IRSEDOMConstants.TYPE_FILTER_POOL)) + { + restoreFilterPool(profile, child); + } + else if (type.equals(IRSEDOMConstants.TYPE_PROPERTY_SET)) + { + restorePropertySet(profile, child); + } + } + } + return profile; + } + + /** + * Restores the host represented by hostNode + */ + public IHost restoreHost(ISystemProfile profile, RSEDOMNode hostNode) + { + IHost host = null; + + // get host node attributes + String connectionName = hostNode.getName(); + String systemType = hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue(); + String hostName = hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_HOSTNAME).getValue(); + String description = hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_DESCRIPTION).getValue(); + boolean isOffline = getBooleanValue(hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_OFFLINE).getValue()); + boolean isPromptable = getBooleanValue(hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_PROMPTABLE).getValue()); + String userId = hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_USER_ID).getValue(); + + // create host and set it's attributes + try + { + // NOTE create host effectively recreates the subsystems + // so instead of creating subsystems on restore, we should be updating their properties + host = profile.createHost(systemType, connectionName, hostName, description); + host.setOffline(isOffline); + host.setPromptable(isPromptable); + host.setDefaultUserId(userId); + } + catch (Exception e) + { + e.printStackTrace(); + } + + // restore children of host + RSEDOMNode[] children = hostNode.getChildren(); + for (int i = 0;i < children.length; i++) + { + RSEDOMNode child = children[i]; + String type = child.getType(); + if (type.equals(IRSEDOMConstants.TYPE_CONNECTOR_SERVICE)) + { + restoreConnectorService(host, child); + } + else if (type.equals(IRSEDOMConstants.TYPE_PROPERTY_SET)) + { + restorePropertySet(profile, child); + } + } + + return host; + } + + /** + * Restore the connector service represented by connectorServiceNode + */ + public IConnectorService restoreConnectorService(IHost host, RSEDOMNode connectorServiceNode) + { + // TODO - this should come before subsystems + // but currently we're still using old way of creating subsystem first + IConnectorService service = null; + + // get attributes of the service + String name = connectorServiceNode.getName(); + String type = connectorServiceNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue(); + String group = connectorServiceNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_GROUP).getValue(); + boolean useSSL = getBooleanValue(connectorServiceNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_USE_SSL).getValue()); + + + + // first restore subsystems (since right now we need subsystem to get at service + RSEDOMNode[] ssChildren = connectorServiceNode.getChildren(IRSEDOMConstants.TYPE_SUBSYSTEM); + for (int s = 0; s < ssChildren.length; s++) + { + RSEDOMNode ssChild = ssChildren[s]; + ISubSystem subSystem = restoreSubSystem(host, ssChild); + if (subSystem != null && service == null) + { + ISubSystemConfiguration factory = subSystem.getSubSystemConfiguration(); + service = factory.getConnectorService(host); + if (service != null) + { + if (factory.supportsServerLaunchProperties(host)) + { + IServerLauncherProperties sl = factory.createServerLauncher(service); + if (sl != null) + { + // get server launcher properties + // right now we just set them for subsystem, but later that will change + RSEDOMNode serverLauncherPropertiesNode = null; + RSEDOMNode[] slChildren = connectorServiceNode.getChildren(IRSEDOMConstants.TYPE_SERVER_LAUNCHER); + if (slChildren != null && slChildren.length > 0) + { + serverLauncherPropertiesNode = slChildren[0]; + restoreServerLauncher(service, serverLauncherPropertiesNode, sl); + } + } + } + + service.setIsUsingSSL(useSSL); + } + } + if (service != null && subSystem != null) + { + subSystem.setConnectorService(service); + } + } + + + + // restore all property sets + RSEDOMNode[] psChildren = connectorServiceNode.getChildren(IRSEDOMConstants.TYPE_PROPERTY_SET); + for (int p = 0;p < psChildren.length; p++) + { + RSEDOMNode psChild = psChildren[p]; + restorePropertySet(service, psChild); + } + return service; + } + + public IServerLauncherProperties restoreServerLauncher(IConnectorService service, RSEDOMNode serverLauncherNode, IServerLauncherProperties sl) + { +// restore all property sets + RSEDOMNode[] psChildren = serverLauncherNode.getChildren(IRSEDOMConstants.TYPE_PROPERTY_SET); + for (int p = 0;p < psChildren.length; p++) + { + RSEDOMNode psChild = psChildren[p]; + restorePropertySet(sl, psChild); + } + sl.restoreFromProperties(); + service.setRemoteServerLauncherProperties(sl); + return sl; + } + + /** + * Restores the subsystem represented by subSystemNode + */ + public ISubSystem restoreSubSystem(IHost host, RSEDOMNode subSystemNode) + { + // in most cases (if not all) the subsystem already exists + // since createHost() ends up recreating subsystems for each factory + String name = subSystemNode.getName(); + String type = subSystemNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue(); + boolean isHidden = getBooleanValue(subSystemNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_HIDDEN).getValue()); + ISubSystem subSystem = null; + ISubSystemConfiguration factory = getFactoryFor(type); + if (factory != null) + { + if (factory instanceof IServiceSubSystemConfiguration) + { + IServiceSubSystemConfiguration serviceFactory = (IServiceSubSystemConfiguration)factory; + ISubSystem[] existingSubSystems = SystemPlugin.getTheSystemRegistry().getServiceSubSystems(serviceFactory.getServiceType(), host); + if (existingSubSystems != null && existingSubSystems.length > 0) + { + subSystem = existingSubSystems[0]; + // need to switch factories + ((IServiceSubSystem)subSystem).switchServiceFactory(serviceFactory); + } + } + else + { + ISubSystem[] existingSubSystems = SystemPlugin.getTheSystemRegistry().getSubSystems(type, host); + + if (existingSubSystems != null && existingSubSystems.length > 0) + { + subSystem = existingSubSystems[0]; + } + } + + if (subSystem == null) + { + subSystem = factory.createSubSystemInternal(host); + } + subSystem.setHidden(isHidden); + subSystem.setName(name); + subSystem.setHost(host); + subSystem.setSubSystemConfiguration(factory); + subSystem.setWasRestored(true); + + + if (factory.supportsFilters()) + { + ISystemFilterPoolReferenceManager fprMgr = SystemFilterStartHere.createSystemFilterPoolReferenceManager(subSystem, factory, name, new SubSystemFilterNamingPolicy()); + subSystem.setFilterPoolReferenceManager(fprMgr); + ISystemFilterPoolManager defaultFilterPoolManager = factory.getFilterPoolManager(host.getSystemProfile()); + fprMgr.setDefaultSystemFilterPoolManager(defaultFilterPoolManager); + } + + + + // restore filer pool references + RSEDOMNode[] filterPoolReferenceChildren = subSystemNode.getChildren(IRSEDOMConstants.TYPE_FILTER_POOL_REFERENCE); + for (int i = 0; i < filterPoolReferenceChildren.length; i++) + { + RSEDOMNode fprChild = filterPoolReferenceChildren[i]; + restoreFilterPoolReference(subSystem, fprChild); + } + + // restore all property sets + RSEDOMNode[] psChildren = subSystemNode.getChildren(IRSEDOMConstants.TYPE_PROPERTY_SET); + for (int p = 0;p < psChildren.length; p++) + { + RSEDOMNode psChild = psChildren[p]; + restorePropertySet(subSystem, psChild); + } + } + return subSystem; + } + + /** + * Restore the filter + */ + public ISystemFilter restoreFilter(ISystemFilterPool filterPool, RSEDOMNode node) + { + // get the node attributes for a filter + String name = node.getName(); + boolean supportsNestedFilters = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_NESTED_FILTERS).getValue()); + int relativeOrder = getIntegerValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_RELATIVE_ORDER).getValue()); + boolean isDefault = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT).getValue()); + boolean isSetStringsCaseSensitive = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_STRING_CASE_SENSITIVE).getValue()); + boolean isPromptable = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_PROMPTABLE).getValue()); + boolean isSetSupportsDuplicateFilterStrings = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_DUPLICATE_FILTER_STRINGS).getValue()); + boolean isNonDeletable = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_NON_DELETABLE).getValue()); + boolean isNonRenamable = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_NON_RENAMABLE).getValue()); + boolean isNonChangable = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_NON_CHANGEABLE).getValue()); + boolean isStringsNonChangable = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_STRINGS_NON_CHANGABLE).getValue()); + int release = getIntegerValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_RELEASE).getValue()); + boolean isSetSingleFilterStringOnly = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY).getValue()); + + Vector filterStrings = new Vector(); + + // create the filter strings + RSEDOMNode filterStringNodes[] = node.getChildren(IRSEDOMConstants.TYPE_FILTER_STRING); + for (int i = 0; i < filterStringNodes.length; i++) + { + RSEDOMNode filterStringNode = filterStringNodes[i]; + + // might not have to restore the filter strings this way + //restoreFilterString(filter, filterStringNode); + + filterStrings.add(filterStringNode.getName()); + } + + // create the filter + ISystemFilter filter = filterPool.createSystemFilter(name, filterStrings); + + filter.setWasRestored(true); + + // set filter attributes + filter.setSupportsNestedFilters(supportsNestedFilters); + filter.setRelativeOrder(relativeOrder); + filter.setDefault(isDefault); + filter.setStringsCaseSensitive(isSetStringsCaseSensitive); + filter.setPromptable(isPromptable); + filter.setSupportsDuplicateFilterStrings(isSetSupportsDuplicateFilterStrings); + filter.setNonDeletable(isNonDeletable); + filter.setNonChangable(isNonChangable); + filter.setNonRenamable(isNonRenamable); + filter.setStringsNonChangable(isStringsNonChangable); + filter.setRelease(release); + filter.setSingleFilterStringOnly(isSetSingleFilterStringOnly); + + // restore all property sets + RSEDOMNode[] psChildren = node.getChildren(IRSEDOMConstants.TYPE_PROPERTY_SET); + for (int p = 0;p < psChildren.length; p++) + { + RSEDOMNode psChild = psChildren[p]; + restorePropertySet(filter, psChild); + } + return filter; + } + + /** + * Restore the filter pool represented by the node + */ + public ISystemFilterPool restoreFilterPool(ISystemProfile profile, RSEDOMNode node) + { + ISystemFilterPool filterPool = null; + + // get the node attributes for a filter pool + String name = node.getName(); + String type = node.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue(); + String id = node.getAttribute(IRSEDOMConstants.ATTRIBUTE_ID).getValue(); + boolean supportsNestedFilters = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_NESTED_FILTERS).getValue()); + boolean isDeletable = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_DELETABLE).getValue()); + boolean isDefault = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT).getValue()); + boolean isSetStringsCaseSensitive = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_STRING_CASE_SENSITIVE).getValue()); + boolean isSetSupportsDuplicateFilterStrings = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_DUPLICATE_FILTER_STRINGS).getValue()); + int release = getIntegerValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_RELEASE).getValue()); + boolean isSetSingleFilterStringOnly = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY).getValue()); + String owningParentName = node.getAttribute(IRSEDOMConstants.ATTRIBUTE_OWNING_PARENT_NAME).getValue(); + boolean isNonRenamable = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_NON_RENAMABLE).getValue()); + + // create the filter pool and set it's attributes + try + { + ISubSystemConfiguration factory = getFactoryFor(id); + if (factory != null) + { + ISystemFilterPoolManager mgr = factory.getFilterPoolManager(profile); + if (isDefault) + { + filterPool = mgr.getFirstDefaultSystemFilterPool(); + } + else + { + filterPool = mgr.getSystemFilterPool(name); + } + if (filterPool == null) + { + filterPool = SystemFilterPool.createSystemFilterPool(name, + supportsNestedFilters, + isDeletable, + ISystemFilterConstants.TRY_TO_RESTORE_NO); + + if (filterPool != null) + { + filterPool.setSystemFilterPoolManager(mgr); + // add to model + mgr.getPools().add(filterPool); + } + } + filterPool.setType(type); + filterPool.setDefault(isDefault); + filterPool.setSupportsNestedFilters(supportsNestedFilters); + filterPool.setStringsCaseSensitive(isSetStringsCaseSensitive); + filterPool.setSupportsDuplicateFilterStrings(isSetSupportsDuplicateFilterStrings); + filterPool.setRelease(release); + filterPool.setSingleFilterStringOnly(isSetSingleFilterStringOnly); + filterPool.setOwningParentName(owningParentName); + filterPool.setNonRenamable(isNonRenamable); + + filterPool.setWasRestored(true); + } + } + catch (Exception e) + { + e.printStackTrace(); + } + + // restore children + RSEDOMNode[] children = node.getChildren(); + for (int i = 0;i < children.length; i++) + { + RSEDOMNode child = children[i]; + String ctype = child.getType(); + if (ctype.equals(IRSEDOMConstants.TYPE_FILTER)) + { + if (filterPool != null) + { + restoreFilter(filterPool, child); + } + } + else if (ctype.equals(IRSEDOMConstants.TYPE_PROPERTY_SET)) + { + restorePropertySet(filterPool, child); + } + } + return filterPool; + } + + /** + * Restore the filter pool reference that is represented by the node + */ + public ISystemFilterPoolReference restoreFilterPoolReference(ISubSystem subSystem, RSEDOMNode node) + { + ISystemFilterPoolReference filterPoolReference = null; + String refID = node.getAttribute(IRSEDOMConstants.ATTRIBUTE_REF_ID).getValue(); + String name = node.getName(); + + // find referenced filter pool + ISubSystemConfiguration factory = getFactoryFor(refID); + if (factory != null) + { + ISystemFilterPoolManager filterPoolManager = factory.getFilterPoolManager(subSystem.getSystemProfile()); + ISystemFilterPool filterPool = filterPoolManager.getSystemFilterPool(name); + + // create reference to the filterpool + ISystemFilterPoolReferenceManager referenceManager = subSystem.getFilterPoolReferenceManager(); + filterPoolReference = referenceManager.addReferenceToSystemFilterPool(filterPool); + + } + return filterPoolReference; + } + + public ISystemFilterString restoreFilterString(ISystemFilter filter, RSEDOMNode node) + { + /* + String string = node.getAttribute(IRSEDOMConstants.ATTRIBUTE_STRING).getValue(); + String type = node.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue(); + boolean isDefault = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT).getValue()); + + SystemFilterString filterString = filter + */ + return null;//not sure if we need this + } + + /** + * Restores the property set represented by propertySetNode + */ + public IPropertySet restorePropertySet(IRSEModelObject modelObject, RSEDOMNode propertySetNode) + { + String name = propertySetNode.getName(); + IPropertySet set = modelObject.createPropertySet(name); + RSEDOMNodeAttribute[] attributes = propertySetNode.getAttributes(); + for (int i = 0; i < attributes.length; i++) + { + RSEDOMNodeAttribute attribute = attributes[i]; + String typeStr = attribute.getType(); + IPropertyType type = new PropertyType(typeStr); + + set.addProperty(attribute.getKey(), attribute.getValue(), type); + + } + return set; + } + + private boolean getBooleanValue(String booleanStr) + { + return ((booleanStr != null) && booleanStr.equalsIgnoreCase(IRSEDOMConstants.ATTRIBUTE_TRUE)); + } + + private int getIntegerValue(String integerString) + { + return Integer.parseInt(integerString); + } + + private ISubSystemConfiguration getFactoryFor(String id) + { + return SystemPlugin.getTheSystemRegistry().getSubSystemConfiguration(id); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/DefaultRSEPersistenceProvider.java b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/DefaultRSEPersistenceProvider.java new file mode 100644 index 00000000000..9e3c0e9ced3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/DefaultRSEPersistenceProvider.java @@ -0,0 +1,138 @@ +/******************************************************************************** + * 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.persistence; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.OutputStream; + +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.core.runtime.IProgressMonitor; +import org.eclipse.rse.core.SystemResourceManager; +import org.eclipse.rse.model.ISystemProfileManager; +import org.eclipse.rse.persistence.dom.RSEDOM; + + +/** + * This is class is used to restore an RSE DOM from disk and import it into RSE. + * @author dmcknigh + * + */ +public class DefaultRSEPersistenceProvider implements IRSEPersistenceProvider +{ + + /** + * Restores a system profile in RSE. This API will likely change. + * + * @param profileManager + * @param profileFile the file representing the profile + * @return + */ + public RSEDOM loadRSEDOM(ISystemProfileManager profileManager, String domName, IProgressMonitor monitor) + { + RSEDOM dom = null; + IFile profileFile = getProfileFile(domName, monitor); + if (profileFile.exists()) + { + System.out.println("loading "+ profileFile.getLocation().toOSString() + "..."); + try + { + InputStream iStream = profileFile.getContents(); + + ObjectInputStream inStream = new ObjectInputStream(iStream); + dom = (RSEDOM)inStream.readObject(); + inStream.close(); + } + catch (Exception e) + { + e.printStackTrace(); + try + { + profileFile.delete(true, false, monitor); + } + catch (Exception e2) + { + e.printStackTrace(); + } + + } + } + return dom; + } + + protected IFile getProfileFile(String domName, IProgressMonitor monitor) + { + IProject project = SystemResourceManager.getRemoteSystemsProject(); + + // before loading, make sure the project is in synch + try + { + project.refreshLocal(IResource.DEPTH_INFINITE, monitor); + } + catch (Exception e) + { + } + + IFolder folder = project.getFolder(domName); + if (!folder.exists()) + { + try + { + folder.create(true, true, monitor); + } + catch (Exception e) + { + } + } + return folder.getFile(domName + ".rsedom"); + } + + /** + * Saves an RSE dom to disk. This API will likely change. + * @param dom + * @param profileFile + * @return true if succcessful + */ + public boolean saveRSEDOM(RSEDOM dom, IProgressMonitor monitor) + { + + IFile profileFile = getProfileFile(dom.getName(), monitor); + File osFile = profileFile.getLocation().toFile(); + System.out.println("saving "+ osFile.getAbsolutePath() + "..."); + try + { + OutputStream oStream = new FileOutputStream(osFile); + ObjectOutputStream outStream = new ObjectOutputStream(oStream); + outStream.writeObject(dom); + outStream.close(); + profileFile.getParent().refreshLocal(IResource.DEPTH_ONE, monitor); + } + catch (Exception e) + { + e.printStackTrace(); + return false; + } + + return true; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/IRSEPersistableContainer.java b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/IRSEPersistableContainer.java new file mode 100644 index 00000000000..35d95731ac8 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/IRSEPersistableContainer.java @@ -0,0 +1,28 @@ +/******************************************************************************** + * 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.persistence; + +public interface IRSEPersistableContainer +{ + public boolean isDirty(); + public void setDirty(boolean flag); + + public boolean commit(); + + public boolean wasRestored(); + public void setWasRestored(boolean flag); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/IRSEPersistenceManager.java b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/IRSEPersistenceManager.java new file mode 100644 index 00000000000..b6213540e35 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/IRSEPersistenceManager.java @@ -0,0 +1,125 @@ +/******************************************************************************** + * 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.persistence; + +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider; +import org.eclipse.rse.logging.Logger; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemHostPool; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.model.ISystemProfileManager; + + +public interface IRSEPersistenceManager +{ + /** + * Register the persistance provider to be used when saving and restoring RSE doms + * @param provider + */ + public void registerRSEPersistenceProvider(IRSEPersistenceProvider provider); + + /** + * Restore all profiles + * @param profileManager + * @return true if successful + */ + public boolean restore(ISystemProfileManager profileManager); + + /** + * Save all profiles + * @param profileManager + * @return true if successful + */ + public boolean commit(ISystemProfileManager profileManager); + + public boolean commit(IHost host); + + /** + * Restore all connections in the connection pool + * @param connectionPool + * @return true if successful + */ + public boolean restore(ISystemHostPool connectionPool); + + /** + * Save all connections in the connection pool + * @param connectionPool + * @return true if successful + */ + public boolean commit(ISystemHostPool connectionPool); + + public boolean commit(ISystemFilterPoolManager filterPoolManager); + /** + * Save all the filters in the filter pool + * @param filterPool + * @return true if successful + */ + public boolean commit(ISystemFilterPool filterPool); + + /** + * Save this filter + * @param filter + * @return true if successful + */ + public boolean commit(ISystemFilter filter); + + /** + * Restore all the filters for the filter pool + * @param filterPool + * @return true if sucessful + */ + public boolean restore(ISystemFilterPool filterPool); + + /** + * Restore the filter pool + * @param name + * @return the filter pool if successful + */ + public ISystemFilterPool restoreFilterPool(String name); + + + /** + * Save this subsystem + * @param subSystem + * @return true if successful + */ + public boolean commit(ISubSystem subSystem); + + /** + * Save this profile + * @param profile + * @return true if successful + */ + public boolean commit(ISystemProfile profile); + + public ISystemFilterPoolManager restoreFilterPoolManager(ISystemProfile profile, Logger logger, ISystemFilterPoolManagerProvider caller, String name); + + /** + * Save the profile externally + * @param profile + * @param clean indicates whether to create from scratch or merger + * @return + */ + public boolean save(ISystemProfile profile, boolean clean); + + public boolean isExporting(); + public boolean isImporting(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/IRSEPersistenceProvider.java b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/IRSEPersistenceProvider.java new file mode 100644 index 00000000000..1e84b74d1a0 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/IRSEPersistenceProvider.java @@ -0,0 +1,53 @@ +/******************************************************************************** + * 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.persistence; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.rse.model.ISystemProfileManager; +import org.eclipse.rse.persistence.dom.RSEDOM; + + +/** + * This is the interface that needs to be implemented when providing an extension + * using the RSE persistance provider extension point. + * + * Implement this class to provide a specialized means of + * saving and restoring RSEDOM + * + */ +public interface IRSEPersistenceProvider +{ + /** + * Restores an RSE DOM given a profileName. + * + * @param profileManager + * @param profileName name of the Profile to load + * @param monitor + * @return the RSE DOM for the specified profile + */ + public RSEDOM loadRSEDOM(ISystemProfileManager profileManager, String profileName, IProgressMonitor monitor); + + + /** + * Persists an RSE DOM. + * + * @param dom the RSE DOM to persist + * @param monitor + * @return true if succcessful + */ + public boolean saveRSEDOM(RSEDOM dom, IProgressMonitor monitor); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/IRSEDOMConstants.java b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/IRSEDOMConstants.java new file mode 100644 index 00000000000..dc80aac3969 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/IRSEDOMConstants.java @@ -0,0 +1,89 @@ +/******************************************************************************** + * 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.persistence.dom; + +public interface IRSEDOMConstants +{ + // node types + public static final String TYPE_PROFILE = "Profile"; + public static final String TYPE_PROPERTY_SET = "PropertySet"; + public static final String TYPE_PROPERTY = "Property"; + public static final String TYPE_HOST = "Host"; + public static final String TYPE_FILTER_POOL = "FilterPool"; + public static final String TYPE_FILTER = "Filter"; + public static final String TYPE_FILTER_STRING = "FilterString"; + public static final String TYPE_FILTER_POOL_REFERENCE = "FilterPoolReference"; + public static final String TYPE_CONNECTOR_SERVICE = "ConnectorService"; + public static final String TYPE_SERVER_LAUNCHER = "ServerLauncher"; + public static final String TYPE_SUBSYSTEM = "SubSystem"; + + // node attributes + + // profile attributes + public static final String ATTRIBUTE_DEFAULT_PRIVATE="defaultPrivate"; + public static final String ATTRIBUTE_IS_ACTIVE="isActive"; + + // subsystem attributes + public static final String ATTRIBUTE_HIDDEN="hidden"; + + // common attributes + public static final String ATTRIBUTE_NAME="name"; + public static final String ATTRIBUTE_TYPE="type"; + + // host attributes + public static final String ATTRIBUTE_HOSTNAME = "hostname"; + public static final String ATTRIBUTE_OFFLINE = "offline"; + public static final String ATTRIBUTE_DESCRIPTION = "description"; + public static final String ATTRIBUTE_USER_ID = "defaultUserId"; + + // ConnectorService attributes + public static final String ATTRIBUTE_GROUP="group"; + public static final String ATTRIBUTE_USE_SSL="useSSL"; + + // Filter string attributes + public static final String ATTRIBUTE_STRING = "string"; + + // filter attributes + public static final String ATTRIBUTE_SUPPORTS_NESTED_FILTERS = "supportsNestedFilters"; + public static final String ATTRIBUTE_RELATIVE_ORDER = "relativeOrder"; + public static final String ATTRIBUTE_DEFAULT = "default"; + public static final String ATTRIBUTE_STRING_CASE_SENSITIVE = "stringsCaseSensitive"; + public static final String ATTRIBUTE_PROMPTABLE ="promptable"; + public static final String ATTRIBUTE_SUPPORTS_DUPLICATE_FILTER_STRINGS="supportsDuplicateFilterStrings"; + public static final String ATTRIBUTE_NON_DELETABLE="nonDeletable"; + public static final String ATTRIBUTE_NON_RENAMABLE="nonRenamable"; + public static final String ATTRIBUTE_NON_CHANGEABLE="nonChangable"; + public static final String ATTRIBUTE_STRINGS_NON_CHANGABLE="stringsNonChangable"; + public static final String ATTRIBUTE_RELEASE="release"; + public static final String ATTRIBUTE_SINGLE_FILTER_STRING_ONLY="singleFilterStringOnly"; + + // server launcher attributes + public static final String ATTRIBUTE_REXEC_PORT="rexecPort"; + public static final String ATTRIBUTE_DAEMON_PORT="daemonPort"; + public static final String ATTRIBUTE_PORT="port"; + public static final String ATTRIBUTE_SERVER_PATH="serverPath"; + public static final String ATTRIBUTE_SERVER_SCRIPT="serverScript"; + public static final String ATTRIBUTE_RESTRICTED_TYPES="restrictedTypes"; + + public static final String ATTRIBUTE_VALUE = "value"; + public static final String ATTRIBUTE_ID = "id"; + public static final String ATTRIBUTE_OWNING_PARENT_NAME = "owningParentName"; + public static final String ATTRIBUTE_REF_ID= "refID"; + public static final String ATTRIBUTE_DELETABLE = "deletable"; + public static final String ATTRIBUTE_TRUE = "true"; + public static final String ATTRIBUTE_FALSE = "false"; +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/IRSEDOMExporter.java b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/IRSEDOMExporter.java new file mode 100644 index 00000000000..fb971b21df1 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/IRSEDOMExporter.java @@ -0,0 +1,130 @@ +/******************************************************************************** + * 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.persistence.dom; + + +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.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterString; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.IRSEModelObject; +import org.eclipse.rse.model.ISystemProfile; + + +public interface IRSEDOMExporter +{ + /** + * Creates the RSE DOM for this profile + * @param profile + * @param clean indicates whether to create from scratch or merger + * @return + */ + RSEDOM createRSEDOM(ISystemProfile profile, boolean clean); + + /** + * Creates an RSE DOM for use in persistance + * @param dom + * @param profile + * @return + */ + public RSEDOM populateRSEDOM(RSEDOM dom, ISystemProfile profile, boolean clean); + + /** + * Returns the RSEDOM for this profile iff it exists + * @param profile + * @return + */ + RSEDOM getRSEDOM(ISystemProfile profile); + + /** + * Create a DOM node representing a host + * @param parent + * @param host + * @return + */ + RSEDOMNode createNode(RSEDOMNode parent, IHost host, boolean clean); + + /** + * Creates a DOM node for a connector service + * @param parent + * @param connectorService + * @return + */ + RSEDOMNode createNode(RSEDOMNode parent, IConnectorService cs, boolean clean); + + /** + * Creates a DOM node for a server launcher + * @param parent + * @param serverLauncher + * @return + */ + RSEDOMNode createNode(RSEDOMNode parent, IServerLauncherProperties sl, boolean clean); + + /** + * Creates a DOM node for a subsystem + * @param parent + * @param subSystem + * @return + */ + RSEDOMNode createNode(RSEDOMNode parent, ISubSystem ss, boolean clean); + + /** + * Creates a DOM node for a filter + * @param parent + * @param filter + * @return + */ + RSEDOMNode createNode(RSEDOMNode parent, ISystemFilter sf, boolean clean); + + /** + * Create a DOM node representing a filter pool + * @param parent + * @param filterPool + * @return + */ + RSEDOMNode createNode(RSEDOMNode parent, ISystemFilterPool fp, boolean clean); + + + /** + * Creates a DOM node for a filter pool reference + * @param parent + * @param filterPoolReference + * @return + */ + RSEDOMNode createNode(RSEDOMNode parent , ISystemFilterPoolReference fpr, boolean clean); + + /** + * Creates a DOM node for a filter string + * @param parent + * @param filterString + * @return + */ + RSEDOMNode createNode(RSEDOMNode parent, ISystemFilterString fs, boolean clean); + + + /** + * Creates DOM nodes for each associated property set + * @param parent + * @param modelObject + * @return + */ + RSEDOMNode[] createPropertySetNodes(RSEDOMNode parent, IRSEModelObject mo, boolean clean); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/IRSEDOMImporter.java b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/IRSEDOMImporter.java new file mode 100644 index 00000000000..8f389b870cb --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/IRSEDOMImporter.java @@ -0,0 +1,78 @@ +/******************************************************************************** + * 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.persistence.dom; + + +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.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterString; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.IPropertySet; +import org.eclipse.rse.model.IRSEModelObject; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.model.ISystemProfileManager; + + + +public interface IRSEDOMImporter +{ + + /** + * Restores the profile represented by dom + * @param profileManager + * @param dom + * @return the restored profile + */ + ISystemProfile restoreProfile(ISystemProfileManager profileManager, RSEDOM dom); + + /** + * Restores the host represented by hostNode + */ + IHost restoreHost(ISystemProfile profile, RSEDOMNode hostNode); + + /** + * Restore the connector service represented by connectorServiceNode + */ + IConnectorService restoreConnectorService(IHost host, RSEDOMNode connectorServiceNode); + + IServerLauncherProperties restoreServerLauncher(IConnectorService service, RSEDOMNode serverLauncherNode, IServerLauncherProperties slproperties); + + /** + * Restores the subsystem represented by subSystemNode + */ + ISubSystem restoreSubSystem(IHost host, RSEDOMNode subSystemNode); + + + ISystemFilter restoreFilter(ISystemFilterPool filterPool, RSEDOMNode systemFilterNode); + + /** + * Restore the filter pool represented by the node + */ + ISystemFilterPool restoreFilterPool(ISystemProfile profile, RSEDOMNode systemFilterPoolNode); + + ISystemFilterPoolReference restoreFilterPoolReference(ISubSystem subSystem, RSEDOMNode systemFilterPoolReferenceNode); + ISystemFilterString restoreFilterString(ISystemFilter filter, RSEDOMNode systemFilterStringNode); + + /** + * Restores the property set represented by propertySetNode + */ + IPropertySet restorePropertySet(IRSEModelObject modelObject, RSEDOMNode propertySetNode); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/RSEDOM.java b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/RSEDOM.java new file mode 100644 index 00000000000..67132c990e0 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/RSEDOM.java @@ -0,0 +1,132 @@ +/******************************************************************************** + * 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.persistence.dom; + +import org.eclipse.rse.model.ISystemProfile; + +/** + * This class is the root node of an RSE DOM. Each + * RSEDOM represents the properties of a profile to persist. + */ +public class RSEDOM extends RSEDOMNode +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + private boolean _saveScheduled = false; + private transient ISystemProfile _profile; + + public RSEDOM(ISystemProfile profile) + { + super(null, TYPE_PROFILE, profile.getName()); + _profile = profile; + } + + public ISystemProfile getProfile() + { + return _profile; + } + + /** + * Indicate tath this DOM needs to be saved + */ + public void markForSave() + { + if (!_needsSave) + { + System.out.println("RSEDOM "+getName() + " needs saving"); + _needsSave = true; + } + } + + /** + * Indicate that this DOM has been saved + * + */ + public void markUpdated() + { + if (_needsSave) + { + System.out.println("RSEDOM "+getName() + " is up to date"); + + _needsSave = false; + _saveScheduled = false; + super.markUpdated(); + } + } + + /** + * Returns whether this DOM is scheduled to be saved + * @return + */ + public boolean saveScheduled() + { + return _saveScheduled; + } + + /** + * Indicate that this DOM is scheduled to be saved + */ + public void markSaveScheduled() + { + if (!_saveScheduled) + { + _saveScheduled = true; + } + } + + + /** + * Has the DOM changed since last update? + */ + public boolean needsSave() + { + return _needsSave; + } + + public void print(RSEDOMNode node, String indent) + { + String type = node.getType(); + String name = node.getName(); + RSEDOMNodeAttribute[] attributes = node.getAttributes(); + RSEDOMNode[] children = node.getChildren(); + + System.out.println(indent + "RSEDOMNode " + type); + System.out.println(indent + "{"); + String sindent = indent + " "; + + System.out.println(sindent + "name=" + name); + for (int i = 0; i < attributes.length; i++) + { + RSEDOMNodeAttribute attribute = attributes[i]; + String key = attribute.getKey(); + String value = attribute.getValue(); + System.out.println(sindent + key + "=" + value); + } + + String cindent = sindent + " "; + for (int c = 0; c < children.length; c++) + { + RSEDOMNode child = children[c]; + print(child, cindent); + } + System.out.println(indent + "}"); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/RSEDOMNode.java b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/RSEDOMNode.java new file mode 100644 index 00000000000..fb1eeeab843 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/RSEDOMNode.java @@ -0,0 +1,260 @@ +/******************************************************************************** + * 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.persistence.dom; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + + +public class RSEDOMNode implements IRSEDOMConstants, Serializable +{ + /** + * + */ + private static final long serialVersionUID = 1L; + protected String _type; + protected String _name; + protected RSEDOMNode _parent; + protected List _children; + protected List _attributes; + + protected boolean _needsSave = false; + protected boolean _isDirty = true; + + public RSEDOMNode(RSEDOMNode parent, String type, String name) + { + _type = type; + _name = name; + _parent = parent; + _children = new ArrayList(); + _attributes = new ArrayList(); + if (parent != null) + { + parent.addChild(this); + } + } + + public void markUpdated() + { + if (_needsSave) + { + _needsSave = false; + + for (int i = 0; i < _children.size(); i++) + { + RSEDOMNode child = (RSEDOMNode)_children.get(i); + child.markUpdated(); + } + } + } + + /** + * Propagate needs save indicator up to the root + * @param flag + */ + public void markForSave() + { + if (!_needsSave) + { + _needsSave = true; + _parent.markForSave(); + } + } + + /** + * Recursively removes all the children from this node on down + * + */ + public void clearChildren() + { + RSEDOMNode[] children = getChildren(); + for (int i = 0; i < children.length; i++) + { + children[i].clearAttributes(); + children[i].clearChildren(); + } + _children.clear(); + } + + /** + * Clears all attributes + * + */ + public void clearAttributes() + { + _attributes.clear(); + } + + /** + * Returns the name of this node + * @return + */ + public String getName() + { + return _name; + } + + /** + * Returns the type of this node + * @return + */ + public String getType() + { + return _type; + } + + /** + * Returns the parent of this node + * @return + */ + public RSEDOMNode getParent() + { + return _parent; + } + + /** + * Returns all the children of this node + * @return + */ + public RSEDOMNode[] getChildren() + { + return (RSEDOMNode[])_children.toArray(new RSEDOMNode[_children.size()]); + } + + /** + * Returns the first attribute found that has the specified key + * @param key + * @return + */ + public RSEDOMNodeAttribute getAttribute(String key) + { + for (int i = 0; i < _attributes.size(); i++) + { + RSEDOMNodeAttribute attribute = (RSEDOMNodeAttribute)_attributes.get(i); + if (key.equals(attribute.getKey())) + { + return attribute; + } + } + return null; + } + + /** + * Returns the immediate children of this node that are of the specified type + * @param type + * @return + */ + public RSEDOMNode[] getChildren(String type) + { + List results = new ArrayList(); + for (int i = 0; i < _children.size(); i++) + { + RSEDOMNode child = (RSEDOMNode)_children.get(i); + if (type.equals(child.getType())) + { + results.add(child); + } + } + return (RSEDOMNode[])results.toArray(new RSEDOMNode[results.size()]); + } + + /** + * Returns the first immediate child of this node that is of the specified type and name + * @param type + * @param name + * @return + */ + public RSEDOMNode getChild(String type, String name) + { + for (int i = 0; i < _children.size(); i++) + { + RSEDOMNode child = (RSEDOMNode)_children.get(i); + if (type.equals(child.getType()) && name.equals(child.getName())) + { + return child; + } + } + return null; + } + + /** + * Returns all the attributes for this node + * @return + */ + public RSEDOMNodeAttribute [] getAttributes() + { + return (RSEDOMNodeAttribute[])_attributes.toArray(new RSEDOMNodeAttribute[_attributes.size()]); + } + + /** + * Adds a child to this node + * @param child + */ + public void addChild(RSEDOMNode child) + { + _children.add(child); + markForSave(); + } + + /** + * Removes a child from this node + * @param child + */ + public void removeChild(RSEDOMNode child) + { + _children.remove(child); + markForSave(); + } + + + /** + * Adds an attribute to the node + * @param name + * @param value + * @param type + */ + public void addAttribute(String name, String value, String type) + { + RSEDOMNodeAttribute attr = new RSEDOMNodeAttribute(name, value, type); + _attributes.add(attr); + markForSave(); + } + + /** + * Adds an attribute to the node + * @param name + * @param value + */ + public void addAttribute(String name, String value) + { + RSEDOMNodeAttribute attr = new RSEDOMNodeAttribute(name, value); + _attributes.add(attr); + markForSave(); + } + + public boolean isDirty() + { + return _isDirty; + } + + public void setDirty(boolean isDirty) + { + _isDirty = isDirty; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/RSEDOMNodeAttribute.java b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/RSEDOMNodeAttribute.java new file mode 100644 index 00000000000..ba2f487ffa1 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/RSEDOMNodeAttribute.java @@ -0,0 +1,57 @@ +/******************************************************************************** + * 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.persistence.dom; + +import java.io.Serializable; + +public class RSEDOMNodeAttribute implements Serializable +{ + private String _key; + private String _value; + private String _type; + + public RSEDOMNodeAttribute(String key, String value, String type) + { + _key = key; + _value = value; + _type = type; + } + + public RSEDOMNodeAttribute(String key, String value) + { + _key = key; + _value = value; + _type = null; + } + + + public String getKey() + { + return _key; + } + + public String getValue() + { + return _value; + } + + public String getType() + { + return _type; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/plugin.properties b/rse/plugins/org.eclipse.rse.ui/plugin.properties new file mode 100644 index 00000000000..68ec06e5be1 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/plugin.properties @@ -0,0 +1,128 @@ +################################################################################ +# 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. +################################################################################ + +# NLS_MESSAGEFORMAT_VAR + +plugin.name = RSE UI + +extPoint.systemtype = Remote System Type +extPoint.subsystemConfiguration = Remote Subsystem Configuration +extPoint.popupMenus = Remote Object Popup Menu Actions +extPoint.propertyPages = RRemote Object Property Pages +extPoint.remoteSystemsViewPreferencesAction = Remote Systems View Preferences Actions +extPoint.compile = Remote Compile Commands +extPoint.archivehandlers = Remote Archive Handlers +extPoint.mountPathMappers = Mount Path Mappers +extPoint.password = Remote Systems Password Registry +extPoint.rseConfigDefaults = Configure Remote System Explorer Defaults + +systemType.iseries = iSeries native operating system (OS/400 or i5/OS) +systemType.iseries.PASE = PASE on iSeries +systemType.zseries = zSeries native operating system (z/OS) +systemType.windows = Any version of Microsoft Windows +systemType.unix = Any distribution of Unix +systemType.aix = IBM AIX operating system +systemType.linux = Any distribution of Linux +systemType.powerlinux = Linux running on PowerPC hardware +systemType.zlinux = Linux running on zSeries hardware +systemType.local = Local file system on this computer + +Plugin.Name = Remote System Explorer +PropertyPage.Info = Info +PropertyPage.Team = Team +PropertyPage.Connection = Host +PropertyPage.Connection.SubSystems = Subsystems +PropertyPage.Connection.ConnectorServices = Connector Services +PropertyPage.SubSystem = Subsystem +PropertyPage.ReferencedFilterPool = Referenced Filter Pool +PropertyPage.Reference = Reference +PropertyPage.Filter = Filter Information +PropertyPage.ChangeFilter = Filter Strings +PropertyPage.FilterPool = Filter Pool +PropertyPage.FilterString = Filter String +PropertyPage.TeamViewCategoryNode = Category Information +PropertyPage.Profile = Profile Information +PropertyPage.TeamViewSubSystemFactoryNode = SubSystem Factory Information +PropertyPage.TeamViewUserActionNode = User Action Information +PropertyPage.TeamViewCompileTypeNode = Compile Type Information +PropertyPage.TeamViewCompileCommandNode = Compile Command Information + +PropertyPage.ServerLauncherSettings = Server Launcher Settings +PropertyPage.ServerConnectionSecurity = Server Connection Security +PropertyPage.Service = Service + + +View.Category.RemoteSystems = Remote Systems +View.RemoteSystems = Remote Systems +View.RemoteSystemsDetails = Remote System Details + +View.Team = Team +View.RemoteErrorList = Remote Error List + +Perspective.Explorer = Remote System Explorer + +Factory.LocalFiles = Local Files +Factory.LocalCmds = Local Shells + +PreferencePage.Logging = Logging +PreferencePage.RemoteSystems = Remote Systems +PreferencePage.Signon = Passwords +PreferencePage.Communications = Communications + +Nature.RemoteSystemsNature = Remote System Nature +Nature.RemoteSystemsTempNature = Remote System Temp Nature + +Editor.Editor = LPEX Editor +Editor.RSEEditor = Remote Systems LPEX Editor +Editor.RSEBrowser = Remote Systems LPEX Browser + +View.Search = Remote Search + +View.Scratchpad = Remote Scratchpad + +View.Monitor = Remote Monitor + +PreferencePageAction.rse.label = Remote Systems... +PreferencePageAction.rse.tooltip = Go to the Remote Systems primary preferences page + +# View Filters +ViewFilter.RSEConnections=Remote Systems Explorer Connections +ViewFilter.RSETempFiles=Remote Systems Explorer File Cache + +# Decorators +SubSystemErrorDecorator.label=SubSystem Error Decorator + +# Presentation +RSEPresentation.label = Remote System Explorer +RSEPresentation.description = Colors and fonts used by Remote System Explorer. +MessagesPresentation.label = Messages +MessagesPresentation.description = Colors used for Remote System Explorer messages. +RemoteCommandsViewPresentation.label = Remote Shell View +RemoteCommandsViewPresentation.description = Colors and fonts used by Remote Shell view. +ErrorMessage.label = Error message color +ErrorMessage.description = Color used to show error messages in dialogs. +WarningMessage.label = Warning message color +WarningMessage.description = Color used to show warning messages in dialogs. +InfoMessage.label = Informational message color +InfoMessage.description = Color used to show informational messages in dialogs. +RemoteCommandsViewFontDefinition.label = Remote Shell Font +RemoteCommandsViewFontDefinition.description = This font is used by the Remote Shell view. +RemoteCommandsForeground.label = Foreground color +RemoteCommandsForeground.description = The foreground color is used by the Remote Shell view. +RemoteCommandsBackground.label = Background color +RemoteCommandsBackground.description = The background color is used by the Remote Shell view. +RemoteCommandsPrompt.label = Prompt color +RemoteCommandsPrompt.description = The text color used for displaying prompts. \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/plugin.xml b/rse/plugins/org.eclipse.rse.ui/plugin.xml new file mode 100644 index 00000000000..1b038ba0ae8 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/plugin.xml @@ -0,0 +1,1035 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + %RSEPresentation.description + + + %MessagesPresentation.description + + + + %ErrorMessage.description + + + + + %WarningMessage.description + + + + + %InfoMessage.description + + + + %RemoteCommandsViewPresentation.description + + + + %RemoteCommandsViewFontDefinition.description + + + + + %RemoteCommandsForeground.description + + + + + %RemoteCommandsBackground.description + + + + + %RemoteCommandsPrompt.description + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemPersistableReferenceManager.java b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemPersistableReferenceManager.java new file mode 100644 index 00000000000..0132d81b403 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemPersistableReferenceManager.java @@ -0,0 +1,480 @@ +/******************************************************************************** + * 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.internal.references; +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import org.eclipse.core.resources.IFolder; +import org.eclipse.rse.references.ISystemBasePersistableReferenceManager; +import org.eclipse.rse.references.ISystemBasePersistableReferencedObject; +import org.eclipse.rse.references.ISystemBasePersistableReferencingObject; + + +/** + * YOU MUST OVERRIDE resolveReferencesAfterRestore() IN THIS CLASS! + *

    + * YOU MUST OVERRIDE getReferenceName() IN SYSTEMPERSISTABLEREFERENCEDOBJECT! + *

    + * @see org.eclipse.rse.references.ISystemBasePersistableReferenceManager + * + * @lastgen class SystemPersistableReferenceManagerImpl Impl implements SystemPersistableReferenceManager, EObject {} + */ +public class SystemPersistableReferenceManager implements ISystemBasePersistableReferenceManager +{ + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + private ISystemBasePersistableReferencingObject[] listAsArray = null; + public static boolean debug = true; + public static HashMap EMPTY_MAP = new HashMap(); + + /** + * @generated This field/method will be replaced during code generation. + */ + protected String name = NAME_EDEFAULT; + /** + * @generated This field/method will be replaced during code generation. + */ + protected java.util.List referencingObjectList = null; + /** + * Constructor. Typically called by EMF framework via factory create method. + */ + protected SystemPersistableReferenceManager() + { + super(); + } + /** + * Internal method to get the mof java.util.List that is the current list. + */ + protected java.util.List internalGetList() + { + return getReferencingObjectList(); + } + + /** + * Internal method to invalidate any cached info. + * Must be called religiously by any method affecting list. + */ + protected void invalidateCache() + { + listAsArray = null; + } + + /** + * Return an array of the referencing objects currently being managed. + * @param array of the referencing objects currently in this list. + */ + public ISystemBasePersistableReferencingObject[] getReferencingObjects() + { + if ((listAsArray == null) || (listAsArray.length!=internalGetList().size())) + { + java.util.List list = internalGetList(); + listAsArray = new ISystemBasePersistableReferencingObject[list.size()]; + Iterator i = list.iterator(); + int idx=0; + while (i.hasNext()) + { + listAsArray[idx++] = (ISystemBasePersistableReferencingObject)i.next(); + } + } + return listAsArray; + } + + /** + * Set in one shot the list of referencing objects. Replaces current list. + * @param objects An array of referencing objects which is to become the new list. + * @param deReference true to first de-reference all objects in the existing list. + */ + public void setReferencingObjects(ISystemBasePersistableReferencingObject[] objects, + boolean deReference) + { + listAsArray = objects; + if (deReference) + removeAndDeReferenceAllReferencingObjects(); + else + removeAllReferencingObjects(); + java.util.List list = internalGetList(); + for (int idx=0; idxDoes NOT call removeReference on the master referenced object. + * @return new count of referenced objects being managed. + */ + public int removeReferencingObject(ISystemBasePersistableReferencingObject object) + { + java.util.List list = internalGetList(); + list.remove(object); + invalidateCache(); + return getReferencingObjectCount(); + } + + /** + * Remove and dereferences a referencing object from the managed list. + *

    DOES call removeReference on the master referenced object. + * @return new count of referenced objects being managed. + */ + public int removeAndDeReferenceReferencingObject(ISystemBasePersistableReferencingObject object) + { + object.removeReference(); + return removeReferencingObject(object); + } + + /** + * Remove all objects from the list. + *

    Does NOT call removeReference on the master referenced objects. + */ + public void removeAllReferencingObjects() + { + internalGetList().clear(); + } + + /** + * Remove and dereference all objects from the list. + *

      #p?V&4Y%ZJ-4{Au0jJ7jSG~#)tr-M#hN*h6mY-lhrg4 zHh9FCKptEu;UgRuX6OTl-Ao7uJ|dEcni~utnWBMAismFkLeL6;W(YU!ny{^0|mUX^)hk}58G z(hvwBU=bdAc%g?FthVZ^7<$D28mkvx=!)Wf$;}E*a6qiF##YqN3AQxz&a=^+aYi)s zJ}Ygt*JcX|4@6Qy#=%zbSKY?(P3q7dB`^vBU!RIDS5f-+z!cQ^9R4Jn}%G`p=&Zt!4^Ukeofq^Da7}J5b z|9WcXz@;L9vdRV{oba&>Wi!Jby(ke%FYQGbVK*+&Tns%o+z><%81%D89d?|MjL0J! zu+0i|H~sX=QoGC$79%|W!h;{UfPGIVgm-ce3%#h}1`pq?Vo48sSWpKsBqU-C+=t37 z!w__@V0X%Rw~Q`B{md}NBS2UJjXd($0Lbfru)q&9>&W3pCOr@!IV_6w@qr4qz^#f& z0&KH+=buB(^3+r-WK1IKP&0-lxD1mXKP<>TyBa+B(nu6QSTF_>ytL8B0{dj~%aI2B z#F6ow*Inw}QH!pyLXh-Lz!=rc!GjvONWd@#$P6{Cg9oW-L=S+lKk}Jx0qRJ^71*+r z_Z?4uP6J*2n8%Q!J)#a{a7QMpz=L%_Lk%c|#ySp|Kua)ie7#%10v-?t61c^E#k-*A z=BL5sO^qQlxPmbMh%p8N^uP~tDB%iM$O9h8p@mV<9TH-=034_Q5;x2W{E){(<>hU3 z3MpMC<^hX3SfB@uNQE4d*u*u;p$gu!L=?wB3`NMWiYnkl7A+XR9cIvr_AAyxBrpRx zL;)5}us{?t;Rjz-;gOK^g)jWj2s!SrjtfY^0#KlWLhLbzeN0~HIH(XpqHYIB7(?nB z;fGdAvXzu<1nyo)j5eeI1t?em@IJXk4AResdP|5YfxrtQ8Zi^dY=knEiA>yqj{tSp zK_76LOBDoympT;X27g$}8K6!PJ7@v{qR@jLSmK=Md|VH}7rtn2@&g~x!(RIF zmtVXeLQF~jfHo+C7#08m5TZcPf*Mqyx@&?n7VrTad>{qZ{KYS3!i{ZMG@D%eDadXriE%o7aLcdRspgOwJR#? zK-=2?))omn=$%TDF^ds^Rs~ong>Xr01=Q{#8&6#=T=j{N8DxS0M{Q{zz)1`wSogY` z&21l4+S%UDA{}`og?LF(3exVu3L030QM4^7Cc zC1h!depo@FYcK|H)iDA{3^oxt$U&`ipaUb6qa23_^8f}Qj%+CQ39KN2Iv!AAf!w42 z7opHZAQ~~lORRwr5|F?@{viSpY@yG4CWj_8v4#j3;}U{ZhYISE6FoNL$OenaxPF(`Co0f|?^dkc4fWZuAz=<}e zfz;Xdz#!;w0y>x@0^uG-Gq$jWIar+5qlkbx+O2{(K;Z?0U;={aeebodUQeVWy-TsyeryAjHoXE70-laQ7{LhB$ijPXesCLfVH3JQn>E0pcD)C~5tz@s<}p8S zde<8h<&^?V1)xQYvce7}xW*3z5d%R8!U!{9EaL%TgW9v83(MF80OVgxE!y*(DO2z$I<60$!y?QP$M?(;(w{$R%XCU)WmU6}v; zz)1fp)}M^^ufhPoqG##*D2)-sK@ilZ{wF@M2tiCCr#A;XwPypj=Y68UDS`nLNb@a8 zqA1MQOVR)dP;dtnSb;Hcfp;(s!PE)b_c{YufL-u?2*?={|scz`3a3|>Kk zKxl%WGKAP(2f?|?@Q + + + + + + + + + + diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/Host.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/Host.java new file mode 100644 index 00000000000..d73faea44dc --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/Host.java @@ -0,0 +1,660 @@ +/******************************************************************************** + * 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.internal.model; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.rse.core.ISystemTypes; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.SystemPreferencesManager; +import org.eclipse.rse.core.subsystems.IConnectorService; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemHostPool; +import org.eclipse.rse.model.ISystemProfile; + + + +/** + * A single connection object. + */ +public class Host extends RSEModelObject implements IHost, IAdaptable +{ + + /** + * The default value of the '{@link #getSystemType() System Type}' attribute. + * + * + * @see #getSystemType() + * @generated + * @ordered + */ + protected static final String SYSTEM_TYPE_EDEFAULT = null; + + private boolean ucId = true; + private boolean userIdCaseSensitive = true; + private ISystemHostPool pool; + protected String previousUserIdKey; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected String systemType = SYSTEM_TYPE_EDEFAULT; + /** + * The default value of the '{@link #getAliasName() Alias Name}' attribute. + * + * + * @see #getAliasName() + * @generated + * @ordered + */ + protected static final String ALIAS_NAME_EDEFAULT = null; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected String aliasName = ALIAS_NAME_EDEFAULT; + /** + * The default value of the '{@link #getHostName() Host Name}' attribute. + * + * + * @see #getHostName() + * @generated + * @ordered + */ + protected static final String HOST_NAME_EDEFAULT = null; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected String hostName = HOST_NAME_EDEFAULT; + /** + * The default value of the '{@link #getDescription() Description}' attribute. + * + * + * @see #getDescription() + * @generated + * @ordered + */ + protected static final String DESCRIPTION_EDEFAULT = null; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected String description = DESCRIPTION_EDEFAULT; + /** + * The default value of the '{@link #getDefaultUserId() Default User Id}' attribute. + * + * + * @see #getDefaultUserId() + * @generated + * @ordered + */ + protected static final String DEFAULT_USER_ID_EDEFAULT = null; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected String defaultUserId = DEFAULT_USER_ID_EDEFAULT; + /** + * The default value of the '{@link #isPromptable() Promptable}' attribute. + * + * + * @see #isPromptable() + * @generated + * @ordered + */ + protected static final boolean PROMPTABLE_EDEFAULT = false; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected boolean promptable = PROMPTABLE_EDEFAULT; + /** + * The default value of the '{@link #isOffline() Offline}' attribute. + * + * + * @see #isOffline() + * @generated + * @ordered + */ + protected static final boolean OFFLINE_EDEFAULT = false; + + /** + * The cached value of the '{@link #isOffline() Offline}' attribute. + * + * + * @see #isOffline() + * @generated + * @ordered + */ + protected boolean offline = OFFLINE_EDEFAULT; + + protected ISystemProfile _profile; + + /** + * Constructor + */ + protected Host(ISystemProfile profile) + { + super(); + _profile = profile; + } + /** + * Set the parent connection pool this is owned by. + * Connection pools are internal management objects, one per profile. + */ + public void setHostPool(ISystemHostPool pool) + { + this.pool = pool; + previousUserIdKey = getPreferencesKey(); + } + /** + * Set the parent connection pool this is owned by. + * Connection pools are internal management objects, one per profile. + */ + public ISystemHostPool getHostPool() + { + return pool; + } + + /** + * Return all the connector services provided for this host + * @return + */ + public IConnectorService[] getConnectorServices() + { + return SystemPlugin.getTheSystemRegistry().getConnectorServices(this); + } + + /** + * Return the subsystem instances under this connection.
      + * Just a shortcut to {@link org.eclipse.rse.model.ISystemRegistry#getSubSystems(IHost)} + */ + public ISubSystem[] getSubSystems() + { + return SystemPlugin.getTheSystemRegistry().getSubSystems(this); + } + + + + /** + * Private method called when this connection is being deleted, so + * we can do any pre-death cleanup we need. + *

      + * What we need to do is delete our entry in the preference store for our default userId. + */ + public void deletingHost() + { + String oldUserId = null; + if (previousUserIdKey != null) + oldUserId = getLocalDefaultUserId(previousUserIdKey); + // if the userId attribute held a preference store key of the form profileName.connectionName, + // we have to delete that key entry from the preference store and re-gen a new keyed entry with the same + // value (the actual user id) the old keyed entry held. + if (oldUserId != null) + { + SystemPreferencesManager prefMgr = getPreferencesManager(); + prefMgr.clearUserId(previousUserIdKey); + } + } + /** + * Private method called when this connection's profile is being rename, so + * we can do any pre-death cleanup we need. + *

      + * What we need to do is rename our entry in the preference store for our default userId. + */ + public void renamingSystemProfile(String oldName, String newName) + { + String userIdValue = null; + if (previousUserIdKey!=null) + userIdValue = getLocalDefaultUserId(previousUserIdKey); + // if the userId attribute held a preference store key of the form profileName.connectionName, + // we have to delete that key entry from the preference store and re-gen a new keyed entry with the same + // value (the actual user id) the old keyed entry held. + String newKey = getPreferencesKey(newName, getAliasName()); + if ((userIdValue != null) && (userIdValue.length()>0)) + { + SystemPreferencesManager prefMgr = getPreferencesManager(); + prefMgr.clearUserId(previousUserIdKey); + prefMgr.setUserId(newKey, userIdValue); // store old value with new preference key + } + previousUserIdKey = newKey; + } + + /** + * Return the system profile that owns this connection + */ + public ISystemProfile getSystemProfile() + { + return _profile; + } + /** + * Return the name of system profile that owns this connection + */ + public String getSystemProfileName() + { + if (pool == null) + return null; + else + { + ISystemProfile profile = pool.getSystemProfile(); + if (profile!=null) + return profile.getName(); + else + return null; + } + } + + /** + * Intercept of setAliasName so we can potentially rename the default-user-id key + * for the preferences store. That key is profileName.connectionAliasName so is + * affected when the alias name changes. + */ + public void setAliasName(String newName) + { + String oldName = getAliasName(); // what it used to be. + String userIdValue = null; + if (previousUserIdKey != null) + userIdValue = getLocalDefaultUserId(previousUserIdKey); + this.setAliasNameGen(newName); // update mof-modelled attribute + // if the userId attribute held a preference store key of the form profileName.connectionAliasName, + // we have to delete that key entry from the preference store and re-gen a new keyed entry with the same + // value (the actual user id) the old keyed entry held. + String newKey = getPreferencesKey(getSystemProfileName(), newName); + if ((userIdValue != null) && (userIdValue.length()>0)) + { + SystemPreferencesManager prefMgr = getPreferencesManager(); + prefMgr.clearUserId(previousUserIdKey); + prefMgr.setUserId(newKey, userIdValue); // store old value with new preference key + } + previousUserIdKey = newKey; + } + /** + * Intercept of setSystemType so we can decide if the user ID is case sensitive + */ + public void setSystemType(String systemType) + { + // defect 43219 + if (systemType != null) + { + boolean forceUC = systemType.equals(ISystemTypes.SYSTEMTYPE_ISERIES); + boolean caseSensitiveUID = systemType.equals(ISystemTypes.SYSTEMTYPE_UNIX) + || systemType.equals(ISystemTypes.SYSTEMTYPE_LINUX) + || (systemType.equals(ISystemTypes.SYSTEMTYPE_LOCAL) && + !System.getProperty("os.name").toLowerCase().startsWith("windows")); + setForceUserIdToUpperCase(forceUC); + setUserIdCaseSensitive(caseSensitiveUID); + } + this.setSystemTypeGen(systemType); + } + /** + * Intercept of setHostName so we can force it to uppercase + */ + public void setHostName(String name) + { + if (name != null) + name = name.toUpperCase(); + this.setHostNameGen(name); + } + /** + * Intercept of setDefaultUserId so we can force it to uppercase. + * Also, we do not store the user Id per se in the attribute, but rather + * we store it in the preference with a key name unique to this connection. + * We store that key name in this attribute. However, this is all transparent to + * the caller. + */ + public void setDefaultUserId(String newId) + { + if ((newId != null) && ucId) + newId = newId.toUpperCase(); + + if ((newId == null) || (newId.length()==0)) // a "clear" request? + { + clearLocalDefaultUserId(); + } + else + { + String key = getPreferencesKey(); + if (key != null) + { + SystemPreferencesManager prefMgr = getPreferencesManager(); + prefMgr.setUserId(key, newId); + } + } + } + /** + * We return the default user Id. Note that we don't store it directly in + * the mof-modelled attribute, as we don't want the team to share it. Rather, + * we store the actual user Id in the preference store keyed by this connection's + * unique name (profile.connName) and store that key in this attribute. + *

      + * Further, it is possible that there is no default user id. If so, this + * method will go to the preference store and will try to get the default user + * Id per this connection's system type. + *

      + * This is all transparent to the caller though. + *

      + * @return The value of the DefaultUserId attribute + */ + public String getDefaultUserId() + { + String uid = getLocalDefaultUserId(); + if ((uid == null) || (uid.length()==0)) + { + SystemPreferencesManager prefMgr = getPreferencesManager(); + uid = prefMgr.getDefaultUserId(getSystemType()); // resolve from preferences + if ((uid != null) && ucId) + uid = uid.toUpperCase(); + } + return uid; + } + /** + * Return the local default user Id without resolving up the food chain. + * @see #getDefaultUserId() + */ + protected static String getLocalDefaultUserId(String key) + { + String uid = null; + if ((key!=null) && (key.length()>0)) + { + SystemPreferencesManager prefMgr = getPreferencesManager(); + uid = prefMgr.getUserId(key); // resolve from preferences + } + return uid; + } + /** + * Return the local default user Id without resolving up the food chain. + * @see #getDefaultUserId() + */ + public String getLocalDefaultUserId() + { + return getLocalDefaultUserId(getPreferencesKey()); + } + + /** + * Clear the local default user Id so next query will return the value from + * the preference store. + *

      + * Same as calling setDefaultUserId(null) + * @see #setDefaultUserId(String) + */ + public void clearLocalDefaultUserId() + { + if (previousUserIdKey!=null) + getPreferencesManager().clearUserId(previousUserIdKey); + } + + /** + * Helper method to return preference manager + */ + protected static SystemPreferencesManager getPreferencesManager() + { + return SystemPreferencesManager.getPreferencesManager(); + } + + /** + * Helper method to compute a unique name for a given subsystem instance + */ + protected String getPreferencesKey() + { + if ((getSystemProfileName()==null) || (getAliasName()==null)) + return null; + return getPreferencesKey(getSystemProfileName()); + } + /** + * Helper method to compute a unique name for a given subsystem instance, given a profile name + */ + protected String getPreferencesKey(String profileName) + { + String connectionName = getAliasName(); + if (connectionName == null) + return null; + return getPreferencesKey(profileName, connectionName); + } + /** + * Helper method to compute a unique name for a given subsystem instance, given a profile name and connection name + */ + protected String getPreferencesKey(String profileName, String connectionName) + { + return profileName + "." + connectionName; + } + + + /** + * Call this with false to turn off the default behaviour of forcing the default userId to uppercase. + */ + public void setForceUserIdToUpperCase(boolean force) + { + this.ucId = force; + } + /** + * Call this to turn off the default behaviour of considering case when comparing userIds + */ + public void setUserIdCaseSensitive(boolean caseSensitive) + { + this.userIdCaseSensitive = caseSensitive; + } + + /** + * Call this to query whether the default userId is to be uppercased. + */ + public boolean getForceUserIdToUpperCase() + { + return ucId; + } + /** + * Call this to query whether the default userId is case sensitive + */ + public boolean getUserIdCaseSensitive() + { + return userIdCaseSensitive; + } + /** + * Call this to compare two userIds taking case sensitivity + */ + public boolean compareUserIds(String userId1, String userId2) + { + if (userId1 == null) + userId1 = ""; + if (userId2 == null) + userId2 = ""; + if (userIdCaseSensitive) + return userId1.equals(userId2); + else + return userId1.equalsIgnoreCase(userId2); + } + + public String toString() + { + if (getAliasName() == null) + return this.toStringGen(); + else + return getAliasName(); + } + /** + * 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); + } + + + /** + * @generated This field/method will be replaced during code generation + */ + public String getSystemType() + { + return systemType; + } + + /** + * Returns the alias name for this host + */ + public String getName() + { + return getAliasName(); + } + + /** + * @generated This field/method will be replaced during code generation + * The unique key for this object. Unique per connection pool + */ + public String getAliasName() + { + return aliasName; + } + + /** + * @generated This field/method will be replaced during code generation + */ + public String getHostName() + { + return hostName; + } + + /** + * @generated This field/method will be replaced during code generation + */ + public String getDescription() + { + return description; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setDescription(String newDescription) + { + description = newDescription; + } + + /** + * @generated This field/method will be replaced during code generation + */ + public boolean isPromptable() + { + return promptable; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setPromptable(boolean newPromptable) + { + promptable = newPromptable; + } + + /** + * + * Query if this connection is offline or not. It is up to each subsystem to honor this + * flag. + * + * @generated + */ + public boolean isOffline() + { + return offline; + } + + /** + * + * Specify if this connection is offline or not. It is up to each subsystem to honor this + * flag. + * + * @generated + */ + public void setOffline(boolean newOffline) + { + offline = newOffline; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setSystemTypeGen(String newSystemType) + { + systemType = newSystemType; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setAliasNameGen(String newAliasName) + { + aliasName = newAliasName; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setHostNameGen(String newHostName) + { + hostName = newHostName; + } + + /** + * @generated This field/method will be replaced during code generation + */ + public String getDefaultUserIdGen() + { + return defaultUserId; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setDefaultUserIdGen(String newDefaultUserId) + { + defaultUserId = newDefaultUserId; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public String toStringGen() + { + + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (systemType: "); + result.append(systemType); + result.append(", aliasName: "); + result.append(aliasName); + result.append(", hostName: "); + result.append(hostName); + result.append(", description: "); + result.append(description); + result.append(", defaultUserId: "); + result.append(defaultUserId); + result.append(", promptable: "); + result.append(promptable); + result.append(", offline: "); + result.append(offline); + result.append(')'); + return result.toString(); + } + + public boolean commit() + { + return SystemPlugin.getThePersistenceManager().commit(this.getSystemProfile()); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/IPropertyType.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/IPropertyType.java new file mode 100644 index 00000000000..8576fa820c4 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/IPropertyType.java @@ -0,0 +1,31 @@ +/******************************************************************************** + * 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.internal.model; + +public interface IPropertyType +{ + public static final int TYPE_STRING = 0; + public static final int TYPE_INTEGER = 1; + public static final int TYPE_ENUM = 2; + + public boolean isString(); + public boolean isInteger(); + public boolean isEnum(); + + public int getType(); + public String[] getEnumValues(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/Property.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/Property.java new file mode 100644 index 00000000000..5a0e429fd2e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/Property.java @@ -0,0 +1,96 @@ +/******************************************************************************** + * 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.internal.model; + +import org.eclipse.rse.model.IProperty; + +public class Property implements IProperty +{ + protected String _name; + protected String _label; + protected String _value; + protected IPropertyType _type; + protected boolean _isEnabled; + + + public Property(IProperty property) + { + _name = property.getKey(); + _label = property.getLabel(); + _value = property.getValue(); + _type = property.getType(); + _isEnabled = property.isEnabled(); + } + + public Property(String name, String value, IPropertyType type, boolean isEnabled) + { + _name = name; + _value = value; + _type = type; + _isEnabled = isEnabled; + } + + public void setLabel(String label) + { + _label = label; + } + + public String getLabel() + { + if (_label == null) + { + return _name; + } + return _label; + } + + public String getKey() + { + return _name; + } + + public String getValue() + { + return _value; + } + + public IPropertyType getType() + { + return _type; + } + + public boolean isEnabled() + { + return _isEnabled; + } + + public void setValue(String value) + { + _value = value; + } + + public void setType(IPropertyType type) + { + _type = type; + } + + public void setEnabled(boolean flag) + { + _isEnabled = flag; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/PropertySet.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/PropertySet.java new file mode 100644 index 00000000000..55755430690 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/PropertySet.java @@ -0,0 +1,137 @@ +/******************************************************************************** + * 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.internal.model; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import org.eclipse.rse.model.IProperty; +import org.eclipse.rse.model.IPropertySet; +import org.eclipse.rse.model.PropertyType; + + +public class PropertySet implements IPropertySet +{ + private String _name; + private Map _properties; + + protected static PropertyType _defaultType = new PropertyType(IPropertyType.TYPE_STRING); + + public PropertySet(IPropertySet propertySet) + { + _name = propertySet.getName(); + _properties = new HashMap(); + + String[] keys = propertySet.getPropertyKeys(); + for (int i =0; i < keys.length; i++) + { + String key = keys[i]; + IProperty property = propertySet.getProperty(key); + addProperty(key, new Property(property)); + } + } + + public PropertySet(String name) + { + _name= name; + _properties = new HashMap(); + } + + public String getName() + { + return _name; + } + + public String getDescription() + { + return getPropertyValue("description"); + } + + public String[] getPropertyKeys() + { + Set set = _properties.keySet(); + + return (String[])set.toArray(new String[set.size()]); + } + + public void setName(String name) + { + _name = name; + } + + public void setProperties(Map map) + { + _properties = map; + } + + public IProperty addProperty(String key, IProperty property) + { + _properties.put(key, property); + return property; + } + + public IProperty addProperty(String key, String value) + { + IProperty property = getProperty(key); + if (property != null) + { + property.setValue(value); + return property; + } + else + { + return addProperty(key, value, _defaultType); + } + } + + public IProperty addProperty(String key, String value, IPropertyType type) + { + IProperty property = new Property(key, value, type, true); + return addProperty(key, property); + } + + public boolean removeProperty(String key) + { + return _properties.remove(key) != null; + } + + public IProperty getProperty(String key) + { + return (IProperty)_properties.get(key); + } + + public String getPropertyValue(String key) + { + IProperty property = getProperty(key); + if (property != null) + { + return property.getValue(); + } + return null; + } + public IPropertyType getPropertyType(String key) + { + IProperty property = getProperty(key); + if (property != null) + { + return property.getType(); + } + return null; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/PropertySetContainer.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/PropertySetContainer.java new file mode 100644 index 00000000000..81d9cc52198 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/PropertySetContainer.java @@ -0,0 +1,90 @@ +/******************************************************************************** + * 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.internal.model; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.eclipse.rse.model.IPropertySet; +import org.eclipse.rse.model.IPropertySetContainer; + + + +public class PropertySetContainer implements IPropertySetContainer +{ + private Map _propertySets; + + public PropertySetContainer() + { + _propertySets = new HashMap(); + } + + public IPropertySet[] getPropertySets() + { + List sets = new ArrayList(); + Iterator iter = _propertySets.values().iterator(); + while (iter.hasNext()) + { + sets.add(iter.next()); + } + return (IPropertySet[])sets.toArray(new IPropertySet[sets.size()]); + } + + public IPropertySet getPropertySet(String name) + { + return (IPropertySet)_propertySets.get(name); + } + + public IPropertySet createPropertySet(String name, String description) + { + IPropertySet newSet = new PropertySet(name); + newSet.addProperty("description", description); + _propertySets.put(name, newSet); + return newSet; + } + + public IPropertySet createPropertySet(String name) + { + IPropertySet newSet = new PropertySet(name); + _propertySets.put(name, newSet); + return newSet; + } + + public boolean addPropertySet(IPropertySet set) + { + _propertySets.put(set.getName(), set); + return true; + } + + public boolean addPropertySets(IPropertySet[] sets) + { + for (int i = 0; i < sets.length; i++) + { + addPropertySet(sets[i]); + } + return true; + } + + public boolean removePropertySet(String name) + { + return _propertySets.remove(name) != null; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/RSEModelObject.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/RSEModelObject.java new file mode 100644 index 00000000000..c8d9d7794fd --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/RSEModelObject.java @@ -0,0 +1,61 @@ +/******************************************************************************** + * 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.internal.model; + +import org.eclipse.rse.model.IRSEModelObject; +import org.eclipse.rse.ui.SystemResources; + + + +/** + * Provides common support for local RSE model objects + * Extenders inherit property set support + * @author dmcknigh + * + */ +public abstract class RSEModelObject extends PropertySetContainer implements IRSEModelObject +{ + protected boolean _isDirty = true; + protected boolean _wasRestored = false; + + + public boolean isDirty() + { + return _isDirty; + } + + public void setDirty(boolean flag) + { + _isDirty = flag; + } + + + public boolean wasRestored() + { + return _wasRestored; + } + + public void setWasRestored(boolean flag) + { + _wasRestored = flag; + } + + public String getDescription() + { + return SystemResources.RESID_MODELOBJECTS_MODELOBJECT_DESCRIPTION; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemHostPool.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemHostPool.java new file mode 100644 index 00000000000..453b7ccbd3c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemHostPool.java @@ -0,0 +1,627 @@ +/******************************************************************************** + * 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.internal.model; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.rse.core.ISystemUserIdConstants; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.SystemPreferencesManager; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemHostPool; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.ui.SystemResources; + + +/** + * A pool of host objects. + * There is one pool per profile. + * + */ +public class SystemHostPool extends RSEModelObject implements ISystemHostPool +{ + + protected static final String NAME_EDEFAULT = null; + + private static Hashtable pools = null; + private static String CONNECTION_FILE_NAME = "connection"; + + + protected String name = NAME_EDEFAULT; + private java.util.List connections = null; + /** + * Default constructor. Typically called by MOF. + */ + protected SystemHostPool() + { + super(); + } + /** + * Reset for a full refresh from disk, such as after a team synch + */ + public static void reset() + { + pools = null; + } + + // ------------------------------------------------------------------------------------- + // CONNECTION POOL METHODS... + // ------------------------------------------------------------------------------------- + /** + * Return (and create if necessary) the connection pool for a given system profile. + */ + public static ISystemHostPool getSystemHostPool(ISystemProfile profile) + throws Exception + { + //System.out.println("in getSystemConnectionPool for " + profile); + if (pools == null) + pools = new Hashtable(); + SystemHostPool pool = (SystemHostPool)pools.get(profile); + //System.out.println("... pool: " + pool); + if (pool == null) + { + pool = new SystemHostPool(); + // FIXME (SystemConnectionPoolImpl)initMOF().createSystemConnectionPool(); + pool.setName(profile.getName()); + try { + pool.restore(); // restore connections + } catch (Exception exc) { + } + pools.put(profile, pool); // store this pool reference, keyed by profile object. + } + return pool; + } + + /** + * Return the system profile that owns this connection pool + */ + public ISystemProfile getSystemProfile() + { + return SystemProfileManager.getSystemProfileManager().getSystemProfile(getName()); + } + + /** + * Rename this connection pool. + */ + public void renameHostPool(String newName) + { + IHost[] connections = getHosts(); + String oldName = getName(); + for (int idx=0; idx + * THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU. + * @param systemType system type matching one of the system type names defined via the + * systemtype extension point. + * @param aliasName unique connection name. + * @param hostName ip name of host. + * @return SystemConnection object, or null if it failed to create + * because the aliasName is not unique. All other errors throw an exception. + */ + public IHost createHost(String systemType, String aliasName, String hostName) + throws Exception + { + return createHost(systemType,aliasName,hostName,null,null,ISystemUserIdConstants.USERID_LOCATION_CONNECTION); + } + /** + * Create a connection object, given all the possible attributes except default userId. + *

      + * THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU. + * @param systemType system type matching one of the system type names defined via the + * systemtype extension point. + * @param aliasName unique connection name. + * @param hostName ip name of host. + * @param description optional description of the connection. Can be null. + * @return SystemConnection object, or null if it failed to create + * because the aliasName is not unique. All other errors throw an exception. + */ + public IHost createHost(String systemType, String aliasName, String hostName, String description) + throws Exception + { + return createHost(systemType,aliasName,hostName,description,null,ISystemUserIdConstants.USERID_LOCATION_CONNECTION); + } + /** + * Create a connection object, given all the possible attributes. + *

      + * The new connection is added to the list and saved to disk. + * @param systemType system type matching one of the system type names defined via the + * systemtype extension point. + * @param aliasName unique connection name. + * @param hostName ip name of host. + * @param description optional description of the connection. Can be null. + * @param defaultUserId userId to use as the default for the subsystems. + * @param defaultUserIdLocation where to set the given default user Id. See ISystemUserIdConstants + * @return SystemConnection object, or null if it failed to create + * because the aliasName is not unique. All other errors throw an exception. + */ + public IHost createHost(String systemType, String aliasName, String hostName, + String description,String defaultUserId,int defaultUserIdLocation) + throws Exception + { + IHost conn = null; + boolean exists = getHost(aliasName) != null; + if (exists) + { + return null; + } + try + { + ISystemProfile profile = getSystemProfile(); + conn = new Host(profile); + addHost(conn); // only record internally if saved successfully + conn.setHostPool(this); + conn.setAliasName(aliasName); + updateHost(conn, systemType, aliasName, hostName, description, defaultUserId, defaultUserIdLocation); + + } catch (Exception e) + { + throw e; + } + return conn; + } + /** + * Update an existing connection given the new information. + * This method: + *

        + *
      • calls the setXXX methods on the given connection object, updating the information in it. + *
      • saves the connection to disk (renaming its folder if needed) + *
      + *

      + * @param conn SystemConnection to be updated + * @param systemType system type matching one of the system type names defined via the + * systemtype extension point. + * @param aliasName unique connection name. + * @param hostName ip name of host. + * @param description optional description of the connection. Can be null. + * @param defaultUserId userId to use as the default for the subsystems. + * @param defaultUserIdLocation where to set the given default user Id. See ISystemUserIdConstants + */ + public void updateHost(IHost conn, String systemType, + String aliasName, String hostName, + String description,String defaultUserId, int defaultUserIdLocation) + throws Exception + { + boolean aliasNameChanged = !aliasName.equalsIgnoreCase(conn.getAliasName()); + if (aliasNameChanged) + renameHost(conn,aliasName); + conn.setSystemType(systemType); + conn.setHostName(hostName); + if (defaultUserIdLocation != ISystemUserIdConstants.USERID_LOCATION_NOTSET) + { + if (defaultUserIdLocation != ISystemUserIdConstants.USERID_LOCATION_CONNECTION) + { + conn.setDefaultUserId(null); // clear what was there, to ensure inheritance + SystemPreferencesManager prefMgr = SystemPreferencesManager.getPreferencesManager(); + boolean forceToUpperCase = conn.getForceUserIdToUpperCase(); + if (forceToUpperCase && (defaultUserId != null)) + defaultUserId = defaultUserId.toUpperCase(); + if (defaultUserIdLocation == ISystemUserIdConstants.USERID_LOCATION_DEFAULT_SYSTEMTYPE) + { + prefMgr.setDefaultUserId(systemType, defaultUserId); + } + //else if (defaultUserIdLocation == ISystemUserIdConstants.USERID_LOCATION_DEFAULT_OVERALL) + //{ + //prefMgr.setDefaultUserId(defaultUserId); + //} + } + else + { + conn.setDefaultUserId(defaultUserId); + } + } + conn.setDescription(description); + commit(conn); + } + + + /** + * Return array of connections in this pool + */ + public IHost[] getHosts() + { + + return (IHost[])getHostList().toArray(new IHost[connections.size()]); + } + + + + /* + * Invalidate cache so it will be regenerated + */ + protected void invalidateCache() + { + setDirty(true); + } + + /** + * Return a connection object, given its alias name. + * Can be used to test if an alias name is already used (non-null return). + * @param aliasName unique aliasName (case insensitive) to search on. + * @return SystemConnection object with unique aliasName, or null if + * no connection object with this name exists. + */ + public IHost getHost(String aliasName) + { + IHost conn = null; + IHost currconn = null; + java.util.List conns = getHostList(); + Iterator i = conns.iterator(); + while (i.hasNext() && (conn==null)) + { + currconn = (IHost)i.next(); + if (currconn.getAliasName().equalsIgnoreCase(aliasName)) + conn = currconn; + } + return conn; + } + /** + * Return the connection at the given zero-based offset + */ + public IHost getHost(int pos) + { + java.util.List conns = getHostList(); + if (pos < conns.size()) + return (IHost)conns.get(pos); + else + return null; + } + /** + * Return the zero-based position of a SystemConnection object within its profile. + */ + public int getHostPosition(IHost conn) + { + int position = -1; + boolean match = false; + java.util.List conns = getHostList(); + Iterator i = conns.iterator(); + int idx = 0; + while (!match && i.hasNext()) + { + IHost currConn = (IHost)i.next(); + if (conn.equals(currConn)) + { + match = true; + position = idx; + } + idx++; + } + return position; + } + + /** + * Return the number of SystemConnection objects within this pool. + */ + public int getHostCount() + { + java.util.List conns = getHostList(); + return conns.size(); + } + + + public boolean addHost(IHost conn) + { + List hostList = getHostList(); + if (!hostList.contains(conn)) + { + hostList.add(conn); + } + conn.setHostPool(this); + invalidateCache(); + return true; + } + + /** + * Removes a given connection from the list and deletes it from disk. + *

      + * This will: + *

        + *
      • Delete the connection in memory + *
      • Delete the underlying folder + *
      + *

      + * @param conn SystemConnection object to remove + */ + public void deleteHost(IHost conn) + { + conn.deletingHost(); // let connection do any necessary cleanup + + getHostList().remove(conn); + setDirty(true); + SystemPlugin.getThePersistenceManager().commit(conn.getSystemProfile()); + } + + /** + * Renames a given connection in the list. + * This will: + *

        + *
      • Rename the profile in memory + *
      • Rename the underlying folder + *
      • Update the user preferences if this profile is currently active. + *
      + * @param conn SystemConnection object to rename + * @param newName The new name to give that connection. + */ + public void renameHost(IHost conn, String newName) + throws Exception + { + conn.setAliasName(newName); + invalidateCache(); + conn.setDirty(true); + commit(conn); + } + + + /** + * Duplicates a given connection in this list within this list or another list. + * @param targetPool The SystemConnectionPool to hold the copied connection. Can equal this connection, as long as alias name is unique + * @param conn SystemConnection object (within our pool) to clone + * @param alias New, unique, alias name to give this connection. Clone will fail if this is not unique. + */ + public IHost cloneHost(ISystemHostPool targetPool, IHost conn, String aliasName) + throws Exception + { + IHost copy = + targetPool.createHost(conn.getSystemType(), aliasName, + conn.getHostName(), conn.getDescription(), conn.getLocalDefaultUserId(), ISystemUserIdConstants.USERID_LOCATION_CONNECTION); + return copy; + } + + /** + * Move existing connections a given number of positions in the same pool. + * 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.

      + *

        + *
      • After the move, the pool containing the moved connection is saved to disk. + *
      • The connection's alias name must be unique in pool. + *
      + * TODO PROBLEM: CAN'T RE-ORDER FOLDERS SO CAN WE SUPPORT THIS ACTION? + * @param conns Array of SystemConnections to move. + * @param newPosition new zero-based position for the connection + */ + public void moveHosts(IHost conns[], int delta) + { + int[] oldPositions = new int[conns.length]; + for (int idx=0; idx 0) // moving down, process backwards + for (int idx=conns.length-1; idx>=0; idx--) + moveConnection(conns[idx], oldPositions[idx]+delta); + else + for (int idx=0; idxTODO PROBLEM: CAN'T RE-ORDER FOLDERS SO CAN WE SUPPORT THIS ACTION?
      + */ + private void moveConnection(IHost conn, int newPos) + { + java.util.List connList = getHostList(); + //FIXME connList.move(newPos, conn); + invalidateCache(); + } + + /** + * Order connections according to user preferences. + * Called after restore. + */ + public void orderHosts(String[] names) + { + java.util.List connList = getHostList(); + IHost[] conns = new IHost[names.length]; + for (int idx=0; idx + * It shows as "New Connection..." in the tree. When expanded, they get the new connection + * wizard. + */ +public class SystemNewConnectionPromptObject + implements ISystemPromptableObject, ISystemViewRunnableObject, IAdaptable +{ + private Object parent; + private String[] systemTypes; + private ISystemPromptableObject[] children; + private SystemNewConnectionAction action = null; + private boolean systemTypesSet = false; + private String newConnText; + private boolean isRootPrompt = false; + + /** + * Constructor + */ + public SystemNewConnectionPromptObject() + { + systemTypes = SystemPlugin.getDefault().getSystemTypeNames(true); // true=>include local + isRootPrompt = true; + } + /** + * Constructor for child instances + */ + public SystemNewConnectionPromptObject(SystemNewConnectionPromptObject parent, String systemType) + { + this.parent = parent; + this.systemTypes = new String[] {systemType}; + } + + // ---------------------------------------------------- + // METHODS FOR CONFIGURING THIS OBJECT + // ---------------------------------------------------- + + /** + * Set the system types to restrict the New Connection wizard to + */ + public void setSystemTypes(String[] systemTypes) + { + this.systemTypes = systemTypes; + this.systemTypesSet = true; + } + + /** + * Set the parent object so that we can respond to getParent requests + */ + public void setParent(Object parent) + { + this.parent = parent; + } + + // ---------------------------------------------------- + // METHODS CALLED BY THE SYSTEMVIEWPROMPTABLEADAPTER... + // ---------------------------------------------------- + + /** + * Get the parent object (within tree view) + */ + public Object getParent() + { + return parent; + } + + /** + * Return the child promptable objects. + * If this returns null, then SystemViewPromptableAdapter will subsequently + * call {@link #run(Shell)}. + */ + public ISystemPromptableObject[] getChildren() + { + if (!hasChildren()) + return null; + + + else if (children == null) + { + children = new ISystemPromptableObject[systemTypes.length]; + for (int idx=0; idx + * The post behaviour is accomplished by calling the asyncExec method in the swt + * widget Display class. The Display object comes from calling getDisplay() on + * the shell which we get by calling getShell on the given listener. + *

      + * By having a separate class we can support multiple simultaneous post event + * requests by instantiating this class for each request. + */ +public class SystemPostableEventNotifier implements Runnable +{ + private ISystemResourceChangeEvent event = null; + private ISystemResourceChangeListener listener = null; + + /** + * Constructor when the request is to post one event to one listener + */ + public SystemPostableEventNotifier(ISystemResourceChangeListener listener, ISystemResourceChangeEvent event) + { + this.event = event; + this.listener = listener; + Display d = listener.getShell().getDisplay(); + //d.asyncExec(this); + d.syncExec(this); + } + + // ----------------------------- + // java.lang.Runnable methods... + // ----------------------------- + public void run() + { + if (listener != null) + listener.systemResourceChanged(event); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemPreferenceChangeEvent.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemPreferenceChangeEvent.java new file mode 100644 index 00000000000..5f54f35f7be --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemPreferenceChangeEvent.java @@ -0,0 +1,96 @@ +/******************************************************************************** + * 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.internal.model; +import java.util.EventObject; + +import org.eclipse.rse.model.ISystemPreferenceChangeEvent; + + +/** + * Event object sent to ISystemPreferenceChangeListeners when a + * remote system preference is changed. + * @see org.eclipse.rse.model.ISystemPreferenceChangeEvents + */ +public class SystemPreferenceChangeEvent + extends EventObject + implements ISystemPreferenceChangeEvent +{ + private int type; + private Object oldValue, newValue; + + /** + * Constructor + * @see org.eclipse.rse.model.ISystemPreferenceChangeEvents + * @param source The object that was added,deleted,renamed,changed. + * @param type The type of event, one of ISystemChangeEvent constants. + * @param parent The parent of the object that was added or deleted. + */ + public SystemPreferenceChangeEvent(int type, Object oldValue, Object newValue) + { + super(newValue); + setType(type); + this.oldValue = oldValue; + this.newValue = newValue; + } + + /** + * Return the type of the event + * @see org.eclipse.rse.model.ISystemPreferenceChangeEvents + */ + public int getType() + { + return type; + } + /** + * Return the old value prior to the change + */ + public Object getOldValue() + { + return oldValue; + } + /** + * Return the new value after the change + */ + public Object getNewValue() + { + return newValue; + } + + /** + * Set the type + * @see org.eclipse.rse.model.ISystemPreferenceChangeEvents + */ + public void setType(int type) + { + this.type = type; + } + /** + * Set the old value prior to the change + */ + public void setOldValue(Object value) + { + this.oldValue = value; + } + /** + * Return the new value after the change + */ + public void setNewValue(Object value) + { + this.newValue = value; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemPreferenceChangeManager.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemPreferenceChangeManager.java new file mode 100644 index 00000000000..fcaef7db6a5 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemPreferenceChangeManager.java @@ -0,0 +1,70 @@ +/******************************************************************************** + * 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.internal.model; +import java.util.Vector; + +import org.eclipse.rse.model.ISystemPreferenceChangeEvent; +import org.eclipse.rse.model.ISystemPreferenceChangeListener; + + +/** + * Manages the list of registered preference change listeners. + */ +public class SystemPreferenceChangeManager +{ + private Vector listeners = new Vector(); + + /** + * Constructor + */ + public SystemPreferenceChangeManager() + { + } + + /** + * Add a listener to list of listeners. If this object is already in + * the list, this does nothing. + */ + public void addSystemPreferenceChangeListener(ISystemPreferenceChangeListener l) + { + if (!listeners.contains(l)) + listeners.addElement(l); + } + + /** + * Remove a listener to list of listeners. If this object is not in + * the list, this does nothing. + */ + public void removeSystemPreferenceChangeListener(ISystemPreferenceChangeListener l) + { + if (listeners.contains(l)) + listeners.removeElement(l); + } + + /** + * Notify all registered listeners of the given event + */ + public void notify(ISystemPreferenceChangeEvent event) + { + for (int idx=0; idxName}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + + + private ISystemProfileManager mgr; + private boolean active; + + + /** + * @generated This field/method will be replaced during code generation. + */ + /** + * @generated This field/method will be replaced during code generation. + */ + protected String name = NAME_EDEFAULT; + /** + * The default value of the '{@link #isDefaultPrivate() Default Private}' attribute. + * + * + * @see #isDefaultPrivate() + * @generated + * @ordered + */ + protected static final boolean DEFAULT_PRIVATE_EDEFAULT = false; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected boolean defaultPrivate = DEFAULT_PRIVATE_EDEFAULT; + /** + * Default constructor + */ + protected SystemProfile() + { + super(); + } + /** + * Set the in-memory pointer back to the parent system profile manager + */ + public void setProfileManager(ISystemProfileManager mgr) + { + this.mgr = mgr; + } + /** + * Get the in-memory pointer back to the parent system profile manager + */ + public ISystemProfileManager getProfileManager() + { + return mgr; + } + + /** + * Convenience method for create a new connection within this profile. + * Shortcut for {@link ISystemRegistry#createHost(String,String,String,String)} + */ + public IHost createHost(String systemType, String connectionName, String hostName, String description) throws Exception + { + return SystemPlugin.getTheSystemRegistry().createHost(getName(), systemType, connectionName, hostName, description); + } + + /** + * Return all connections for this profile + */ + public IHost[] getHosts() + { + return SystemPlugin.getTheSystemRegistry().getHostsByProfile(this); + } + /** + * Return all filter pools for this profile + */ + public ISystemFilterPool[] getFilterPools() + { + ISubSystemConfiguration[] ssFactories = SystemPlugin.getTheSystemRegistry().getSubSystemConfigurations(); + Vector poolsVector = new Vector(); + for (int idx = 0; idx < ssFactories.length; idx++) + { + ISystemFilterPoolManager poolMgr = ssFactories[idx].getFilterPoolManager(this); + ISystemFilterPool[] pools = poolMgr.getSystemFilterPools(); + for (int ydx=0; ydx + * The underlying folder is created in the file system. + *

      + * @param name What to name this profile + * @param makeActive true if this profile is to be added to the active profile list. + * @return new profile, or null if name not unique. + */ + public ISystemProfile createSystemProfile(String name, boolean makeActive) + { + // FIXME + ISystemProfile existingProfile = getSystemProfile(name); + if (existingProfile != null) + { + // replace the existing one with a new profile + deleteSystemProfile(existingProfile); + } + + ISystemProfile newProfile = internalCreateSystemProfileAndFolder(name); + if (makeActive) + { + SystemPreferencesManager.getPreferencesManager().addActiveProfile(name); + ((SystemProfile)newProfile).setActive(makeActive); + } + SystemPlugin.getThePersistenceManager().commit(this); + return newProfile; + } + + /** + * Toggle an existing profile's state between active and inactive + */ + public void makeSystemProfileActive(ISystemProfile profile, boolean makeActive) + { + boolean wasActive = isSystemProfileActive(profile.getName()); + if (wasActive && !makeActive) + SystemPreferencesManager.getPreferencesManager().deleteActiveProfile(profile.getName()); + else if (makeActive && !wasActive) + SystemPreferencesManager.getPreferencesManager().addActiveProfile(profile.getName()); + ((SystemProfile)profile).setActive(makeActive); + } + + /* + * private version that avoids name collision check + */ + private ISystemProfile internalCreateSystemProfile(String name) + { + ISystemProfile profile = new SystemProfile(); + + // FIXME initMOF().createSystemProfile(); + initialize(profile, name); + profile.setDefaultPrivate(name.equalsIgnoreCase("Private")); + //System.out.println("initializing new profile " + name + ", is default private? " + profile.isDefaultPrivate()); + return profile; + } + + /* + * private version that avoids name collision check + */ + private ISystemProfile internalCreateSystemProfileAndFolder(String name) + { + ISystemProfile profile = internalCreateSystemProfile(name); + SystemResourceManager.getProfileFolder(profile); // creates proj/profileName folder + return profile; + } + + /* + * private method to initialize state for new profile + */ + private void initialize(ISystemProfile profile, String name) + { + profile.setName(name); + profile.setProfileManager(this); + getProfiles().add(profile); + invalidateCache(); + } + + /** + * Get an array of all existing profiles. + */ + public ISystemProfile[] getSystemProfiles() + { + List profiles = getProfiles(); + + + // Ensure that one Profile is the default Profile - defect 48995 NH + boolean defaultProfileExist = false; + for (int idx=0; (!defaultProfileExist) && (idx + *

    • Rename the profile in memory + *
    • Rename the underlying folder + *
    • Update the user preferences if this profile is currently active. + *

    DOES call removeReference on the master referenced objects. + */ + public void removeAndDeReferenceAllReferencingObjects() + { + ISystemBasePersistableReferencingObject[] objs = getReferencingObjects(); + for (int idx=0; idxYOU MUST OVERRIDE THIS METHOD! + *

    + * After restoring this from disk, there is only the referenced object name, + * not the referenced object pointer, for each referencing object. + *

    + * This method is called after restore and for each restored object in the list must: + *

      + *
    1. Do what is necessary to find the referenced object, and set the internal reference pointer. + *
    2. Call addReference(this) on that object so it can maintain it's in-memory list + * of all referencing objects. + *
    + * @return true if resolved successfully. False if some references were not found and + * hence those referencing objects removed from the restored list. + */ + public boolean resolveReferencesAfterRestore() + { + return false; + } + + + /** + * Attempt to save contents of manager to disk. Only call if not doing your own save from + * your own model that uses a subclass of this. + * @param folder The folder in which to save the manager. + * @param fileName The unqualified file name to save to. Should include extension, such as .xmi + */ + public void save(IFolder folder, String fileName) + throws Exception + { + /* FIXME + initMOF(); + String path = folder.getLocation().toOSString(); + String saveFileName = addPathTerminator(path)+fileName; + File saveFile = new File(saveFileName); + boolean exists = saveFile.exists(); + saveFileName = saveFile.toURL().toString(); + Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE; + + Resource.Factory resFactory = reg.getFactory(URI.createURI(saveFileName)); + //java.util.List ext = resFactory.createExtent(); // MOF way + //ext.add(this); // MOF way + Resource mofRes = resFactory.createResource(URI.createURI(saveFileName)); + mofRes.getContents().add(this); + try + { + mofRes.save(EMPTY_MAP); + } catch (Exception e) + { + if (debug) + { + System.out.println("Error saving SystemPersistableReferenceManager "+getName() + " to "+saveFile+": " + e.getClass().getName() + ": " + e.getMessage()); + e.printStackTrace(); + } + throw e; + } + + // if this is the first time we have created this file, we must update Eclipse + // resource tree to know about it... + if (!exists || !folder.exists()) + { + try + { + //SystemPlugin.logWarning("Calling refreshLocal on project after saving MOF file: " + saveFileName); + folder.getProject().refreshLocal(IResource.DEPTH_INFINITE, null); + } catch(Exception exc) + { + System.out.println("Exception doing refreshLocal on project: " + exc.getClass().getName()); + } + } + else + { + try + { + //SystemPlugin.logWarning("Calling refreshLocal on project after saving MOF file: " + saveFileName); + folder.refreshLocal(IResource.DEPTH_ONE, null); + } catch(Exception exc) + { + System.out.println("Exception doing refreshLocal on project: " + exc.getClass().getName()); + } + } + */ + } + + /** + * Restore a persisted manager from disk. + *

    + * After restoration, YOU MUST CALL {@link #resolveReferencesAfterRestore() resolveReferencesAfterRestore} + * This presumes yours subclass has overridden that method! + *

    + * @param folder The folder in which the saved manager exists. + * @param fileName The unqualified save file name including extension such as .xmi + * @return The restored object, or null if given file not found. Any other error gives an exception. + */ + public static ISystemBasePersistableReferenceManager restore(IFolder folder, String fileName) + throws Exception + { + ISystemBasePersistableReferenceManager mgr = new SystemPersistableReferenceManager(); +/*FIXME + initMOF(); + Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE; + String path = folder.getLocation().toOSString(); + String saveFile = addPathTerminator(path)+fileName; + //ResourceSet resourceSet = // MOF way + // Resource.Factory.Registry.getResourceSetFactory().makeResourceSet(); + Resource res1 = null; + try + { + // res1 = resourceSet.load(saveFile); MOF way + Resource.Factory resFactory = reg.getFactory(URI.createURI(saveFile)); + res1 = resFactory.createResource(URI.createURI(saveFile)); + res1.load(EMPTY_MAP); + } + catch (java.io.FileNotFoundException e) + { + if (debug) + System.out.println("SystemPersistableReferenceManager file not found: "+saveFile); + return null; + } + catch (Exception e) + { + if (debug) + { + System.out.println("Error loading SystemPersistableReferenceManager from file: "+saveFile+": " + e.getClass().getName() + ": " + e.getMessage()); + e.printStackTrace(); + } + throw e; + } + + java.util.List ext1 = res1.getContents(); + + // should be exactly one... + Iterator iList = ext1.iterator(); + mgr = (SystemPersistableReferenceManager)iList.next(); + + if (debug) + System.out.println("Ok. SystemPersistableReferenceManager "+mgr.getName()+" restored successfully."); +*/ + return mgr; + } + + + /** + * Ensure given path ends with path separator. + */ + public static String addPathTerminator(String path) + { + if (!path.endsWith(File.separator)) + path = path + File.separatorChar; + //else + // path = path; + return path; + } + + /** + * @generated This field/method will be replaced during code generation + */ + public String getName() + { + return name; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setName(String newName) + { + name = newName; + } + + /** + * @generated This field/method will be replaced during code generation + */ + public java.util.List getReferencingObjectList() + { + if (referencingObjectList == null) + { + referencingObjectList = new ArrayList(); + //FIXME new EObjectContainmentWithInversejava.util.List(SystemPersistableReferencingObject.class, this, ReferencesPackage.SYSTEM_PERSISTABLE_REFERENCE_MANAGER__REFERENCING_OBJECT_LIST, ReferencesPackage.SYSTEM_PERSISTABLE_REFERENCING_OBJECT__PARENT_REFERENCE_MANAGER); + } + return referencingObjectList; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public String toStringGen() + { + + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (name: "); + result.append(name); + result.append(')'); + return result.toString(); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemPersistableReferencedObject.java b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemPersistableReferencedObject.java new file mode 100644 index 00000000000..1730e9eb33d --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemPersistableReferencedObject.java @@ -0,0 +1,95 @@ +/******************************************************************************** + * 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.internal.references; +import org.eclipse.rse.references.ISystemBaseReferencingObject; +import org.eclipse.rse.references.ISystemPersistableReferencedObject; + + +/** + * YOUR SUBCLASS MUST OVERRIDE getReferenceName()! + * @see org.eclipse.rse.references.ISystemBasePersistableReferenceManager + * @lastgen class SystemPersistableReferencedObjectImpl extends SystemReferencedObjectImpl implements SystemPersistableReferencedObject, SystemReferencedObject {} + */ +public abstract class SystemPersistableReferencedObject extends SystemReferencedObject implements ISystemPersistableReferencedObject { + + + private SystemReferencedObjectHelper helper = null; + + /** + * Constructor. Typically called by EMF framework via factory create method. + */ + public SystemPersistableReferencedObject() + { + super(); + helper = new SystemReferencedObjectHelper(); + } + /** + * Return the unique reference name of this object. + *

    + * As required by the {@link org.eclipse.rse.references.ISystemBasePersistableReferencedObject ISystemPersistableReferencedObject} + * interface. + *

    + * YOUR SUBCLASS MUST OVERRIDE THIS!! + */ + public String getReferenceName() + { + return null; + } + + // ---------------------------------- + // ISystemReferencedObject methods... + // ---------------------------------- + /** + * Add a reference, increment reference count, return new count + * @return new count of how many referencing objects reference this object. + */ + public int addReference(ISystemBaseReferencingObject ref) + { + return helper.addReference(ref); + } + /** + * Remove a reference, decrement reference count, return new count + * @return new count of how many referencing objects reference this object. + */ + public int removeReference(ISystemBaseReferencingObject ref) + { + return helper.removeReference(ref); + } + /** + * Return a count of how many referencing objects reference this object. + */ + public int getReferenceCount() + { + return helper.getReferenceCount(); + } + /** + * Clear the list of referenced objects. + */ + public void removeAllReferences() + { + helper.removeAllReferences(); + } + /** + * Return a list of all referencing objects of this object + */ + public ISystemBaseReferencingObject[] getReferencingObjects() + { + return helper.getReferencingObjects(); + } + + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemPersistableReferencedObjectHelper.java b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemPersistableReferencedObjectHelper.java new file mode 100644 index 00000000000..16dadb3d57c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemPersistableReferencedObjectHelper.java @@ -0,0 +1,60 @@ +/******************************************************************************** + * 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.internal.references; +import org.eclipse.rse.references.ISystemBasePersistableReferencedObject; + +/** + * This class extends the support for a class that supports being managing by a transient + * in-memory reference to one which also supports the persistance of such references. + * To do this, such a referencable class must be able to return a name that is + * so unique that it can be used after restoration from disk to resolve a pointer to this + * specific object, in memory. + */ +public class SystemPersistableReferencedObjectHelper + extends SystemReferencedObjectHelper + implements ISystemBasePersistableReferencedObject +{ + private String referenceName; + + /** + * Constructor for SystemPersistableReferencedObjectHelper + * @param referenceName The unique name that can be stored to identify this object. + */ + protected SystemPersistableReferencedObjectHelper(String referenceName) + { + super(); + setReferenceName(referenceName); + } + + /** + * Return the unique reference name of this object, as set in the constructor + */ + public String getReferenceName() + { + return referenceName; + } + + /** + * Set the unique reference name of this object. Overrides what was set in + * the constructor. Typically called on rename operation. + */ + public void setReferenceName(String name) + { + this.referenceName = name; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemPersistableReferencingObject.java b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemPersistableReferencingObject.java new file mode 100644 index 00000000000..1326f347acc --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemPersistableReferencingObject.java @@ -0,0 +1,179 @@ +/******************************************************************************** + * 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.internal.references; + +import org.eclipse.rse.internal.filters.SystemFilterPoolReferenceManager; +import org.eclipse.rse.references.ISystemBasePersistableReferenceManager; +import org.eclipse.rse.references.ISystemBasePersistableReferencedObject; +import org.eclipse.rse.references.ISystemBaseReferencedObject; +import org.eclipse.rse.references.ISystemPersistableReferencingObject; + + +/** + * This class represents a object that references another object, where this reference + * is persistable to disk. + * @see org.eclipse.rse.references.ISystemBasePersistableReferenceManager + * @lastgen class SystemPersistableReferencingObjectImpl extends SystemReferencingObjectImpl implements SystemPersistableReferencingObject, SystemReferencingObject {} + */ +public abstract class SystemPersistableReferencingObject extends SystemReferencingObject implements ISystemPersistableReferencingObject +{ + /** + * The default value of the '{@link #getReferencedObjectName() Referenced Object Name}' attribute. + * + * + * @see #getReferencedObjectName() + * @generated + * @ordered + */ + protected static final String REFERENCED_OBJECT_NAME_EDEFAULT = null; + + private SystemReferencingObjectHelper helper = null; + + /** + * @generated This field/method will be replaced during code generation. + */ + protected String referencedObjectName = REFERENCED_OBJECT_NAME_EDEFAULT; + + // FIXME + protected ISystemBasePersistableReferenceManager _referenceManager; + + /** + * Constructor. Typically called by MOF framework via factory create method. + */ + protected SystemPersistableReferencingObject() + { + super(); + helper = new SystemReferencingObjectHelper(this); + } + /** + * Set the persistable referenced object name + * @generated This field/method will be replaced during code generation. + */ + public void setReferencedObjectName(String newReferencedObjectName) + { + referencedObjectName = newReferencedObjectName; + } + + // ---------------------------------------------- + // ISystemPersistableReferencingObject methods... + // ---------------------------------------------- + /** + * Set the in-memory reference to the master object. + * This implementation also extracts that master object's name and calls + * setReferencedObjectName as part of this method call. + * @see org.eclipse.rse.references.ISystemBasePersistableReferencingObject#setReferencedObject(ISystemBasePersistableReferencedObject) + */ + public void setReferencedObject(ISystemBasePersistableReferencedObject obj) + { + helper.setReferencedObject((ISystemBaseReferencedObject)obj); + setReferencedObjectName(obj.getReferenceName()); + } + + /** + * Get the persistable referenced object name. Handled by MOF generated code. + * @generated This field/method will be replaced during code generation + */ + public String getReferencedObjectName() + { + return referencedObjectName; + } + + // ---------------------------------------------- + // ISystemReferencingObject methods... + // ---------------------------------------------- + + /** + * @see org.eclipse.rse.references.ISystemBaseReferencingObject#setReferencedObject(ISystemBaseReferencedObject) + */ + public void setReferencedObject(ISystemBaseReferencedObject obj) + { + helper.setReferencedObject(obj); + } + + /** + * @see org.eclipse.rse.references.ISystemBaseReferencingObject#getReferencedObject() + */ + public ISystemBaseReferencedObject getReferencedObject() + { + return helper.getReferencedObject(); + } + + /** + * @see org.eclipse.rse.references.ISystemBaseReferencingObject#removeReference() + */ + public int removeReference() + { + return helper.removeReference(); + } + + /** + * @generated This field/method will be replaced during code generation + */ + public ISystemBasePersistableReferenceManager getParentReferenceManager() + { + /*FIXME + if (eContainerFeatureID != ReferencesPackage.SYSTEM_PERSISTABLE_REFERENCING_OBJECT__PARENT_REFERENCE_MANAGER) return null; + return (SystemPersistableReferenceManager)eContainer; + */ + if (_referenceManager == null) + { + //SystemFilterPoolReferenceManagerImpl.createSystemFilterPoolReferenceManager(caller, relatedPoolManagerProvider, mgrFolder, name, savePolicy, namingPolicy) + _referenceManager = new SystemFilterPoolReferenceManager(); + } + return _referenceManager; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public void setParentReferenceManager(ISystemBasePersistableReferenceManager newParentReferenceManager) + { + /*FIXME + if (newParentReferenceManager != eContainer || (eContainerFeatureID != ReferencesPackage.SYSTEM_PERSISTABLE_REFERENCING_OBJECT__PARENT_REFERENCE_MANAGER && newParentReferenceManager != null)) + { + if (EcoreUtil.isAncestor(this, newParentReferenceManager)) + throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); + NotificationChain msgs = null; + if (eContainer != null) + msgs = eBasicRemoveFromContainer(msgs); + if (newParentReferenceManager != null) + msgs = ((InternalEObject)newParentReferenceManager).eInverseAdd(this, ReferencesPackage.SYSTEM_PERSISTABLE_REFERENCE_MANAGER__REFERENCING_OBJECT_LIST, SystemPersistableReferenceManager.class, msgs); + msgs = eBasicSetContainer((InternalEObject)newParentReferenceManager, ReferencesPackage.SYSTEM_PERSISTABLE_REFERENCING_OBJECT__PARENT_REFERENCE_MANAGER, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ReferencesPackage.SYSTEM_PERSISTABLE_REFERENCING_OBJECT__PARENT_REFERENCE_MANAGER, newParentReferenceManager, newParentReferenceManager)); + */ + _referenceManager = newParentReferenceManager; + return; + } + + /** + * @generated This field/method will be replaced during code generation. + */ + public String toString() + { + + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (referencedObjectName: "); + result.append(referencedObjectName); + result.append(')'); + return result.toString(); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemPersistableReferencingObjectHelper.java b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemPersistableReferencingObjectHelper.java new file mode 100644 index 00000000000..ae570c4f159 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemPersistableReferencingObjectHelper.java @@ -0,0 +1,68 @@ +/******************************************************************************** + * 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.internal.references; +import org.eclipse.rse.references.ISystemBasePersistableReferencedObject; +import org.eclipse.rse.references.ISystemBaseReferencedObject; +import org.eclipse.rse.references.ISystemBaseReferencingObject; + +/** + * This class extends the support for managing a transient in-memory reference + * to include support for storing a persistable name that uniquely identifies that + * object. + */ +public class SystemPersistableReferencingObjectHelper + extends SystemReferencingObjectHelper + //implements ISystemPersistableReferencingObject +{ + private String masterObjectName = null; + /** + * Default constructor. + */ + protected SystemPersistableReferencingObjectHelper(ISystemBaseReferencingObject caller) + { + super(caller); + } + + /** + * Constructor that saves effort of calling setReferencedObject. + */ + public SystemPersistableReferencingObjectHelper(ISystemBaseReferencingObject caller, ISystemBasePersistableReferencedObject obj) + { + this(caller); + setReferencedObject(obj); + } + + /** + * Set the object to which we reference. This overload takes an + * ISystemPersistableReferencedObject so we can query its name for + * storage purposes. + */ + public void setReferencedObject(ISystemBasePersistableReferencedObject obj) + { + super.setReferencedObject((ISystemBaseReferencedObject)obj); + this.masterObjectName = obj.getReferenceName(); + } + + /** + * Return the name uniquely identifying the object we are referencing. + */ + public String getReferencedObjectName() + { + return masterObjectName; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemReferencedObject.java b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemReferencedObject.java new file mode 100644 index 00000000000..a4e9a2f640e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemReferencedObject.java @@ -0,0 +1,90 @@ +/******************************************************************************** + * 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.internal.references; +import org.eclipse.rse.internal.model.RSEModelObject; +import org.eclipse.rse.references.ISystemBaseReferencingObject; +import org.eclipse.rse.references.ISystemReferencedObject; + + +/** + * A class to encapsulate the operations required of an object which + * supports references to it by other objects (SystemReferencingObject). + * This type of class needs to support maintaining an in-memory list of + * all who reference it so that list can be following on delete and + * rename operations. + *

    + * These references are not persistent. Persistent references are managed + * by the subclass SystemPersistableReferencedObject. + */ +/** + * @lastgen class SystemReferencedObjectImpl Impl implements SystemReferencedObject, EObject {} + */ +public abstract class SystemReferencedObject extends RSEModelObject implements ISystemReferencedObject +{ + protected SystemReferencedObjectHelper helper = null; + + /** + * Default constructor. Typically called by EMF factory method. + */ + protected SystemReferencedObject() + { + super(); + helper = new SystemReferencedObjectHelper(); + } + // ---------------------------------- + // ISystemReferencedObject methods... + // ---------------------------------- + /** + * Add a reference, increment reference count, return new count + * @return new count of how many referencing objects reference this object. + */ + public int addReference(ISystemBaseReferencingObject ref) + { + return helper.addReference(ref); + } + /** + * Remove a reference, decrement reference count, return new count + * @return new count of how many referencing objects reference this object. + */ + public int removeReference(ISystemBaseReferencingObject ref) + { + return helper.removeReference(ref); + } + /** + * Return a count of how many referencing objects reference this object. + */ + public int getReferenceCount() + { + return helper.getReferenceCount(); + } + /** + * Clear the list of referenced objects. + */ + public void removeAllReferences() + { + helper.removeAllReferences(); + } + /** + * Return a list of all referencing objects of this object + */ + public ISystemBaseReferencingObject[] getReferencingObjects() + { + return helper.getReferencingObjects(); + } + + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemReferencedObjectHelper.java b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemReferencedObjectHelper.java new file mode 100644 index 00000000000..5286a10e597 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemReferencedObjectHelper.java @@ -0,0 +1,98 @@ +/******************************************************************************** + * 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.internal.references; +import java.util.Vector; + +import org.eclipse.rse.references.ISystemBaseReferencedObject; +import org.eclipse.rse.references.ISystemBaseReferencingObject; + + +/** + * This is a class that implements all the methods in the ISystemReferencedObject. + * It makes implementing this interface trivial. + * The easiest use of this class is to subclass it, but since that is not + * always possible, it is not abstract and hence can be leveraged via containment. + */ +public class SystemReferencedObjectHelper implements ISystemBaseReferencedObject +{ + private Vector referencingObjects = new Vector(); + /** + * Constructor for SystemReferencedObjectHelper + */ + public SystemReferencedObjectHelper() + { + super(); + } + + /** + * @see ISystemBaseReferencedObject#addReference(ISystemBaseReferencingObject) + */ + public int addReference(ISystemBaseReferencingObject ref) + { + referencingObjects.addElement(ref); + return referencingObjects.size(); + } + + /** + * @see ISystemBaseReferencedObject#removeReference(ISystemBaseReferencingObject) + */ + public int removeReference(ISystemBaseReferencingObject ref) + { + int before = referencingObjects.size(); + referencingObjects.removeElement(ref); + int after = referencingObjects.size(); + assertThis((after == (before - 1)), "removeReference failed for "+ref); + return referencingObjects.size(); + } + + /** + * @see ISystemBaseReferencedObject#getReferenceCount() + */ + public int getReferenceCount() + { + return referencingObjects.size(); + } + + /** + * Clear the list of referenced objects. + */ + public void removeAllReferences() + { + referencingObjects.removeAllElements(); + } + + /** + * @see ISystemBaseReferencedObject#getReferencingObjects() + */ + public ISystemBaseReferencingObject[] getReferencingObjects() + { + ISystemBaseReferencingObject[] references = new ISystemBaseReferencingObject[referencingObjects.size()]; + for (int idx=0; idx + * These references are not persistent. Persistent references are managed + * by the subclass SystemPersistableReferencingObject. + */ +/** + * @lastgen class SystemReferencingObjectImpl Impl implements SystemReferencingObject, EObject {} + */ +public abstract class SystemReferencingObject extends RSEModelObject implements ISystemReferencingObject +{ + protected SystemReferencingObjectHelper helper = null; + protected boolean referenceBroken = false; + + /** + * Default constructor. Typically called by EMF factory method. + */ + protected SystemReferencingObject() + { + super(); + helper = new SystemReferencingObjectHelper(this); + } + /** + * @see org.eclipse.rse.references.ISystemBaseReferencingObject#setReferencedObject(ISystemBaseReferencedObject) + */ + public void setReferencedObject(ISystemBaseReferencedObject obj) + { + helper.setReferencedObject(obj); + } + + /** + * @see org.eclipse.rse.references.ISystemBaseReferencingObject#getReferencedObject() + */ + public ISystemBaseReferencedObject getReferencedObject() + { + return helper.getReferencedObject(); + } + + /** + * @see org.eclipse.rse.references.ISystemBaseReferencingObject#removeReference() + */ + public int removeReference() + { + return helper.removeReference(); + } + + /** + * Set to true if this reference is currently broken/unresolved + */ + public void setReferenceBroken(boolean broken) + { + referenceBroken = broken; + } + /** + * Return true if this reference is currently broken/unresolved + */ + public boolean isReferenceBroken() + { + return referenceBroken; + } + + public String getDescription() + { + return SystemResources.RESID_MODELOBJECTS_REFERENCINGOBJECT_DESCRIPTION; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemReferencingObjectHelper.java b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemReferencingObjectHelper.java new file mode 100644 index 00000000000..6e3bdf053ab --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/internal/references/SystemReferencingObjectHelper.java @@ -0,0 +1,84 @@ +/******************************************************************************** + * 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.internal.references; +import org.eclipse.rse.references.ISystemBaseReferencedObject; +import org.eclipse.rse.references.ISystemBaseReferencingObject; + +/** + * This is a class that implements all the methods in the ISystemReferencingObject. + * It makes implementing this interface trivial. + * The easiest use of this class is to subclass it, but since that is not + * always possible, it is not abstract and hence can be leveraged via containment. + */ +public class SystemReferencingObjectHelper //implements ISystemReferencingObject +{ + private ISystemBaseReferencedObject masterObject = null; + private ISystemBaseReferencingObject caller = null; + + /** + * Default constructor. + */ + public SystemReferencingObjectHelper(ISystemBaseReferencingObject caller) + { + super(); + this.caller = caller; + } + + /** + * Constructor that saves effort of calling setReferencedObject. + */ + public SystemReferencingObjectHelper(ISystemBaseReferencingObject caller, ISystemBaseReferencedObject obj) + { + this(caller); + setReferencedObject(obj); + } + + /** + * Set the object to which we reference. + * Stores the reference in memory, replacing whatever was there. + * Also, calls obj.addReference(caller); + */ + public void setReferencedObject(ISystemBaseReferencedObject obj) + { + this.masterObject = obj; + if (obj != null) + obj.addReference(caller); + } + + /** + * Get the object which we reference + */ + public ISystemBaseReferencedObject getReferencedObject() + { + return masterObject; + } + + /** + * Fastpath to getReferencedObject().removeReference(this). + * Also, nulls out our memory reference. + * @return new reference count of master object + */ + public int removeReference() + { + int newCount = 0; + ISystemBaseReferencedObject masterObject = getReferencedObject(); + if (masterObject != null) + newCount = masterObject.removeReference(caller); + masterObject = null; + return newCount; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemBasePersistableReferenceManager.java b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemBasePersistableReferenceManager.java new file mode 100644 index 00000000000..4faf7a58c8b --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemBasePersistableReferenceManager.java @@ -0,0 +1,174 @@ +/******************************************************************************** + * 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.references; +import org.eclipse.core.resources.IFolder; + + +/** + * A class for managing a list of shadow objects that reference master objects. + *

    + * Sometimes we have a master list of objects, and we let the user select + * a subset of that list and we wish to persist that users selections. To + * accomplish this, in your Rose model, follow these steps: + *

      + *
    1. Include the references package from the SystemReferences .cat file + *
    2. Ensure the class for the master objects subclass SystemPersistableReferencedObject, + * or implement ISystemPersistableReferencedObject. + * YOU MUST OVERRIDE getReferenceName() IN SYSTEMPERSISTABLEREFERENCEDOBJECT! + *
    3. Create a class subclassing SystemPersistableReferencingObject to hold a reference + * to the master object. This will hold a transient pointer, and a persistable + * name, of the master object. The name must be sufficient to be able to re-create + * the pointer upon restoration from disk. When you set the pointer via the + * setReferencedObject method, it will automatically extract the name of that + * object (by calling its getReferenceName method) and store it in the mof-modelled + * attribute of the SystemPersistableReferencingObject class. + *
    4. Create a class subclassing this class (SystemPersistableReferenceManager) + * to manage the list of referencing objects. Each time you instantiate a reference + * object, add it to the referencingObjects list managed by this class. + * YOU MUST OVERRIDE resolveReferencesAfterRestore() IN SYSTEMPERSISTABLEREFERENCEMANAGERIMPL! + *
    + *

    + * Once you have an instantiated and populated instance of this class, you can either + * choose to save it to disk in its own file (save/restore methods are supplied for this) + * or you can simply choose to store it as part of your own class via your own save + * and restore methods. If using MOF, and the containment of the manager class is modelled in + * your own containing class, this will happen automatically when you use mof to save + * your containing class instance. + */ +/** + * @lastgen interface SystemPersistableReferenceManager {} + */ + +public interface ISystemBasePersistableReferenceManager +{ + + /** + * Return an array of the referencing objects currently being managed. + * @param array of the referencing objects currently in this list. + */ + public ISystemBasePersistableReferencingObject[] getReferencingObjects(); + /** + * Set in one shot the list of referencing objects. Replaces current list. + * @param objects An array of referencing objects which is to become the new list. + * @param deReference true to first de-reference all objects in the existing list. + */ + public void setReferencingObjects(ISystemBasePersistableReferencingObject[] objects, boolean deReference); + /** + * Add a referencing object to the managed list. + * @return new count of referenced objects being managed. + */ + public int addReferencingObject(ISystemBasePersistableReferencingObject object); + /** + * Remove a referencing object from the managed list. + *

    Does NOT call removeReference on the master referenced object. + * @return new count of referenced objects being managed. + */ + public int removeReferencingObject(ISystemBasePersistableReferencingObject object); + /** + * Remove and dereferences a referencing object from the managed list. + *

    DOES call removeReference on the master referenced object. + * @return new count of referenced objects being managed. + */ + public int removeAndDeReferenceReferencingObject(ISystemBasePersistableReferencingObject object); + /** + * Remove all objects from the list. + *

    Does NOT call removeReference on the master referenced objects. + */ + public void removeAllReferencingObjects(); + /** + * Remove and dereference all objects from the list. + *

    DOES call removeReference on the master referenced objects. + */ + public void removeAndDeReferenceAllReferencingObjects(); + /** + * Return how many referencing objects are currently in the list. + * @return current count of referenced objects being managed. + */ + public int getReferencingObjectCount(); + /** + * Return the zero-based position of the given referencing object within the list. + * Does a memory address comparison (==) to find the object. + * @param object The referencing object to find position of. + * @return zero-based position within the list. If not found, returns -1 + */ + public int getReferencingObjectPosition(ISystemBasePersistableReferencingObject object); + /** + * Move the given referencing object to a new zero-based position in the list. + * @param newPosition New zero-based position + * @param object The referencing object to move + */ + public void moveReferencingObjectPosition(int newPosition, ISystemBasePersistableReferencingObject object); + /** + * Return true if the given referencable object is indeed referenced by a referencing object + * in the current list. This is done by comparing the reference names of each, not the + * in-memory pointers. + * @param object The referencable object to which to search for a referencing object within this list + * @return true if found in list, false otherwise. + */ + public boolean isReferenced(ISystemBasePersistableReferencedObject object); + /** + * Search list of referencing objects to see if one of them references the given referencable object. + * This is done by comparing the reference names of each, not the in-memory pointers. + * @param object The referencable object to which to search for a referencing object within this list + * @return the referencing object within this list which references the given referencable object, or + * null if no reference found. + */ + public ISystemBasePersistableReferencingObject getReferencedObject(ISystemBasePersistableReferencedObject object); + + /** + * Attempt to save contents of manager to disk. Only call if not doing your own save from + * your own model that uses a subclass of this. + * @param folder The folder in which to save the manager. + * @param fileName The unqualified file name to save to. Should include extension, such as .xmi + */ + public void save(IFolder folder, String fileName) + throws Exception; + + /** + * After restoring this from disk, there is only the referenced object name, + * not the referenced object pointer, for each referencing object. + *

    + * This method is called after restore and for each restored object in the list must: + *

      + *
    1. Do what is necessary to find the referenced object, and set the internal reference pointer. + *
    2. Call addReference(this) on that object so it can maintain it's in-memory list + * of all referencing objects. + *
    + * @return true if resolved successfully. False if some references were not found and + * hence those referencing objects removed from the restored list. + */ + public boolean resolveReferencesAfterRestore(); + + /** + * @generated This field/method will be replaced during code generation + * @return The value of the Name attribute + */ + String getName(); + + /** + * @generated This field/method will be replaced during code generation + * @param value The new value of the Name attribute + */ + void setName(String value); + + /** + * @generated This field/method will be replaced during code generation + * @return The list of ReferencingObjectList references + */ + java.util.List getReferencingObjectList(); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemBasePersistableReferencedObject.java b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemBasePersistableReferencedObject.java new file mode 100644 index 00000000000..bafdd4f1d9c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemBasePersistableReferencedObject.java @@ -0,0 +1,49 @@ +/******************************************************************************** + * 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.references; + +/** + * Referenced objects are objects that have shadow objects of them. + * Typically, shadows are created to enable a GUI which does not allow the same + * real object to appear multiple times. In these cases, a unique shadow object + * is created for each unique instance of the real object. + *

    + * The parent interface ISystemReferencedObject captures the simple set of methods + * an object that supports such a shadow must implement. + *

    + * This interface specializes that for the case of objects which support references + * that must be persisted. + * Typically, we build the references in memory at runtime just to satisfy the GUI. + * However, occassionally we build the list of references for a more permanent reason, + * such as when we let a user choose a subset from a master list. + *

    + * When we persist such a reference, we can't persist the memory reference to the master + * object. Instead, we persist the unique name or key of that object, and upon restoring + * from disk we then resolve that into a runtime reference to a real memory object. + *

    + * This interface captures the method to allow a shadow or referencing object to + * query that unique name or key from this referencable master object. + */ +public interface ISystemBasePersistableReferencedObject + extends ISystemBaseReferencedObject +{ + + /** + * Query the unique name or key of this master object to record in the referencing object. + */ + public String getReferenceName(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemBasePersistableReferencingObject.java b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemBasePersistableReferencingObject.java new file mode 100644 index 00000000000..bc8a1975a46 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemBasePersistableReferencingObject.java @@ -0,0 +1,51 @@ +/******************************************************************************** + * 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.references; +/** + * Referencing objects are shadows of real objects. Typically, shadows are created + * to enable a GUI which does not allow the same real object to appear multiple times. + * In these cases, a unique shadow object is created for each unique instance of the + * real object. + *

    + * The parent interface ISystemReferencingObject captures the simple set of methods + * such a shadow must implement. + *

    + * This interface specializes that for the case of references that must be persisted. + * Typically, we build the references in memory at runtime just to satisfy the GUI. + * However, occassionally we build the list of references for a more permanent reason, + * such as when we let a user choose a subset from a master list. + *

    + * When we persist such a reference, we can't persist the memory reference to the master + * object. Instead, we persist the unique name or key of that object, and upon restoring + * from disk we then resolve that into a runtime reference to a real memory object. + *

    + * This interface captures the methods to set and query that name or key. + */ +public interface ISystemBasePersistableReferencingObject + extends ISystemBaseReferencingObject +{ + /** + * Set the object to which we reference. This is an overload of the parent + * interface method of the same name. This one takes an object of which we + * can query its unique name for the purpose of saving that to disk. + */ + public void setReferencedObject(ISystemBasePersistableReferencedObject obj); + /** + * Query the unique name or key of the object we are referencing. + */ + public String getReferencedObjectName(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemBaseReferencedObject.java b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemBaseReferencedObject.java new file mode 100644 index 00000000000..0c49ff46818 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemBaseReferencedObject.java @@ -0,0 +1,45 @@ +/******************************************************************************** + * 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.references; +/** + * Interface that any master object that is referenced must implement. + */ +public interface ISystemBaseReferencedObject +{ + /** + * Add a reference, increment reference count, return new count + * @return new count of how many referencing objects reference this object. + */ + public int addReference(ISystemBaseReferencingObject ref); + /** + * Remove a reference, decrement reference count, return new count + * @return new count of how many referencing objects reference this object. + */ + public int removeReference(ISystemBaseReferencingObject ref); + /** + * Return a count of how many referencing objects reference this object. + */ + public int getReferenceCount(); + /** + * Clear the list of referenced objects. + */ + public void removeAllReferences(); + /** + * Return a list of all referencing objects of this object + */ + public ISystemBaseReferencingObject[] getReferencingObjects(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemBaseReferencingObject.java b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemBaseReferencingObject.java new file mode 100644 index 00000000000..6735ffd54e2 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemBaseReferencingObject.java @@ -0,0 +1,51 @@ +/******************************************************************************** + * 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.references; +/** + * Referencing objects are shadows of real objects. Typically, shadows are created + * to enable a GUI which does not allow the same real object to appear multiple times. + * In these cases, a unique shadow object is created for each unique instance of the + * real object. + *

    + * This interface captures the simple set of methods such a shadow must implement. + */ +public interface ISystemBaseReferencingObject +{ + /** + * Set the object to which we reference + */ + public void setReferencedObject(ISystemBaseReferencedObject obj); + /** + * Get the object which we reference + */ + public ISystemBaseReferencedObject getReferencedObject(); + /** + * Fastpath to getReferencedObject().removeReference(this). + * @return new reference count of master object + */ + public int removeReference(); + + /** + * Set to true if this reference is currently broken/unresolved + */ + public void setReferenceBroken(boolean broken); + + /** + * Return true if this reference is currently broken/unresolved + */ + public boolean isReferenceBroken(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemPersistableReferencedObject.java b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemPersistableReferencedObject.java new file mode 100644 index 00000000000..3b1b3c91f3f --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemPersistableReferencedObject.java @@ -0,0 +1,36 @@ +/******************************************************************************** + * 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.references; + +/** + * A simple class that implements ISystemPersistableReferencedObject. + * This is an object that can have shadow (reference) objects, which simply + * contain a pointer (in memory) to this object, and a copy of this object's + * unique name or key (for storing on disk). + *

    + * The intention is that in your Rose model, your class extends this class. + * Do this for any class for which you wish to persist a list of references to + * that class. + */ +/** + * @lastgen interface SystemPersistableReferencedObject extends SystemReferencedObject {} + */ + +public interface ISystemPersistableReferencedObject extends ISystemReferencedObject, ISystemBasePersistableReferencedObject +{ + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemPersistableReferencingObject.java b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemPersistableReferencingObject.java new file mode 100644 index 00000000000..1b6cfde5f68 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemPersistableReferencingObject.java @@ -0,0 +1,66 @@ +/******************************************************************************** + * 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.references; +/** + * A simple class that implements ISystemPersistableReferencingObject. + * This is an object that is a shadow (reference) of a real master object + * (ISystemPersistableReferencedObject). + *

    + * Objects of this class contain a pointer (in memory) to the master object, + * and a copy of this object's unique name or key (for storing on disk). + *

    + * Only the name is saved to disk, and after restoring from disk, that name + * is used to set the actual object reference. + *

    + * The intention is that in your Rose model, your class extends this class. + * Do this for any shadow/reference class which you want to persist. Use + * a subclass of SystemPersistableReferenceManager to manage a list of these, + * and manage the saving/restoring of that list. + *

    + * YOU MUST OVERRIDE resolveReferencesAfterRestore IN YOUR REFERENCE MANAGER SUBCLASS + */ +/** + * @lastgen interface SystemPersistableReferencingObject extends SystemReferencingObject {} + */ + +public interface ISystemPersistableReferencingObject extends ISystemReferencingObject, ISystemBasePersistableReferencingObject{ + + /** + * @generated This field/method will be replaced during code generation + * @return The value of the ReferencedObjectName attribute + */ + String getReferencedObjectName(); + + /** + * @generated This field/method will be replaced during code generation + * @param value The new value of the ReferencedObjectName attribute + */ + void setReferencedObjectName(String value); + + /** + * @generated This field/method will be replaced during code generation + * @return The ParentReferenceManager reference + */ + ISystemBasePersistableReferenceManager getParentReferenceManager(); + + /** + * @generated This field/method will be replaced during code generation + * @param l The new value of the ParentReferenceManager reference + */ + void setParentReferenceManager(ISystemBasePersistableReferenceManager value); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemReferencedObject.java b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemReferencedObject.java new file mode 100644 index 00000000000..eaa366b2526 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemReferencedObject.java @@ -0,0 +1,34 @@ +/******************************************************************************** + * 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.references; +/** + * A class to encapsulate the operations required of an object which + * supports references to it by other objects (SystemReferencingObject). + * This type of class needs to support maintaining an in-memory list of + * all who reference it so that list can be following on delete and + * rename operations. + *

    + * These references are not persistent. Persistent references are managed + * by the subclass SystemPersistableReferencedObject. + */ +/** + * @lastgen interface SystemReferencedObject {} + */ + +public interface ISystemReferencedObject extends ISystemBaseReferencedObject{ + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemReferencingObject.java b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemReferencingObject.java new file mode 100644 index 00000000000..c523b243c34 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/references/org/eclipse/rse/references/ISystemReferencingObject.java @@ -0,0 +1,35 @@ +/******************************************************************************** + * 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.references; +/** + * A class to encapsulate the operations required of an object which + * is merely a reference to another object, something we call a shadow. + * Such shadows are needed to support a GUI which displays the same + * object in multiple places. To enable that, it is necessary not to + * use the same physical object in each UI representation as the UI + * will only know how to update/refresh the first one it finds. + *

    + * These references are not persistent. Persistent references are managed + * by the subclass SystemPersistableReferencingObject. + */ +/** + * @lastgen interface SystemReferencingObject {} + */ + +public interface ISystemReferencingObject extends ISystemBaseReferencingObject{ + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/rseprofile.xsd b/rse/plugins/org.eclipse.rse.ui/rseprofile.xsd new file mode 100644 index 00000000000..9cdfe618bcf --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/rseprofile.xsd @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/rse/plugins/org.eclipse.rse.ui/schema/archivehandlers.exsd b/rse/plugins/org.eclipse.rse.ui/schema/archivehandlers.exsd new file mode 100644 index 00000000000..854dc1fb49b --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/schema/archivehandlers.exsd @@ -0,0 +1,141 @@ + + + + + + + + + This extension point is used to plug in additional Archive Handlers. These are used to provide seamless integration between Archive Handling and the RSE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + a unique name that will be used to identify the Archive Handler. + + + + + + + a translatable name that will be used to identify this Archive Handler in the UI. + + + + + + + a fully qualified name of the Java class that implements the <samp>org.eclipse.rse.ui.archiveutils.ISystemArchiveHandler</samp> interface. + + + + + + + + + + The filename extension to associate this Archive Handler with. For example, one would associate a Zip Handler with extension "zip". + + + + + + + + + + + + 5.1.2 + + + + + + + + + The following is an example of this extension point's usage: + +<p> +<pre> + <extension point="org.eclipse.rse.ui.archivehandlers"> + <archivehandler + id="org.eclipse.rse.ui.archiveutils.ziphandler" + name="Zip File Handler" + class="org.eclipse.rse.ui.archiveutils.SystemZipHandler"> + </archivehandler> + </extension> +</pre> +</p> + + + + + + + + + Plug-ins that want to extend this extension point must implement <samp>org.eclipse.rse.ui.archiveutils.ISystemArchiveHandler</samp> interface. + + + + + + + + + The Remote Systems Explorer in org.eclipse.rse.ui provides three default implementations of this extension point, for ZIP, JAR, and TAR Archives. + + + + + + + + + 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 + +Contributors: +IBM Corporation - initial API and implementation + + + + diff --git a/rse/plugins/org.eclipse.rse.ui/schema/compile.exsd b/rse/plugins/org.eclipse.rse.ui/schema/compile.exsd new file mode 100644 index 00000000000..d2ec8d801a2 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/schema/compile.exsd @@ -0,0 +1,245 @@ + + + + + + + + + This extension point is for defining compile commands that will appear in the compile menus for remote sources in the Remote Systems view of the Remote System Explorer perspective, and in the Work With Compile Commands dialog. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The id for the compile command. Must be unique over all plug-ins. It is suggested that the user qualify this with the plug-in id. + + + + + + + The label for the compile command. This is what users will see in the compile menus. + + + + + + + The actual command string that is to be executed on the remote server. This can include substitution variables, which allow runtime substitutions depending on the selected resource. +<p> +The following substitution variables are defined for the subsystems: +<p> +<ul> +<li><h4>ibm.files400</h4> (only for WebSphere Development Studio Client) + <ul> + <li><i>&L</i>: name of the library to which the selected member belogs.</li> + <li><i>&F</i>: name of the file to which the selected member belongs.</li> + <li><i>&N</i>: name of the selected member.</li> + <li><i>&O</i>: name of object library.</li> + <li><i>&R</i>: Replace object when compiling.</li> + <li><i>&X</i>: member text, in single quotes.</li> + </ul> +</li> +<p> +<li><h4>ibm.filesXXX</h4> + <ul> + <li><i>{system_filesep}</i>: file separator. "\\" on Windows, "/" on Unix and Linux.</li> + <li><i>{system_homedir}</i>: home directory on the target system, for the user ID used for the connection.</li> + <li><i>{system_pathsep}</i>: path separator. ";" on Windows, ":" on Unix and Linux.</li> + <li><i>{system_tempdir}</i>: temporary directory on the target system.</li> + <li><i>{resource_name}</i>: unqualified name of selected resource.</li> + <li><i>{resource_name_root}</i>: name of selected resource without the extension</li> + <li><i>{resource_path}</i>: path of selected resource including name.</li> + <li><i>{resource_path_root}</i>: root of selected file's path. "c:\\" on Windows, or "/" on others.</li> + <li><i>{resource_path_drive}</i>: drive letter on Windows, empty string on others.</li> + <li><i>{container_name}</i>: unqualified name of folder containing selected resource.</li> + <li><i>{container_path}</i>: path of folder containing selected resource including name.</li> + </ul> +</li> +<p> +</ul> + + + + + + + One of the optional filters to scope the remote resources for which the compile commands are to appear. Specify as many of these filters as needed to explicitly scope all the compile commands. +<p> +This filter specifies a subsystem factory id, such that these compile commands will only appear for remote resources returned from subsystems of the given subsystem factory. Note that the subsystem factory must support compile commands. +This ID can be scalar, or it can be generic to match on multiple subsystem factory IDs. The IDs of the IBM-supplied subsystem factories that support compile commands in the Remote Systems view are: +</p> +<ul> +<li><b>ibm.filesLocal</b>. For local file system resources, under the "Files" subsystem.</li> +<li><b>ibm.filesWindows</b>. For remote Windows file system resources, under the "Files" subsystem.</li> +<li><b>ibm.files</b>. For remote Unix and Linux file system resources, under the "Files" subsystem.</li> +<li><b>ibm.filesIFS</b>. For remote iSeries unix file system resources, under the "IFS Files" subsystem.</li> +<li><b>ibm.files400</b>. For remote iSeries native QSYS file system resources, under the "iSeries Objects" subsystem. (only for WebSphere Development Studio Client)</li> +<p> + + + + + + + One of the optional filters to scope the remote resources for +which the compile commands are to appear. +Specify as many of these filters as needed to explicitly scope +all the compile commands. +<p> +This filter specifies a simple or generic resource name. +Only resources whose name matches this filter will show the actions +defined within this object contribution element. +<h4>NOTE: The current implementation only accepts generic resource name, and names such as <i>*.extension</i>, e.g. *.java. Also, this filter must not be specified if subsystem factory is <b>ibm.files400</b>. +</h4> +</p> + + + + + + + One of the optional filters to scope the remote resources for +which the compile commands are to appear. +Specify as many of these filters as needed to explicitly scope +all the compile commands. + +<p> +This filter specifies a resource type, either simple or generic. +The resource types depend on the subsystem. The types +for IBM-supplied subsystems which support them are: +</p> +<ul> +<li><b>filesXXX</b>. Only <i>file</i>.</li> +<li><b>files400</b>. Member type. For example, <i>RPGLE</i>. (only for WebSphere Development Studio Client)</li> +</ul> +<br> + + + + + + + Indicates whether the label is editable by users in the Work With Compile Commands dialog. By default, it is <i>true</i>. +<p> + + + + + + + + + + + + 5.1.0 + + + + + + + + + <h3>Example One</h3> +The following is an example of adding a compile command for java files on remote Unix/Linux systems. +<p> +<pre> +<extension point="org.eclipse.rse.ui.compile"> + <compilecommand + id="com.mycomp.compileCommand1" + label="My Label 1" + commandstring="mycommand ${resource_name}" + subsystemfactoryid="ibm.files" + namefilter="*.java"> + </compilecommand> +</extension> +</pre> +</p> +<p> +<h3>Example Two</h3> +The following is an example of adding a compile command for RPGLE member types on iSeries servers. +<p> +<pre> +<extension point="org.eclipse.rse.ui.compile"> + <compilecommand + id="com.mycomp.compileCommand2" + label="My Label 2" + commandstring="CRTRPGMOD MODULE(&O/&N) SRCFILE(&L/&F) SRCMBR(&N) REPLACE(&R) OPTION(*EVENTF) DBGVIEW(*SOURCE) REPLACE(&R)" + subsystemfactoryid="ibm.files400" + typefilter="RPGLE"> + </compilecommand> +</extension> +</pre> +</p> + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + +Contributors: +IBM Corporation - initial API and implementation + + + + diff --git a/rse/plugins/org.eclipse.rse.ui/schema/dynamicPopupMenuExtensions.exsd b/rse/plugins/org.eclipse.rse.ui/schema/dynamicPopupMenuExtensions.exsd new file mode 100644 index 00000000000..07129a8f91f --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/schema/dynamicPopupMenuExtensions.exsd @@ -0,0 +1,134 @@ + + + + + + + + + This extension point is used to allow programmatic menu contributions via view adapters that allow for extension. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + a unique name that will be used to identify the . + + + + + + + a translatable name that will be used to identify this Oopup Menu Extension in the UI. + + + + + + + a fully qualified name of the Java class that implements the <samp>org.eclipse.rse.ui.ui.actions.ISystemViewAdapterMenuExtension</samp> interface. + + + + + + + + + + + + + + + 6.3.0 + + + + + + + + + The following is an example of this extension point's usage: + +<p> +<pre> + <extension point="org.eclipse.rse.ui.dynamicPopupMenuExtensions"> + <dynamicPopupMenuExtension + id="com.abc.ui.MyPopupMenuExtension" + name="My Popup Menu Extension" + class="com.abc.MyPopupMenuExtension"> + </dynamicPopupMenuExtension> + </extension> +</pre> +</p> + + + + + + + + + Plug-ins that want to extend this extension point must implement <samp>org.eclipse.rse.ui.ui.actions.ISystemViewAdapterMenuExtension</samp> interface. + + + + + + + + + By default there are not contributions to this. + + + + + + + + + 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 + +Contributors: +IBM Corporation - initial API and implementation + + + + diff --git a/rse/plugins/org.eclipse.rse.ui/schema/keystoreProviders.exsd b/rse/plugins/org.eclipse.rse.ui/schema/keystoreProviders.exsd new file mode 100644 index 00000000000..6093b2f67f2 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/schema/keystoreProviders.exsd @@ -0,0 +1,134 @@ + + + + + + + + + This extension point is used to allow the delegation of client keystores to vendors where needed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + a unique name that will be used to identify the Keystore Provider. + + + + + + + a translatable name that will be used to identify this Keystore Provider in the UI. + + + + + + + a fully qualified name of the Java class that implements the <samp>org.eclipse.rse.ui.resources.ISystemMountPathMapper</samp> interface. + + + + + + + + + + + + + + + 6.4.0 + + + + + + + + + The following is an example of this extension point's usage: + +<p> +<pre> + <extension point="org.eclipse.rse.ui.keystoreProviders"> + <keystoreProvider + id="com.xyz.universal.security.UniversalKeystoreProvider" + name="Universal Keystore Provider" + class="com.xyz.universal.security.UniversalKeystoreProvider"> + </keystoreProvider> + </extension> +</pre> +</p> + + + + + + + + + Plug-ins that want to extend this extension point must implement <samp>org.eclipse.rse.ui.comm.ISystemKeystoreProvider</samp> interface. + + + + + + + + + The Remote Systems Explorer in org.eclipse.rse.ui provides a default implementation of this extension point. + + + + + + + + + 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 + +Contributors: +IBM Corporation - initial API and implementation + + + + diff --git a/rse/plugins/org.eclipse.rse.ui/schema/mountPathMappers.exsd b/rse/plugins/org.eclipse.rse.ui/schema/mountPathMappers.exsd new file mode 100644 index 00000000000..3010b290126 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/schema/mountPathMappers.exsd @@ -0,0 +1,134 @@ + + + + + + + + + This extension point is used to allow the delegation of temp file mappings to vendors where needed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + a unique name that will be used to identify the Mount Path Mapper. + + + + + + + a translatable name that will be used to identify this Mount Path Mapper in the UI. + + + + + + + a fully qualified name of the Java class that implements the <samp>org.eclipse.rse.ui.resources.ISystemMountPathMapper</samp> interface. + + + + + + + + + + + + + + + 5.1.2 + + + + + + + + + The following is an example of this extension point's usage: + +<p> +<pre> + <extension point="org.eclipse.rse.ui.mountPathMappers"> + <mountPathMapper + id="org.eclipse.rse.ui.resources.defaultMountPathMapper" + name="Default Mount Path Mapper" + class="org.eclipse.rse.ui.resources.DefaultMountPathMapper"> + </mountPathMapper> + </extension> +</pre> +</p> + + + + + + + + + Plug-ins that want to extend this extension point must implement <samp>org.eclipse.rse.ui.resources.ISystemMountPathMapper</samp> interface. + + + + + + + + + The Remote Systems Explorer in org.eclipse.rse.ui provides a default implementation of this extension point. + + + + + + + + + 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 + +Contributors: +IBM Corporation - initial API and implementation + + + + diff --git a/rse/plugins/org.eclipse.rse.ui/schema/passwordPersistence.exsd b/rse/plugins/org.eclipse.rse.ui/schema/passwordPersistence.exsd new file mode 100644 index 00000000000..c821b0148f8 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/schema/passwordPersistence.exsd @@ -0,0 +1,119 @@ + + + + + + + + + Extension point for adding a system type to the Remote Systems password registry. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A unique identifier for this extension. + + + + + + + System type that saved passwords are used for. This will be displayed in the Add Password Information dialog's system type drop down. + + + + + + + If the user ID is case sensitive or not. This is an optional attribute. + + + + + + + + + + + + The following is an example of the extension point schema: +<pre> + <extension point="org.eclipse.rse.ui.passwordPersistence"> + <provider + id="com.acme.iseries.passwordpersistence" + systemType="iSeries" + caseSensitive="false"> + </provider> + </extension> +</pre> + + + + + + + + + There is no code to implement for this extension point. + + + + + + + + + See the plugin.xml file for plugin org.eclipse.rse.ui for examples of using this extension point. + + + + + + + + + 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 + +Contributors: +IBM Corporation - initial API and implementation + + + + diff --git a/rse/plugins/org.eclipse.rse.ui/schema/persistenceProviders.exsd b/rse/plugins/org.eclipse.rse.ui/schema/persistenceProviders.exsd new file mode 100644 index 00000000000..7bfffd709f3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/schema/persistenceProviders.exsd @@ -0,0 +1,134 @@ + + + + + + + + + This extension point is used to allow the delegation of client persistences to vendors where needed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + a unique name that will be used to identify the persistence Provider. + + + + + + + a translatable name that will be used to identify this persistence Provider in the UI. + + + + + + + a fully qualified name of the Java class that implements the <samp>org.eclipse.rse.persistence.IRSEPersistenceProvider</samp> interface. + + + + + + + + + + + + + + + 8.0.0 + + + + + + + + + The following is an example of this extension point's usage: + +<p> +<pre> + <extension point="org.eclipse.rse.ui.persistenceProviders"> + <persistenceProvider + id="org.eclipse.rse.persistence.DefaultRSEpersistenceProvider" + name="Default persistence Provider" + class="org.eclipse.rse.persistence.DefaultRSEpersistenceProvider"> + </persistenceProvider> + </extension> +</pre> +</p> + + + + + + + + + Plug-ins that want to extend this extension point must implement <samp>org.eclipse.rse.persistence.IRSEPersistenceProvider</samp> interface. + + + + + + + + + The Remote Systems Explorer in org.eclipse.rse.ui provides a default implementation of this extension point. + + + + + + + + + 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 + +Contributors: +IBM Corporation - initial API and implementation + + + + diff --git a/rse/plugins/org.eclipse.rse.ui/schema/popupMenus.exsd b/rse/plugins/org.eclipse.rse.ui/schema/popupMenus.exsd new file mode 100644 index 00000000000..010e6e11c89 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/schema/popupMenus.exsd @@ -0,0 +1,818 @@ + + + + + + + + + This extension point is for defining actions that appear in the +popup menu of remote resources of the +Remote Systems view, in the Remote System Explorer perspective. + +<p> +It is modelled after the Eclipse workbench extension point <samp>org.eclipse.ui.popupMenus</samp>. +However, because we know we are targeting remote resources, it +is simplified a bit. Specifically, there is no need to specify +the object class, as we assume these +actions apply to remote resources, which often share a common +object class. On the other hand, we +need additional filtering capabilities to scope which remote +resources these actions are to apply to. +</p> + +<p> +To this end, there is a rich set of +filtering attributes to enable fine-grained scoping by a number +of criteria. These scoping attributes +are the same as those for our <samp>org.eclipse.rse.ui.propertyPages</samp> +extension point. +</p> + +<p> +Like the workbench extension point, unless you specify otherwise +, the action will show +up in the main popup menu in the "additions" group. To create +cascading sub-menus, first +define a submenu and named separator group within it, using the +<samp>menu</samp> element and its <samp>separator </samp> +sub-element. Then refer to that menu's <samp>id</samp> in your +action element's <samp>menubarPath</samp> +attribute: +<samp>menuid/separator-group-name</samp>. +</p> + +<p> +While not fully documented here, this extension point supports the +<samp>&lt;filter&gt;</samp> +<samp>&lt;visibility&gt;</samp> and +<samp>&lt;enablement&gt;</samp> elements from the <samp>org.eclipse.ui.popupMenus</samp> +extension point. See its +documentation in the help for information on these elements. +For example: +<samp><pre> + <filter name="subsystemConfigurationCategory" value="files"/> + + <enablement> + <objectState name="hasChildren" value="true"/> + </enablement> +</pre></samp> +These elements are for conditionally deciding whether to show, +or enable, +the action(s). The <samp>name</samp>s supported for the <samp>&lt;filter&gt;</samp> +element, +and the <samp>objectState</samp>s supported for the <samp>&lt;visibility&gt;</samp> +and +<samp>&lt;enablement&gt;</samp> elements are:</p> +<ul> +<li><b><samp>"name"</samp></b>. Will test the <i>value</i> for +an exact match on an object's name, +or beginning-of-name match if ends with an asterisk. +<li><b><samp>"type"</samp></b>. Will test the <i>value</i> for +an exact match on an object's type. +<li><b><samp>"offline"</samp></b>.Will test the <i>value</i> +against "true" if the user is working +in "offline" mode or "false" if not. Currently only supported +for iSeries connections. +<li><b><samp>"connected"</samp></b>. Will test the <i>value</i> +against "true" if the connection +containing the selected object is active or "false" if not. +<li><b><samp>"hasChildren"</samp></b>. Will test the <i>value</i> +against "true" if this object's +adapter reports that it has children or "false" if it doesn't +have children. +<li><b><samp>"systemType"</samp></b>. Will test the <i>value</i> +for an exact match on the system type of +this object's parent SystemConnection object. +You can specify multiple values if you comma-separate them. +<li><b><samp>"subsystemConfigurationId"</samp></b>. Will test the <i>value</i> +for an exact match on the +<samp>ID</samp> of the subsystem configuration that created this object's +subsystem. Returns false for SystemConnection objects. +You can specify multiple values if you comma-separate them. +<li><b><samp>"subsystemConfigurationCategory"</samp></b>. Will test +the <i>value</i> for an exact match +on the <samp>category</samp> of the subsystem configuration that created +this object's subsystem. +You can specify multiple values if you comma-separate them. +</ul> + +<p> +These <samp>objectstate</samp>s are also supported via the +Eclipse <samp>org.eclipse.ui.popupMenus</samp> extension point, +for the +non-remote objects in the RSE: connections, subsystems, filter +pools +and filters. +</p> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The id for this set of remote resource popup menu contributions. Must +be unique over all plug-ins. +It is suggested that the user qualify this with the plug-in id. + + + + + + + One of the optional filters to scope the remote resources for +which the popup menu actions are to appear. +Specify as many of these optional filters like this as needed to explicitly scope +all the actions defined in this objectContribution element. +<p> +This filter specifies a subsystem configuration id, such that these +actions will only appear for remote resources returned from subsystems of the given subsystem configuration. +This ID can be scalar, or it can be generic to match on multiple subsystem configuration IDs. The +IDs of the IBM-supplied subsystem factories that display remote resources in the Remote +Systems view are: +</p> +<ul> +<li><b>ibm.filesLocal</b>. For local file system resources, under +the "Files" subsystem. +<li><b>ibm.filesWindows</b>. For remote Windows file system resources, +under the "Files" subsystem. +<li><b>ibm.files</b>. For remote Unix and Linux file system resources, +under the "Files" subsystem. +<li><b>ibm.filesIFS</b>. For remote iSeries unix file system resources, +under the "IFS Files" subsystem. +<li><b>ibm.files400</b>. For remote iSeries native QSYS file system +resources, under the "iSeries Objects" subsystem. +<li><b>ibm.cmds400</b>. For remote iSeries commands, under the "iSeries Commands" subsystem +<li><b>ibm.jobs400</b>. For remote iSeries jobs, under the "iSeries Jobs" subsystem.</ul> +<br> + + + + + + + One of the optional filters to scope the remote resources for +which the popup menu actions are to appear. +Specify as many of these optional filters like this as needed to explicitly scope +all the actions defined in this <samp>objectContribution</samp> element. + +<p> +This filter specifies a subsystem configuration category, such that +these +actions will only appear for remote resources returned from subsystems +owned by factories +declared defined with the specified category. + +<p> +This category can be scalar, or it can be generic to match on +multiple subsystem configuration categories. The +categories of the IBM-supplied subsystem factories that display +remote resources in the Remote +Systems view are: +</p> +<ul> +<li><b>files</b>. For subsystems that list hierarchical file +system resources, such as folders and files. +<li><b>nativefiles</b>. For subsystems that list non-hierarchical file +system resources, such as in the iSeries QSYS file system. +<li><b>commands</b>. For subsystems that list remote commands. +<li><b>jobs</b>. For subsystems that list remote jobs. +</ul> +<br> + + + + + + + One of the optional filters to scope the remote resources for +which the popup menu actions are to appear. +Specify as many of these optional filters like this as needed to explicitly scope +all the actions defined in this objectContribution element. +<br> +This filter specifies a single system type, or semicolon-separated list of system types, +or asterisk for all system types (the default). +Will scope these actions to only remote objects from systems of this type or types. +<br><br> + + + + + + + One of the optional filters to scope the remote resources for +which the popup menu actions are to appear. +Specify as many of these optional filters like this as needed to explicitly scope +all the actions defined in this objectContribution element. +<p> +This filter specifies a simple or generic resource name. +Only resources whose name matches this filter will show the actions +defined within this object contribution element. +</p> + + + + + + + One of the optional filters to scope the remote resources for +which the property page is to appear. +Specify as many of these optional filters like this as needed to explicitly scope this property page element. +<p> +This filter specifies a type category. Normally the subsystemconfigurationid +is sufficient, but some subsystems display multiple types of +resources, and these are categorized by a type name that can +be used to scope property pages. Here are the type categories supported by IBM- +supplied subsystems: +</p> +<ul> +<li><b>files</b>. For hierarchical file systems resources. +<li><b>commands</b>. For remote commands. +<li><b>jobs</b>. For remote jobs. +</ul> +<br> +The IBM-supplied subsystem for iSeries native file system objects also supports +these type categories: +<ul> +<li><b>LIBRARIES</b>. Set for libraries. +<li><b>OBJECTS</b>. Set for objects, excluding files. +<li><b>OBJECTFILES</b>. Set for file objects. Use <samp>OBJECTS*</samp> +to match on all objects. +<li><b>MEMBERS</b>. Set for data and source file members. +<li><b>RECORDS</b>. Set for record formats within files. +<li><b>FIELDS</b>. Set for fields within record formats. +<li><b>MESSAGE_DESCRIPTIONS</b>. Set for messages within message +files. +</ul> +<br> + + + + + + + One of the optional filters to scope the remote resources for +which the popup menu actions are to appear. +Specify as many of these optional filters like this as needed to explicitly scope +all the actions defined in this objectContribution element. + +<p> +This filter specifies a resource type, either simple or generic. +The resource types depends on the subsystem. The types +for IBM-supplied subsystems which support them are: +</p> +<ul> +<li><b>filesXXX</b>. Either <i>folder</i> or <i>file</i>. +<li><b>files400</b>. This is the object's type (for objects), +such as <i>*PGM</i>, or member's type (for members), +such as <i>RPGLE</i>. Since * is a valid character in an iSeries +object type, use %ast. instead of * to prevent wildcard matching. +For example, to prevent matching on both *PGM and *SRVPGM, use %ast.PGM +for the type. +</ul> +<br> + + + + + + + One of the optional filters to scope the remote resources for +which the popup menu actions are to appear. +Specify as many of these optional filters like this as needed to explicitly scope +all the actions defined in this objectContribution element. + +<p> +This filter specifies a simple or generic resource subtype to +match. Not all subsystems support subtypes for their resources. +The IBM-supplied subsystems that do support this are: +</p> +<ul> +<li>FilesXXX. This can be either <i>subfolder</i> for nested +folders only, or +<i>root</i> for the root folder or Windows' drives. +<li>Files400. For iSeries objects within a library, this is the +object's attribute. For members, it is either <i>DTA</i> or <i>SRC</i>. +For fields, it is the field's datatype (a single character). +</ul> +<br> + + + + + + + One of the optional filters to scope the remote resources for +which the popup menu actions are to appear. +Specify as many of these optional filters like this as needed to explicitly scope +all the actions defined in this objectContribution element. +<p> +This filter specifies a simple or generic resource sub-subtype +to match. No IBM-supplied subsystems support sub-subtypes for +their resources today. +</p> + + + + + + + + + + + + + + + + + Use this element when you wish to have your action appear in +your own cascading menu, versus in the primary popup menu. + + + + + + + + + + unique ID for this submenu, used later in the first part of the menubarPath attribute of +the action element or path attribute of a nested menu element. This is used to identify +the target sub-menu of the action or sub-submenu. + + + + + + + readable text to show up in the popup menu, for this cascading menu. Do NOT specify ampersand +for mnemonics, as these are assigned for you. However, accelerator information is valid as defined +by the Eclipse rules. + + + + + + + For multi-cascading menus, use this attribute to identify a previously +specified menu that +this menu is to be nested within. The syntax is a bit tricky. +It is "id/group", where +<samp>id</samp> matches the <samp>id</samp> attribute from a +previous <samp>menu</samp> element, +and <samp>group</samp> matches the <samp>name</samp> attribute +of a <samp>separator</samp> +sub-element within that previous <samp>menu</samp> element. + +<p> +For the root cascading menu, you can also use this to specify +a group within the remote resource's +popup menu, where to place this cascading menu. In this case, +you would not specify an id. The default group is the <samp>additions</samp> group, +which is near the bottom of the popup menu. +</p> +The IBM pre-defined groups are: +<ul> +<li><b>"group.new"</b>. This is where the cascading "New->" menu +is. +<li><b>"group.goto"</b>. This is where the cascading "Goto->" +menu is. +<li><b>"group.expandto"</b>. This is where the cascading "Expand +To->" menu is. +<li><b>"group.openwith"</b>. This is where the cascading "Open +With->" menu is. +<li><b>"group.browsewith"</b>. This is where the cascading "Browse +With->" menu is. +<li><b>"group.workwith"</b>. This is where the cascading "Work +With->" menu is. +<li><b>"group.build"</b>. Area of the menu reserved for build or refresh +related actions. +<li><b>"group.change"</b>. Area of the menu reserved for change-related actions. +<li><b>"group.reorganize"</b>. Area of the menu reserved for reorganize-related actions, +such as rename, move, copy, delete. +<li><b>"group.reorder"</b>. Area of the menu reserved for reorder-related actions, +such as move up or move down. +<li><b>"group.generate"</b>. Area of the menu reserved for code generation-related actions. +<li><b>"group.search"</b>. Area of the menu reserved for search-related actions. +<li><b>"group.connection"</b>. Area of the menu reserved for connection-related actions. +<li><b>"group.remoteservers"</b>. Area of the menu reserved for the "Remote Servers->" action. +<li><b>"group.importexport"</b>. Area of the menu reserved for import or export-related actions. +<li><b>"group.adapter"</b>. Area of the menu reserved for actions queried from the remote resource adapters. +<li><b>"additions"</b>. Area of the menu reserved for actions that don't specify a group. +<li><b>"group.team"</b>. Area of the menu reserved for team-related actions. +<li><b>"group.properties"</b>. Area of the menu reserved for properties-related actions. +</ul> + +<p> +You may also desire to place your action in an IBM-supplied cascading menu. +To do this, for the ID-part, specify one of the following IBM-supplied menu IDs: +<ul> +<li><b>"menu.new"</b>. This is the cascading "New->" menu. +<li><b>"menu.goto"</b>. This is the cascading "Goto->" menu. +<li><b>"menu.expandto"</b>. This is the cascading "Expand To->" menu. +<li><b>"menu.openwith"</b>. This is the cascading "Open With->" menu. +<li><b>"menu.browsewith"</b>. This is the cascading "Browse With->" menu. +<li><b>"menu.workwith"</b>. This is the cascading "Work With->" menu. +<li><b>"menu.remoteservers"</b>. This is the cascading "Remote Servers->" menu. +</ul> +<br> + + + + + + + + + + Use this element to define an action, and where it will appear in the popup menu. The action +defined here will only appear in a remote resource popup menu if the resource matches all the +given filtering criteria in the parent objectContribution element. + + + + + + + Unique ID for this action. + + + + + + + Readable text to display in the popup menu for this action. Do NOT specify ampersand for mnemonics, +as these are assigned for you. However, accelerator information is valid, as defined by the Eclipse rules. + + + + + + + An optional image icon for the popup menu. This is a .gif file, given with a path relative to your plugin +directory. + + + + + + + Optional tooltip text for this action. This appears in the status bar when the action is selected. + + + + + + + A slash-delimited path that is used to specify the location of the the action in the popup menu. Each token +in the path, except the last one, represents an existing submenu in the hierarchy, as defined via the <samp>id</samp> +attribute of a <samp>menu</samp> element previously defined. Alternatively, the ID of an IBM-supplied cascading +menu can be specified. The last token represents the named separator group into which the action will be added. +If no path is given, this must be an IBM-supplied group. +<p> +See the comments for the path attribute of the menu element for a list of the IBM-supplied cascading menus, +and IBM-supplied separator groups. +</p> +<p> +If a path is given, then this must match the name attribute of a <samp>separator</samp> sub-element +within one of your <samp>menu</samp> elements. +</p> +<p> +If the path is omitted, or this menubarPath attribute, the action will be added to the standard "additions" group. +</p> + + + + + + + A value indicating the selection count which must be met to enable the action. If this attribute is specified and +the condition is met, the action is enabled. If the condition is not met, the action is disabled. If no attribute +is specified, the action is enabled for any number of resources selected. The following formats are supported: +<ul> +<li><b>!</b>. 0 items selected. +<li><b>?</b>. 0 or 1 items selected. +<li><b>+</b>. 1 or more items selected. +<li><b>n+</b>. n or more items selected. Example: 2+. +<li><b>n</b>. A precise number of items selected. Example: 4 +<li><b>*</b>. Any number of items selected. +</ul> + + + + + + + Optional attribute indicating the action is a toggle type. That +is, is shown as a check box menu item. The attribute value will +be used as the initial state. + + + + + + + Optional unique identifier indicating the help context ID for this action. When the action appears as a menu item, pressing +F1 while the menu item is highlighted will display help for the given context ID. + + + + + + + Your action class that implements <samp>org.eclipse.ui.IObjectActionDelegate</samp>. +Typically you will extend one of the IBM-supplied classes, described in the API Information section. + + + + + + + + + + + + + Use this element to partition your cascading menu into areas, or groups. This groups are defined in the +order in which the separator elements appear. The name attribute identifies the group such that it can +be used as the target of an action or sub-menu. + + + + + + + The arbitrary, but unique with this menu, name to assign this group. You can specify this name +later in the menubarPath attribute of an action, or the group part of the path attribute of a +menu. + + + + + + + + + + + + The following is an example of a defining a simple popup menu +action for any files and folders in any system type, which only +shows when a single file or folder is selected: +<h3>Example One</h3> + +<p> +<pre> +<extension point="org.eclipse.rse.ui.popupMenus"> + <objectContribution + id="com.acme.actions.action1" + typecategoryfilter="files"> + <action id="com.acme.action1" + label="Test Action for Files and Folders" + class="com.acme.actions.Action1" + enablesFor="1"> + </action> + </objectContribution> +</extension> +</pre> +</p> +The following example refines the first example so the action +only appears +for Java source files, not folders, and only for files in a local +connection. +Further, we show how to define multiple actions within one objectContribution: +<h3>Example Two</h3> + +<p> +<pre> +<extension point="org.eclipse.rse.ui.popupMenus"> + <objectContribution + id="com.acme.actions.action2" + typecategoryfilter="files" + typefilter="file" + namefilter="*.java" + subsystemconfigurationid="ibm.filesLocal"> + <action id="com.acme.action2a" + label="Test Action One for Local Java Files" + class="com.acme.actions.Action2a" + enablesFor="1"> + </action> + <action id="com.acme.action2b" + label="Test Action Two for Local Java Files" + class="com.acme.actions.Action2b" + enablesFor="1"> + </action> + </objectContribution> +</extension> +</pre> +</p> +The following example refines the second example, by moving the +actions to our own single-cascading menu: +<h3>Example Three</h3> + +<p> +<pre> +<extension point="org.eclipse.rse.ui.popupMenus"> + <objectContribution + id="com.acme.actions.action3" + typecategoryfilter="files" + typefilter="file" + namefilter="*.java" + subsystemconfigurationid="ibm.filesLocal"> + <menu id="com.acme.menu" + label="Test Actions"> + <separator name="taGroup"/> + </menu> + <action id="com.acme.action3a" + label="Test Action One for Local Java Files" + class="com.acme.actions.Action3a" + enablesFor="1" + menubarPath="com.acme.menu/taGroup"> + </action> + <action id="com.acme.action3b" + label="Test Action Two for Local Java Files" + class="com.acme.actions.Action3b" + enablesFor="1" + menubarPath="com.acme.menu/taGroup"> + </action> + </objectContribution> +</extension> +</pre> +</p> +The following example refines the third example, by moving the +actions to our own <i>multiple</i>-cascading menu. Notice how +we +can define the same separator group in different menus since +they +are unrelated to each other: +<h3>Example Four</h3> + +<p> +<pre> +<extension point="org.eclipse.rse.ui.popupMenus"> + <objectContribution + id="com.acme.actions.action4" + typecategoryfilter="files" + typefilter="file" + namefilter="*.java" + subsystemconfigurationid="ibm.filesLocal"> + <menu id="com.acme.menu" + label="Test Actions"> + <separator name="taGroup"/> + </menu> + <menu id="com.acme.menu2" + label="A Sub Menu" + path="com.acme.menu/taGroup"> + <separator name="taGroup"/> + </menu> + + <action id="com.acme.action4a" + label="Test Action One for Local Java Files" + class="com.acme.actions.Action4a" + enablesFor="1" + menubarPath="com.acme.menu/com.acme.menu2/taGroup"> + </action> + <action id="com.acme.action4a" + label="Test Action Two for Local Java Files" + class="com.acme.actions.Action4b" + enablesFor="1" + menubarPath="com.acme.menu/com.acme.menu2/taGroup"> + </action> + </objectContribution> +</extension> +</pre> +</p> +The following example shows how to place actions within an +IBM-supplied cascading menu: +<h3>Example Five</h3> + +<p> +<pre> +<extension point="org.eclipse.rse.ui.popupMenus"> + <objectContribution + id="com.acme.actions.action5" + typecategoryfilter="files" + typefilter="file" + namefilter="*.java" + subsystemconfigurationid="ibm.filesLocal"> + <action id="com.acme.action5a" + label="Test Action One for Local Java Files" + class="com.acme.actions.Action5a" + enablesFor="1" + menubarPath="menu.openwith/additions"> + </action> + <action id="com.acme.action5b" + label="Test Action Two for Local Java Files" + class="com.acme.actions.Action5b" + enablesFor="1" + menubarPath="menu.browsewith/additions"> + </action> + </objectContribution> +</extension> +</pre> +</p> + +<p> +Remember, you can repeat the <samp>objectContribution</samp> elements as +needed, as well as the <samp>menu</samp> and <samp>action</samp> elements within them. +</p> + + + + + + + + + Your actions must all implement the interface <samp>org.eclipse.ui.IObjectActionDelegate</samp>. +Typically, you will subclass one of the supplied base classes +for this extension point: +<ul> +<li><b>org.eclipse.rse.ui.ui.actions.SystemAbstractPopupMenuExtensionAction</b>, +in plugin org.eclipse.rse.ui. +Base class offering generic support for any remote resource popup +menu action, for any system type. +<li><b>org.eclipse.rse.ui.ui.actions.SystemAbstractRemoteFilePopupMenuExtensionAction</b>, +in plugin org.eclipse.rse.ui. +Specialized base class offering specific support for any remote +file or folder popup menu action, for any system type. +<li><b>com.ibm.etools.iseries.core.ui.actions.isv.ISeriesAbstractIFSPopupMenuExtensionAction</b>, +in plugin com.ibm.etools.iseries.core. +Specialized base class offering specific support for iSeries +IFS file or folder popup menu actions. +<li><b>com.ibm.etools.iseries.core.ui.actions.isv.ISeriesAbstractQSYSPopupMenuExtensionAction</b>, +in plugin com.ibm.etools.iseries.core. +Specialized base class offering specific support for popup menu +actions for iSeries objects in the QSYS file system. +</ul> + + + + + + + + + There is no supplied implementation for this extension point. + + + + + + + + + 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 + +Contributors: +IBM Corporation - initial API and implementation + + + + diff --git a/rse/plugins/org.eclipse.rse.ui/schema/propertyPages.exsd b/rse/plugins/org.eclipse.rse.ui/schema/propertyPages.exsd new file mode 100644 index 00000000000..954d7dde231 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/schema/propertyPages.exsd @@ -0,0 +1,464 @@ + + + + + + + + + <p> +This extension point is modelled after the eclipse workbench +extension point <samp>org.eclipse.ui.propertyPages</samp>. +However, because we know we are targeting remote resources, it +is simplified a bit. Specifically, +there is no need to specify the object class, as we assume these +actions apply to remote resources, which often share a common +object class. +On the other hand, we need additional filtering capabilities +to scope which remote resources these pages are to apply to. +</p> + +<p> +To this end, there is a rich set of filtering attributes to enable +fine-grained scoping by a number +of criteria. These scoping attributes are the same as those for +our <samp>org.eclipse.rse.ui.popupMenus</samp> +extension point. + +<p> +While not fully documented here, this extension point supports +the +<samp>&lt;filter&gt;</samp> +element from the <samp>org.eclipse.ui.popupMenus</samp> +extension point. See its +documentation in the help for information on this element. +For example: +<samp><pre> + <filter name="subsystemFactoryCategory" value="files"/> +</pre></samp> +This element is for conditionally deciding whether to show +the property page, very much like the attributes of the &lt;page&gt; element +do; in fact there is some overlap. <br> +The <samp>name</samp>s +supported for the <samp>&lt;filter&gt;</samp> +element are:</p> +<ul> +<li><b><samp>"name"</samp></b>. Will test the <i>value</i> for +an exact match on an object's name, +or beginning-of-name match if ends with an asterisk. +<li><b><samp>"type"</samp></b>. Will test the <i>value</i> for +an exact match on an object's type. +<li><b><samp>"offline"</samp></b>.Will test the <i>value</i> +against "true" if the user is working +in "offline" mode or "false" if not. Currently only supported +for iSeries connections. +<li><b><samp>"connected"</samp></b>. Will test the <i>value</i> +against "true" if the connection +containing the selected object is active or "false" if not. +<li><b><samp>"hasChildren"</samp></b>. Will test the <i>value</i> +against "true" if this object's +adapter reports that it has children or "false" if it doesn't +have children. +<li><b><samp>"systemType"</samp></b>. Will test the <i>value</i> +for an exact match on the system type of +this object's parent SystemConnection object. +You can specify multiple values if you comma-separate them. +<li><b><samp>"subsystemFactoryId"</samp></b>. Will test the <i>value</i> +for an exact match on the +<samp>ID</samp> of the subsystem factory that created this object's +subsystem. Returns false for SystemConnection objects. +You can specify multiple values if you comma-separate them. +<li><b><samp>"subsystemFactoryCategory"</samp></b>. Will test +the <i>value</i> for an exact match +on the <samp>category</samp> of the subsystem factory that created +this object's subsystem. +You can specify multiple values if you comma-separate them. +</ul> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Identifies an individual property page contribution. + + + + + + + a unique ID that will be used to identify this page. + + + + + + + a translatable name that will be used in the UI for this page. + + + + + + + a fully qualified name of the class that implements <code>org.eclipse.ui.IWorkbenchPropertyPage</code>. +Or better yet, extends one of the IBM-supplied base classes, described in the API Information section. + + + + + + + + + + A relative path to an icon that will be used in the UI in addition to the page name. Optional. + + + + + + + One of the optional filters to scope the remote resources for +which the property page is to appear. +Specify as many of these optional filters like this as needed to explicitly scope this property page element. +<p> +This filter specifies a subsystem factory id, such that this +property page will only appear for remote resources returned from subsystems of the given subsystem factory. +This ID can be scalar, or it can be generic to match on multiple subsystem factory IDs. The +IDs of the IBM-supplied subsystem factories that display remote resources in the Remote +Systems view are: +</p> +<ul> +<li><b>ibm.filesLocal</b>. For local file system resources, under +the "Files" subsystem. +<li><b>ibm.filesWindows</b>. For remote Windows file system resources, +under the "Files" subsystem. +<li><b>ibm.files</b>. For remote Unix and Linux file system resources, +under the "Files" subsystem. +<li><b>ibm.filesIFS</b>. For remote iSeries unix file system resources, +under the "IFS Files" subsystem. +<li><b>ibm.files400</b>. For remote iSeries native QSYS file system +resources, under the "iSeries Objects" subsystem. +<li><b>ibm.jobs400</b>. For remote iSeries jobs, under the "iSeries Jobs" subsystem. +<li><b>ibm.cmds400</b>. For remote iSeries jobs, under the "iSeries Jobs" subsystem. +</ul> +<br> + + + + + + + One of the optional filters to scope the remote resources for +which the property page is to appear. +Specify as many of these optional filters like this as needed to explicitly scope +this property page element. + +<p> +This filter specifies a subsystem factory category, such that +this +property page will only appear for remote resources returned from subsystems +owned by factories +declared defined with the specified category. + +<p> +This category can be scalar, or it can be generic to match on +multiple subsystem factory categories. The +categories of the IBM-supplied subsystem factories that display +remote resources in the Remote +Systems view are: +</p> +<ul> +<li><b>files</b>. For subsystems that list hierarchical file +system resources, such as folders and files. +<li><b>nativefiles</b>. For subsystems that list non-hierarchical file +system resources, such as in the iSeries QSYS file system. +<li><b>commands</b>. For subsystems that list remote commands. +<li><b>jobs</b>. For subsystems that list remote jobs. +</ul> +<br> + + + + + + + One of the optional filters to scope the remote resources for +which the popup menu actions are to appear. +Specify as many of these optional filters like this as needed to explicitly scope +all the actions defined in this objectContribution element. +<br> +This filter specifies a single system type, or semicolon-separated list of system types, +or asterisk for all system types (the default). +Will scope these actions to only remote objects from systems of this type or types. +<br><br> + + + + + + + One of the optional filters to scope the remote resources for +which the property page is to appear. +Specify as many of these optional filters like this as needed to explicitly scope this property page element. +<p> +This filter specifies a simple or generic resource name. +Only resources whose name matches this filter will show the property page +defined within this page element. +</p> + + + + + + + One of the optional filters to scope the remote resources for +which the property page is to appear. +Specify as many of these optional filters like this as needed to explicitly scope this property page element. +<p> +This filter specifies a type category. Normally the subsystemfactoryid +is sufficient, but some subsystems display multiple types of +resources, and these are categorized by a type name that can +be used to scope property pages. Here are the type categories supported by IBM- +supplied subsystems: +</p> +<ul> +<li><b>files</b>. For hierarchical file systems resources. +<li><b>commands</b>. For remote commands. +<li><b>jobs</b>. For remote jobs. +</ul> +<br> +The IBM-supplied subsystem for iSeries native file system objects also supports +these type categories: +<ul> +<li><b>LIBRARIES</b>. Set for libraries. +<li><b>OBJECTS</b>. Set for objects, excluding files. +<li><b>OBJECTFILES</b>. Set for file objects. Use <samp>OBJECTS*</samp> +to match on all objects. +<li><b>MEMBERS</b>. Set for data and source file members. +<li><b>RECORDS</b>. Set for record formats within files. +<li><b>FIELDS</b>. Set for fields within record formats. +<li><b>MESSAGE_DESCRIPTIONS</b>. Set for messages within message +files. +</ul> +<br> + + + + + + + One of the optional filters to scope the remote resources for +which the property page is to appear. +Specify as many of these optional filters like this as needed to explicitly scope +this property page element. + +<p> +This filter specifies a resource type, either simple or generic. +The resource types depends on the subsystem. The types +for IBM-supplied subsystems which support them are: +</p> +<ul> +<li><b>filesXXX</b>. Either <i>folder</i> or <i>file</i>. +<li><b>files400</b>. This is the object's type (for objects), +such as <i>*PGM</i>, or member's type (for members), +such as <i>RPGLE</i>. Since * is a valid character in an iSeries +object type, use %ast. instead of * to prevent wildcard matching. +For example, to prevent matching on both *PGM and *SRVPGM, use %ast.PGM +for the type. +</ul> +<br> + + + + + + + One of the optional filters to scope the remote resources for +which the property page is to appear. +Specify as many of these optional filters like this as needed to explicitly scope +this property page element. + +<p> +This filter specifies a simple or generic resource subtype to +match. Not all subsystems support subtypes for their resources. +The IBM-supplied subsystems that do support this are: +</p> +<ul> +<li>FilesXXX. This can be either <i>subfolder</i> for nested +folders only, or +<i>root</i> for the root folder or Windows' drives. +<li>Files400. For iSeries objects within a library, this is the +object's attribute. For members, this is either <i>DTA</i> or <i>SRC</i>. +For fields, this is the field's datatype (a single character). +</ul> +<br> + + + + + + + One of the optional filters to scope the remote resources for +which the property page is to appear. +Specify as many of these optional filters like this as needed to explicitly scope +this property page element. + +<p> +This filter specifies a simple or generic resource sub-subtype +to match. No IBM-supplied subsystems support sub-subtypes for +their resources today. +</p> + + + + + + + + + + + + The following is a simple example of a property page for +files or folders in any remote system type: +<h3>Example One</h3> +<p> +<pre> +<extension point="org.eclipse.rse.ui.propertyPages"> + <page + class="com.acme.myPropertyPage1" + id="com.acme.mypropertypage1" + name="Remote Folder and File Info" + typecategoryfilter="files"> + </page> +</extension> +</pre> +</p> + +The following refines the first example so it only applies +to files, versus folders, and only for local files: +<h3>Example Two</h3> +<p> +<pre> +<extension point="org.eclipse.rse.ui.propertyPages"> + <page + class="com.acme.myPropertyPage2" + id="com.acme.mypropertypage2" + name="Remote File Info" + typecategoryfilter="files" + typefilter="file" + subsystemfactoryid="ibm.filesLocal"> + </page> +</extension> +</pre> +</p> + +The following refines the second example so it only applies +to local Java files: +<h3>Example Three</h3> +<p> +<pre> +<extension point="org.eclipse.rse.ui.propertyPages"> + <page + class="com.acme.myPropertyPage3" + id="com.acme.mypropertypage3" + name="Remote Java File Info" + typecategoryfilter="files" + typefilter="file" + subsystemfactoryid="ibm.filesLocal" + namefilter="*.java"> + </page> +</extension> +</pre> +</p> + + +<p> +Remember, you can repeat the <samp>page</samp> elements as needed, to define +multiple property pages within the same extension configuration. +</p> + + + + + + + + + Your actions must all implement the interface <samp>org.eclipse.ui.IWorkbenchPropertyPage</samp>. +Typically, you will subclass one of the supplied base classes +for this extension point: +<ul> +<li><b>org.eclipse.rse.ui.ui.propertypages.SystemAbstractPropertyPageExtensionAction</b>, +in plugin org.eclipse.rse.ui. +Base class offering generic support for any remote resource property page, for any system type. +<li><b>org.eclipse.rse.ui.ui.propertypages.SystemAbstractRemoteFilePropertyPageExtensionAction</b>, +in plugin org.eclipse.rse.ui. +Specialized base class offering specific support for any remote file or folder property page, for any system type. +<li><b>com.ibm.etools.iseries.core.ui.actions.isv.ISeriesAbstractIFSPropertyPageExtensionAction</b>, +in plugin com.ibm.etools.iseries.core. +Specialized base class offering specific support for iSeries IFS file or folder property pages. +<li><b>com.ibm.etools.iseries.core.ui.actions.isv.ISeriesAbstractQSYSPropertyPageExtensionAction</b>, +in plugin com.ibm.etools.iseries.core. +Specialized base class offering specific support for property pages for iSeries objects in the QSYS file system. +</ul> +<br> + + + + + + + + + There is no supplied implementation for this extension point. + + + + + + + + + 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 + +Contributors: +IBM Corporation - initial API and implementation + + + + diff --git a/rse/plugins/org.eclipse.rse.ui/schema/remoteSystemsViewPreferencesAction.exsd b/rse/plugins/org.eclipse.rse.ui/schema/remoteSystemsViewPreferencesAction.exsd new file mode 100644 index 00000000000..659d0549eda --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/schema/remoteSystemsViewPreferencesAction.exsd @@ -0,0 +1,186 @@ + + + + + + + + + This extension point is for contributing an action to the Remote Systems view pulldown menu, to the Preferences cascading menu. This action will launch the Preferences dialog, scoped to the particular page you specify. This will automatically show any child pages as well. This point is easy to extend, no coding required. Just name the preference page by its id from the preferencePages extension that defined the page. Also, if it is not a root page, then you must also name the root page (such as when using Windows-&gt;Preference) by its id from its preferencePages extension. + +This would be used by anyone who extends the Remote System Explorer, and offers preference pages for their users, and wants a shortcut to those preference pages for convenience. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A unique identifier for this extension. + + + + + + + The display name for the action, shown in the menu. Include any mnenomnic if desired. + + + + + + + This matches the "id" attribute on the preferencePages extension, for the preference page you wish to show in the Preference Dialog for this action. If the preference page is a root (no "category" attribute in its preferencePages extension), this is all you need. Else, you also need to specify the preferencePageCategory attribute. + +Note this page will be shown as the root in the Preferences dialog, but it can be expanded to see its child nodes. + + + + + + + This is required if the preference page you wish to show is not a root page, which means if it has a "category" attribute in its preferencePage extension definition. If so, here you give the "id" value of the preference page's root page... not its immediate parent! Be careful. We need to know the id of the root page so we know which root to recursively search the children of to find the page you specified in the preferencePageId attribute. + + + + + + + A relative path to an icon that will be displayed in the menu, with the label. Optional + + + + + + + A description of the action, for display on the status line, although it doesn't seem to work just yet. Optional + + + + + + + The id of help to be shown when F1 is pressed while this action is selected. Optional + + + + + + + + + + + + WSWB 3.0, or WSSD/WSAD/WDSC 5.1.2 + + + + + + + + + <extension point="org.eclipse.rse.ui.remoteSystemsViewPreferencesActions"> + <action + id="org.eclipse.rse.ui.preferences.actions.rse" + label="%PreferencePageAction.rse.label" + preferencePageId="org.eclipse.rse.ui.ui.preferences.RemoteSystemsPreferencePage" + tooltip="%PreferencePageAction.rse.tooltip" + helpContextId="org.eclipse.rse.ui.aprefrse" + /> +</extension> + +<extension point="org.eclipse.rse.ui.remoteSystemsViewPreferencesActions"> + <action + id="com.ibm.etools.iseries.core.preferences.rse" + label="%PreferencePageAction.rse.label" + preferencePageId="com.ibm.etools.iseries.core.ui.preferences.ISeriesPreferencePage" + preferencePageCategory="org.eclipse.rse.ui.ui.preferences.RemoteSystemsPreferencePage" + tooltip="%PreferencePageAction.rse.tooltip" + helpContextId="com.ibm.etools.iseries.core.aprefrse" + /> + <action + id="com.ibm.etools.iseres.core.preferences.lpex" + label="%PreferencePageAction.lpex.label" + preferencePageId="com.ibm.etools.iseries.editor.preferences.ISeriesEditorGeneralPreferencePage" + preferencePageCategory="org.eclipse.rse.ui.ui.preferences.RemoteSystemsPreferencePage" + tooltip="%PreferencePageAction.lpex.tooltip" + helpContextId="com.ibm.etools.iseries.core.apreflpx" + /> + <action + id="com.ibm.etools.iseres.core.preferences.cache" + label="%PreferencePageAction.cache.label" + preferencePageId="com.ibm.etools.iseries.core.ui.preferences.ISeriesCachePreferencePage" + preferencePageCategory="org.eclipse.rse.ui.ui.preferences.RemoteSystemsPreferencePage" + tooltip="%PreferencePageAction.cache.tooltip" + helpContextId="com.ibm.etools.iseries.core.aprefcch" + /> +</extension> + + + + + + + + + Since no coding is required, there is no API information. + + + + + + + + + This extension point is used by the <code>org.eclipse.rse.ui.ui.actions.SystemCascadingPreferencesAction</code> class, which in turn creates a <code>org.eclipse.rse.ui.ui.actions.SystemShowPreferencesPageAction</code> object for each extension of this point. These are used to populate the Preferences cascading menu of the Remote Systems view pulldown, but could be used elsewhere too, if desired. + + + + + + + + + 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 + +Contributors: +IBM Corporation - initial API and implementation + + + + diff --git a/rse/plugins/org.eclipse.rse.ui/schema/rseConfigDefaults.exsd b/rse/plugins/org.eclipse.rse.ui/schema/rseConfigDefaults.exsd new file mode 100644 index 00000000000..00ee61496cf --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/schema/rseConfigDefaults.exsd @@ -0,0 +1,142 @@ + + + + + + + + + This extension point is for products that include RSE, which want to affect some of the out of box defaults for RSE. Some of these can be overridden by users (for example, through preferences). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The product ID of the product that is setting the RSE default configuration. RSE will query the product ID of the platform and check for a match with the given ID. + + + + + + + Specify true to show the New Connection prompt in the Remote Systems view by default, false to not show it. Users can still override this via preferences. The default is true. + + + + + + + Specify true to pre-create a Local connection for new users, false not to do this. The default is true. + + + + + + + Specify comma-separated list of system types to enable. Specify the system type names, not translated. These are not case sensitive. All other system types will be disabled, but user can enable them via preferences. Disabled system types do not appear in the New Connection wizard. + + + + + + + Specify true to show the profile name wizard page in the New Connection wizard, or false to not show it. The default is true. If this is set to false, then RSE will create a profile with the name same as the machine name of the workstation, and create the first connection in that profile. + + + + + + + + + + + + 6.2.0 + + + + + + + + + <h3>Example One</h3> +The following is an example of how to turn off the showing of the new connection prompt: +<p> +<pre> +<extension point="org.eclipse.rse.ui.rseConfigDefaults"> + <defaults id="xyz" productId="com.mycompany.myproduct" showNewConnectionPrompt="false" showLocalConnection="true" + enableSystemTypes="Local;Power Linux;Unix;iSeries"> + </defaults> +</extension> +</pre> +</p> + + + + + + + + + Not applicable + + + + + + + + + Not applicable + + + + + + + + + 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 + +Contributors: +IBM Corporation - initial API and implementation + + + + diff --git a/rse/plugins/org.eclipse.rse.ui/schema/subsystemConfiguration.exsd b/rse/plugins/org.eclipse.rse.ui/schema/subsystemConfiguration.exsd new file mode 100644 index 00000000000..477872c16d2 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/schema/subsystemConfiguration.exsd @@ -0,0 +1,253 @@ + + + + + + + + + This extension point allows tool-writers to extend the capability +of the Remote System Explorer, +by identifying a subsystem configuration that produces a subsystem +whenever a new connection is created. +This subsystem appears under the connection when it is expanded +in the Remote Systems view of +the Remote System Explorer perspective. The subsystem configuration +is called by the Remote System +framework when the user creates a new connection, when the connection's +system type is one of the +types identified as supported by this subsystem configuration extension. + +<p> +There is one subsystem +object per connection, and the role of a subsystem is to allow +users to work with remote resources +for the remote system identified by the containing connection. +Defining a subsystem configuration involves more than the single subsystem +configuration class. There must +also be a subsystem class defined, and a system class defined. +There may also be other classes +defined, such as classes for the content area of wizards for +defining filters, user actions +and compile commands, if the subsystem configuration wishes to support +these. See the developer documentation for the Remote System Explorer +for documentation details on defining +subsystems. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This element defines a subsystem configuration to the Remote System Explorer framework. + + + + + + + A unique ID for this subsystem configuration. This will be used as a folder name for +information contained by the subsystem configuration, or by any of its subsystems. + + + + + + + Name of the vendor supplying this subsystem configuration. + + + + + + + The icon to dipslay for subsystems of this configuration, when not connected. +Specify the path of the .gif file, relative to your plugin directory. + + + + + + + The icon to display for subsystems of this configuration, when there is a live connection. This +is usually derived from the normal icon, but adorned with a bright green arrow. Specify +a path to the icon's .gif file, relative to your plugin directory. + + + + + + + A class that implements <samp>com.ibm.etools.systems.subsystems.SubSystemFactory</samp>, +or better yet extends <samp>com.ibm.etools.systems.dftsubsystem.impl.DefaultSubSystemFactoryImpl</samp>. + + + + + + + + + + Translatable name for subsystems created by this configuration. These appear immediately +under a connection when the connection is expanded in the Remote Systems view of the +Remote System Explorer perspective. + + + + + + + Translatable description for subsystems created by this configuration. These appear in configuration + and properties pages for subsystems. + + + + + + + A semi-colon separated list of system types that subsystems from this configuration support. +For example, "Windows;Unix;Linux". If not specified, defaults to all system types. + + + + + + + This optional attribute allows subsystem providers to classify +the type of remote resources +that are listed by this subsystem configuration. It is possible for +multiple subsystem factories to +support the same remote resource category. This category is used +in the popupMenus and +propertyPages extension points, to scope actions and property +pages to only remote resources +of a particular category, via their <samp>subsystemconfigurationCategory</samp> attribute. +For example, if listing database resources +you might specify a +category of "database". +IBM-supplied categories include "files", "cmds" and "jobs". + + + + + + + Optional. Only used when naming an IBM-supplied subsystem configuration in the <samp>class</samp> attribute, when you want to subclass or replace the IBM-supplied ISystem object used to manage the live connection with the remote system. Name a class that implements <samp>com.ibm.etools.systems.subsystems.ISystem</samp>, +or extends the appropriate IBM-supplied class such as <samp>com.ibm.etools.systems.universal.UniversalSystem</samp> for unix, windows and system types. + + + + + + + + + + + + + + + Example of using this extension point: + +<p> +<pre> + <extension + point="org.eclipse.rse.ui.subsystemconfiguration"> + <configuration + systemtypes="Unix;Linux;Local" + name="Databases" + icon="icons/dbsubsys.gif" + iconlive="icons/dbsubsyslive.gif" + id="com.acme.etools.mypkg.myconfiguration" + class="com.acme.etools.db.DBSubSystemFactory" + category="databases" + vendor="ACME" + > + </configuration> + </extension> +</pre> +</p> + +<p>Defining the xml for the extension point is easy. There is a fair amount to know about +creating the classes needed for a subsystem configuration, however. For this information, consult +the Remote System Explorer developer documention, including the JavaDoc for the supplied +classes and interfaces for this task. +</p> + + + + + + + + + The provider of subsystem factories must implement the interface +<samp>com.ibm.etools.systems.subsystems.SubSystemFactory</samp>, +although it is not recommended to create a new class from scratch. +Rather, it is highly recommended +to use the supplied base class <samp>org.eclipse.rse.core.subsystems.SubSystemConfiguration</samp>. +This base class pre-supplies much functionality, including support for +persisting properties and metadata, and support for filters. + + + + + + + + + All supplied subsystems are implemented via use of this extension point. +See the <samp>plugin.xml</samp> files for plugins +<samp>org.eclipse.rse.subsystems.files.dstore</samp> and +<samp>org.eclipse.rse.subsystems.processes.dstore</samp> +for examples. + + + + + + + + + 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 + +Contributors: +IBM Corporation - initial API and implementation + + + + diff --git a/rse/plugins/org.eclipse.rse.ui/schema/systemtype.exsd b/rse/plugins/org.eclipse.rse.ui/schema/systemtype.exsd new file mode 100644 index 00000000000..7a76b454db3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/schema/systemtype.exsd @@ -0,0 +1,160 @@ + + + + + + + + + This extension point is used in combination with the org.eclipse.rse.ui.subsystemfactory +extension point for defining new subsystems, which appear under a connection when it is expanded in the +Remote Systems view. The systemtype extension point allows subsystem providers to define a new system +type that appears in the list of valid system types in the New Connection wizard, used by users when defining +a new connection to a remote system. The system type is simply a string identifying the operating system +type, such as Solaris, and an pair of icons used to identify connections to systems of this type. One +icon is used when the connection is not connected, while the other is used when there is a live connection. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A unique identifier for this extension. + + + + + + + The display name for the system type, such as "Solaris". IBM pre-defines a number of system types, although they may not appear until a subsystem factory is registered against that type. These are the IBM-supplied system types: +<ul> +<li>Local</li> +<li>Windows</li> +<li>Unix</li> +<li>Linux</li> +<li>AIX</li> +<li>Power Linux</li> +<li>iSeries</li> +<li>z/OS</li> +</ul> + + + + + + + A relative path to an icon that will be used when displaying connections to systems of this type. + + + + + + + A relative path to an icon that will be used when displaying connections to systems of this type, +when there is a live connection to the remote system. This is usually a derivation of the icon +attribute, adorned with a bright green arrow. + + + + + + + Whether this system type can be put in offline mode. This decides whether to show the Work Offline action for connections of this type. This is an optional attribute, the default value is false. + + + + + + + A short description of the system type. Shows up in preferences for system type. + + + + + + + + + + + + The following is an example of the extension point schema: +<p> +<pre> + <extension point="org.eclipse.rse.ui.systemtype"> + <type id="com.acme.systemtype.Solaris" + name="Solaris" + iconlive="icons/solarisLive.gif" + icon="icons/solaris.gif"> + </type> + </extension> +</pre> +</p> + + + + + + + + + There is no code to implement for this extension point. + + + + + + + + + See the plugin.xml file for plugin org.eclipse.rse.ui for examples of using this extension point. + + + + + + + + +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 + +Contributors: +IBM Corporation - initial API and implementation + + + + diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/AbstractCacheManager.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/AbstractCacheManager.java new file mode 100644 index 00000000000..85534bd8b54 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/AbstractCacheManager.java @@ -0,0 +1,44 @@ +/******************************************************************************** + * 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.core.internal.subsystems; + +import org.eclipse.rse.core.subsystems.ICacheManager; + +/** + * Abstract implementation of ICacheManager. Can be used by cache manager to provide some + * basic caching helper methods. + */ +public abstract class AbstractCacheManager implements ICacheManager { + + + private boolean restoreFromMemento = false; + + /* (non-Javadoc) + * @see org.eclipse.rse.core.subsystems.ICacheManager#setRestoreFromMemento(boolean) + */ + public void setRestoreFromMemento(boolean restore) { + restoreFromMemento = restore; + } + + /* (non-Javadoc) + * @see org.eclipse.rse.core.subsystems.ICacheManager#isRestoreFromMemento() + */ + public boolean isRestoreFromMemento() { + return restoreFromMemento; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/AbstractResource.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/AbstractResource.java new file mode 100644 index 00000000000..b6592e02afd --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/AbstractResource.java @@ -0,0 +1,80 @@ +/******************************************************************************** + * 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.core.internal.subsystems; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.rse.core.subsystems.ISubSystem; + + +/** + * This class can be used as the base class for model objects that represent + * remote resources returned from the subsystem via resolveFilterStrings. Its + * advantages are: + *

      + *
    • It already implements IAdaptable. + *
    • It already maintains the reference to the owning subsystem, which simplifies action processing. + *
    + */ +public abstract class AbstractResource implements IAdaptable +{ + private ISubSystem parentSubSystem; + + /** + * Default constructor + */ + public AbstractResource(ISubSystem parentSubSystem) + { + super(); + this.parentSubSystem = parentSubSystem; + } + /** + * Constructor. + * @see #setSubSystem(ISubSystem) + */ + public AbstractResource() + { + super(); + } + + /** + * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class) + */ + public Object getAdapter(Class adapter) + { + return Platform.getAdapterManager().getAdapter(this, adapter); + } + + /** + * Returns the parent SubSystem which produced this remote resource. + * @return SubSystem + */ + public ISubSystem getSubSystem() + { + return parentSubSystem; + } + + /** + * Resets the parent SubSystem. + * @param parentSubSystem The parentSubSystem to set + */ + public void setSubSystem(ISubSystem parentSubSystem) + { + this.parentSubSystem = parentSubSystem; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/IBMServerLauncherConstants.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/IBMServerLauncherConstants.java new file mode 100644 index 00000000000..9fadf7fa05a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/IBMServerLauncherConstants.java @@ -0,0 +1,56 @@ +/******************************************************************************** + * 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.core.internal.subsystems; + +import org.eclipse.rse.core.ISystemTypes; + +/** + * This interface defines constants for IBM Server Launcher. + */ +public interface IBMServerLauncherConstants +{ + + /** + * Default daemon port, 4035. + */ + public static final int DEFAULT_DAEMON_PORT = 4035; + + /** + * Default REXEC port, 512. + */ + public static final int DEFAULT_REXEC_PORT = 512; + + /** + * Default REXEC path, "/opt/rseserver/". + */ + public static final String DEFAULT_REXEC_PATH = "/opt/rseserver/"; + + /** + * Linux REXEC script command, "perl ./server.linux". + */ + public static final String LINUX_REXEC_SCRIPT = "perl ./server." + ISystemTypes.SYSTEMTYPE_LINUX.toLowerCase(); + + /** + * Unix REXEC script command, "./server.unix". + */ + public static final String UNIX_REXEC_SCRIPT = "./server." + ISystemTypes.SYSTEMTYPE_UNIX.toLowerCase(); + + /** + * Default REXEC script command. TIt is equivalent to LINUX_REXEC_SCRIPT. + */ + public static final String DEFAULT_REXEC_SCRIPT = LINUX_REXEC_SCRIPT; +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/ServerLauncher.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/ServerLauncher.java new file mode 100644 index 00000000000..755949e3321 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/ServerLauncher.java @@ -0,0 +1,109 @@ +/******************************************************************************** + * 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.core.internal.subsystems; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.IConnectorService; +import org.eclipse.rse.core.subsystems.IServerLauncherProperties; +import org.eclipse.rse.internal.model.RSEModelObject; +import org.eclipse.rse.model.IPropertySet; +import org.eclipse.rse.ui.SystemResources; + + +public abstract class ServerLauncher extends RSEModelObject implements IServerLauncherProperties +{ + + + protected String _name; + protected IConnectorService _connectorService; + + protected ServerLauncher(String name, IConnectorService service) + { + super(); + _name = name; + _connectorService = service; + } + + public String getName() + { + return _name; + } + + public String getDescription() + { + return SystemResources.RESID_MODELOBJECTS_SERVERLAUNCHER_DESCRIPTION; + } + + public IConnectorService getConnectorService() + { + return _connectorService; + } + + /** + * Clone the contents of this server launcher into the given server launcher + * Your sublcass must override this if you add additional attributes! Be sure + * to call super.cloneServerLauncher(newOne) first. + * @return the given new server launcher, for convenience. + */ + public IServerLauncherProperties cloneServerLauncher(IServerLauncherProperties newOne) + { + newOne.addPropertySets(getPropertySets()); + return newOne; + } + + /** + * @deprecated + * @param vendorName + * @param attributeName + * @param attributeValue + */ + public void setVendorAttribute(String vendorName, + String attributeName, String attributeValue) + { + IPropertySet set = getPropertySet(vendorName); + if (set == null) + { + set = createPropertySet(vendorName, ""); + } + set.addProperty(attributeName, attributeValue); + } + + /** + * @deprecated use property sets directly now + */ + public String getVendorAttribute(String vendor, String attributeName) + { + IPropertySet set = getPropertySet(vendor); + if (set != null) + { + return set.getPropertyValue(attributeName); + } + else + { + return null; + } + } + + + + public boolean commit() + { + return SystemPlugin.getThePersistenceManager().commit(getConnectorService().getHost()); + } + + + +} //ServerLauncherImpl \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/SubSystemConfigurationProxy.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/SubSystemConfigurationProxy.java new file mode 100644 index 00000000000..40b71d915db --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/SubSystemConfigurationProxy.java @@ -0,0 +1,361 @@ +/******************************************************************************** + * 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.core.internal.subsystems; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.StringTokenizer; +import java.util.Vector; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.subsystems.IConnectorService; +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.ui.ISystemIconConstants; +import org.osgi.framework.Bundle; + + +/** + * Represents a registered subsystem factory extension. + */ +public class SubSystemConfigurationProxy implements ISubSystemConfigurationProxy +{ + private String name,description,id,types,vendor, category, systemClassName; + private String[] systemTypes; + private List typesArray; + private boolean allTypes = false; + private ImageDescriptor image, liveImage; + private IConfigurationElement element = null; + private ISubSystemConfiguration object = null; + private boolean firstSubSystemQuery = true; + //private SystemLogFile logFile = null; + + + /** + * Constructor + * @param element The IConfigurationElement for this factory's plugin + */ + public SubSystemConfigurationProxy(IConfigurationElement element) { + this.element = element; + this.id = element.getAttribute("id"); + this.name = element.getAttribute("name").trim(); + this.description = element.getAttribute("description").trim(); + this.types = element.getAttribute("systemtypes"); + this.vendor = element.getAttribute("vendor"); + this.category = element.getAttribute("category"); + this.systemClassName = element.getAttribute("systemClass"); + String className = element.getAttribute("class"); + if (vendor == null) vendor = "Unknown"; + if (category == null) category = "Unknown"; + if (types == null) types = "*"; + this.allTypes = types.equals("*"); + this.image = getPluginImage(element, element.getAttribute("icon")); + if (this.image == null) this.image = SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_CONNECTION_ID); + this.liveImage = getPluginImage(element, element.getAttribute("iconlive")); + if (this.liveImage == null) this.liveImage = SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_CONNECTIONLIVE_ID); + //createFolderTree(); + } + /** + * Return the value of the "vendor" attribute + */ + public String getVendor() + { + return vendor; + } + /** + * Return the value of the "name" attribute + */ + public String getName() + { + return name; + } + /** + * Return the value of the "description" attribute + */ + public String getDescription() + { + return description; + } + /** + * Return the value of the "id" attribute + */ + public String getId() + { + return id; + } + /** + * Return all defined system types + */ + public String[] getSystemTypes() + { + if (systemTypes == null) + { + if (allTypes) + systemTypes = SystemPlugin.getDefault().getSystemTypeNames(true); + else + { + StringTokenizer tokens = new StringTokenizer(types,";"); + Vector v = new Vector(); + while (tokens.hasMoreTokens()) + v.addElement(tokens.nextToken()); + systemTypes = new String[v.size()]; + for (int idx=0; idx + * Returns "filterPools_"+managerName by default. + */ + public String getManagerSaveFileName(String managerName) + { + return super.getManagerSaveFileName(managerName); + } + /** + * Get the unqualified save file name for the given SystemFilterPoolReferenceManager object. + * Do NOT include the extension, as .xmi will be added. + *

    + * Returns "filterPoolRefs_"+managerName by default. + */ + public String getReferenceManagerSaveFileName(String managerName) + { + return super.getReferenceManagerSaveFileName(managerName); + } + /** + * Get the unqualified save file name for the given SystemFilterPool object. + * Do NOT include the extension, as .xmi will be added. + *

    + * Returns getFilterPoolSaveFileNamePrefix()+poolName by default. + */ + public String getFilterPoolSaveFileName(String poolName) + { + return super.getFilterPoolSaveFileName(poolName); + } + /** + * Get the file name prefix for all pool files. + * Used to deduce the saved pools by examining the file system + *

    + * By default returns "filterPool_" + */ + public String getFilterPoolSaveFileNamePrefix() + { + return super.getFilterPoolSaveFileNamePrefix(); + } + /** + * Get the folder name for the given SystemFilterPool object. + *

    + * Returns getFilterPoolFolderNamePrefix()+poolName by default. + */ + public String getFilterPoolFolderName(String poolName) + { + return super.getFilterPoolFolderName(poolName); + } + /** + * Get the folder name prefix for all pool folders. + * Used to deduce the saved pools by examining the file system + *

    + * By default returns "FilterPool_" + */ + public String getFilterPoolFolderNamePrefix() + { + return super.getFilterPoolFolderNamePrefix(); + } + /** + * Get the unqualified save file name for the given SystemFilter object. + * Do NOT include the extension, as .xmi will be added. + *

    + * Returns getFilterSaveFileNamePrefix()+filterName by default. + */ + public String getFilterSaveFileName(String filterName) + { + return super.getFilterSaveFileName(filterName); + } + /** + * Get the file name prefix for all filter files. + * Used to deduce the saved filters by examining the file system + *

    + * Returns "Filter_" by default. + */ + public String getFilterSaveFileNamePrefix() + { + return super.getFilterSaveFileNamePrefix(); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/servicesubsystem/IServiceSubSystem.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/servicesubsystem/IServiceSubSystem.java new file mode 100644 index 00000000000..50b6f3d0942 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/servicesubsystem/IServiceSubSystem.java @@ -0,0 +1,26 @@ +/******************************************************************************** + * 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.core.servicesubsystem; + +import org.eclipse.rse.core.subsystems.ISubSystem; + + +public interface IServiceSubSystem extends ISubSystem +{ + public Class getServiceType(); + public void switchServiceFactory(IServiceSubSystemConfiguration factory); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/servicesubsystem/IServiceSubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/servicesubsystem/IServiceSubSystemConfiguration.java new file mode 100644 index 00000000000..ba0c8181066 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/servicesubsystem/IServiceSubSystemConfiguration.java @@ -0,0 +1,40 @@ +/******************************************************************************** + * 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.core.servicesubsystem; + + +import org.eclipse.rse.core.subsystems.IConnectorService; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.services.IService; + + + +/** + * This is the interface for the class that is for subsystem-providers who desire not to use MOF. + * + * @lastgen interface DefaultSubSystemFactory extends SubSystemFactory {} + */ +public interface IServiceSubSystemConfiguration extends ISubSystemConfiguration +{ + public IConnectorService getConnectorService(IHost host); + public void setConnectorService(IHost host, IConnectorService connectorService); + public Class getServiceType(); + public Class getServiceImplType(); + public IService getService(IHost host); + +} //DefaultSubSystemFactory \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/servicesubsystem/ServiceSubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/servicesubsystem/ServiceSubSystemConfiguration.java new file mode 100644 index 00000000000..c7183189946 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/servicesubsystem/ServiceSubSystemConfiguration.java @@ -0,0 +1,264 @@ +/******************************************************************************** + * 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.core.servicesubsystem; + +import java.util.Vector; + +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.core.subsystems.SubSystemConfiguration; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.ui.wizards.ISystemNewConnectionWizardPage; +import org.eclipse.swt.widgets.Shell; + + + +/** + * This class is to be used by subsystem-providers that do not desire to use MOF/EMF. It is + * therefore recommended starting base class for subsystem providers. + *
    + * To use this class, simply subclass it and override the appropriate methods in it, such as:

    + *
      + *
    • any of the supportsXXX() configuration methods you wish to change. + *
    • {@link #createSubSystemInternal(SystemConnection)}, to instantiate your subsystem class. + *
    • {@link #getAdditionalSubSystemActions(ISubSystem,Shell)}, to supply your own subsystem popup menu actions + *
    • {@link #getNewFilterPoolFilterAction(ISystemFilterPool,Shell)}, to supply your own New->Filter popup menu action and + *
    • {@link #getChangeFilterAction(ISystemFilter,Shell)}, to supply your own Change Filter popup menu action. + *
    + *

    + * This class is typically used together with:

    + *
      + *
    • {@link org.eclipse.rse.core.servicesubsystem.SeviceSubSystem} for the subsystem + *
    • {@link org.eclipse.rse.core.internal.subsystems.AbstractSystem} for the system + *
    • {@link org.eclipse.rse.core.internal.subsystems.AbstractSystemManager} for the system manager + *
    • {@link org.eclipse.rse.core.internal.subsystems.AbstractResource} for the individual remote resources + *
    + *

    + * In general, for what methods to override, only worry about the non-generated methods in + * this class, and ignore the hundreds in {@link org.eclipse.rse.core.subsystems.SubSystemConfiguration} + * + * @see org.eclipse.rse.core.servicesubsystem.SeviceSubSystem + * @see org.eclipse.rse.core.internal.subsystems.AbstractSystem + * @see org.eclipse.rse.core.internal.subsystems.AbstractSystemManager + */ + +public abstract class ServiceSubSystemConfiguration extends SubSystemConfiguration implements IServiceSubSystemConfiguration +{ + + protected ServiceSubSystemConfiguration() + { + super(); + } + + // ------------------------------------------------------ + // CONFIGURATION METHODS THAT ARE OVERRIDDEN FROM PARENT + // WE ASSUME TYPICAL DEFAULTS, BUT CHILDREN CAN OVERRIDE + // ------------------------------------------------------ + /** + * Overridable configuration method. Default is false
    + * Return true if instance of this factory's subsystems support connect and disconnect actions. + */ + public boolean supportsSubSystemConnect() + { + return true; + } + + /** + * Overridable configuration method. Default is true
    + * Return true (default) or false to indicate if subsystems of this factory support user-editable + * port numbers. + */ + public boolean isPortEditable() + { + return true; + } + /** + * Overridable configuration method. Default is true
    + * Required method for subsystem factory child classes. Return true if you support filters, false otherwise. + * If you support filters, then some housekeeping will be done for you automatically. Specifically, they + * will be saved and restored for you automatically. + */ + public boolean supportsFilters() + { + return true; + } + /** + * Overridable configuration method. Default is false
    + * Do we allow filters within filters? + */ + public boolean supportsNestedFilters() + { + return false; + } + /** + * COverridable configuration method. Default is false
    + * Return true if you support user-defined actions for the remote system objects returned from expansion of + * subsystems created by this subsystem factory + */ + public boolean supportsUserDefinedActions() + { + return false; + } + /** + * Overridable configuration method. Default is false
    + * Return true if you support user-defined/managed named file types + */ + public boolean supportsFileTypes() + { + return false; + } + /** + * Overridable configuration method. Default is false
    + * Tell us if filter strings are case sensitive. + */ + public boolean isCaseSensitive() + { + return false; + } + /** + * Overridable configuration method. Default is false
    + * Tell us if duplicate filter strings are supported per filter. + */ + public boolean supportsDuplicateFilterStrings() + { + return false; + } + + // ------------------------------------------------ + // FRAMEWORKD METHODS TO BE OVERRIDDEN IF APPROPRIATE. + // THESE ARE CALLED BY OUR OWN PARENT + // ------------------------------------------------ + + /** + * Overridable lifecycle method. Not typically overridden.
    + * After a new subsystem instance is created, the framework calls this method + * to initialize it. This is your opportunity to set default attribute values. + * + *

    The reason for the connect wizard pages parm is in case your factory contributes a page to that wizard, + * whose values are needed to set the subsystem's initial state. For example, you might decide to add a + * page to the connection wizard to prompt for a JDBC Driver name. If so, when this method is called at + * the time a new connection is created apres the wizard, your page will have the user's value. You can + * thus use it here to initialize that subsystem property. Be use to use instanceof to find your particular + * page. + *

    + * + *

    + * If you override this, PLEASE CALL SUPER TO DO DEFAULT INITIALIZATION! + * + * @param subsys - The subsystem that was created via createSubSystemInternal + * @param yourNewConnectionWizardPages - The wizard pages you supplied to the New Connection wizard, via the + * {@link #getNewConnectionWizardPages(org.eclipse.jface.wizard.IWizard)} method or null if you didn't override this method. + * Note there may be more pages than you originally supplied, as you are passed all pages contributed + * by this factory object, including subclasses. Null on a clone operation. + * + * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#getNewConnectionWizardPages(org.eclipse.jface.wizard.IWizard) + */ + protected void initializeSubSystem(ISubSystem subsys,ISystemNewConnectionWizardPage[] yourNewConnectionWizardPages) + { + super.initializeSubSystem(subsys, yourNewConnectionWizardPages); + } + /** + * Overridable lifecycle method. Typically overridden to supply a default filter.
    + * When the user creates a new profile in the RSE (which is mapped to a SystemFilterPoolManager + * by our parent class), each subsystem factory that supports filters is asked if it wants to + * create a default system filter pool in that profile.
    + * This is the method that is called to do that default filter pool creation in the new profile. + *

    + * By default we create an empty filter pool with a generated name, and no pre-defined filters. + * If you don't want that behaviour, override this method and do one of the following:

    + *
      + *
    • nothing if you don't want your subsystem factory to have a default filter pool in the new profile
    • . + *
    • call super.createDefaultFilterPool(mgr) to get the default pool, and then than call mgr.createSystemFilter(pool,...) to create + * each filter and add it to the filter pool, if you want to pre-populate the default pool with + * default filters. + *
    + */ + protected ISystemFilterPool createDefaultFilterPool(ISystemFilterPoolManager mgr) + { + ISystemFilterPool pool = null; + try { + // ----------------------------------------------------- + // create a pool named filters + // ----------------------------------------------------- + pool = mgr.createSystemFilterPool(getDefaultFilterPoolName(mgr.getName(), getId()), true); // true=>is deletable by user + } catch (Exception exc) + { + SystemBasePlugin.logError("Error creating default filter pool in default subsystem factory",exc); + } + return pool; + } + + // -------------------------------- + // METHODS FOR SUPPLYING ACTIONS... + // -------------------------------- + /** + * Overridable method for getting Remote System view popup menu actions.
    + * Called by {@link org.eclipse.rse.ui.view.SystemView SystemView} when constructing + * the popup menu for a selected subsystem. + *

    + * For contributing popup menu actions to subsystem objects, beyond the + * default actions already supplied by our parent class. This method is only called with + * subsystems created by this subsystem factory. + *

    + * Returns null by default. Override to show your own popup menu actions for your own subsystems. + * + * @return Vector of IAction objects, which usually are subclasses of {@link org.eclipse.rse.ui.actions.SystemBaseAction SystemBaseAction} or + * {@link org.eclipse.rse.ui.actions.SystemBaseDialogAction SystemBaseDialogAction} or + * {@link org.eclipse.rse.ui.actions.SystemBaseWizardAction SystemBaseWizardAction} or + * {@link org.eclipse.rse.ui.actions.SystemBaseSubMenuAction SystemBaseSubMenuAction}. + */ + protected Vector getAdditionalSubSystemActions(ISubSystem selectedSubSystem, Shell shell) + { + return null; + } + + + /** + * Optionally overridable method affecting the visual display of objects within subsystems created by this factory.
    + * Return the translated string to show in the property sheet for the "type" property, for the selected + * filter. This method is only called for filters within subsystems created by this subsystem factory. + *

    + * Returns a default string, override if appropriate. + */ + public String getTranslatedFilterTypeProperty(ISystemFilter selectedFilter) + { + return super.getTranslatedFilterTypeProperty(selectedFilter); + } + /** + * Overridable method for getting Remote System view popup menu actions. Called by {@link org.eclipse.rse.ui.view.SystemView SystemView} + * when constructing the popup menu for a selected filter.
    + * This method is only called for filters within subsystems created by this subsystem factory.
    + * By default, this returns null. Override if appropriate. + * + * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#getFilterActions(ISystemFilter,Shell) + * + * @return Vector of IAction objects, which usually are subclasses of {@link org.eclipse.rse.ui.actions.SystemBaseAction SystemBaseAction} or + * {@link org.eclipse.rse.ui.actions.SystemBaseDialogAction SystemBaseDialogAction} or + * {@link org.eclipse.rse.ui.actions.SystemBaseWizardAction SystemBaseWizardAction} or + * {@link org.eclipse.rse.ui.actions.SystemBaseSubMenuAction SystemBaseSubMenuAction}. + */ + protected Vector getAdditionalFilterActions(ISystemFilter selectedFilter, Shell shell) + { + return null; + } + + + + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/servicesubsystem/SeviceSubSystem.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/servicesubsystem/SeviceSubSystem.java new file mode 100644 index 00000000000..1b91ff3487a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/servicesubsystem/SeviceSubSystem.java @@ -0,0 +1,174 @@ +/******************************************************************************** + * 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.core.servicesubsystem; + + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.rse.core.subsystems.IConnectorService; +import org.eclipse.rse.core.subsystems.SubSystem; +import org.eclipse.rse.model.IHost; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.dialogs.PropertyPage; + + + + +public abstract class SeviceSubSystem extends SubSystem implements IServiceSubSystem +{ + + /** + * Constructor + * Subclasses must call this via super(). + */ + protected SeviceSubSystem(IHost host, IConnectorService connectorService) + { + super(host, connectorService); + } + + // ------------------------------------- + // GUI methods + // ------------------------------------- + /** + * Optionally override in order to supply a property sub-page to the tabbed + * notebook in the owning connection's Properties page. + * + * Return the single property page to show in the tabbed notebook for the + * for SubSystem property of the parent Connection object, in the Remote Systems + * view.
    + * Return null if no page is to be contributed for this. You are limited to a single + * page, so you may have to compress. It is recommended you prompt for the port + * if applicable since the common base subsystem property page is not shown + * To help with this you can use the {@link org.eclipse.rse.ui.widgets.SystemPortPrompt} widget. + *
    + * Returns null by default. + */ + public PropertyPage getPropertyPage(Composite parent) + { + return null; + } + + + // ---------------------------------- + // METHODS THAT MUST BE OVERRIDDEN... + // ---------------------------------- + + + /** + * Remote-accessing method, that does nothing by default. Override if filter strings are supported.
    + * Resolve an absolute filter string. This is only applicable if the subsystem + * factory reports true for {@link org.eclipse.rse.core.subsystems.SubSystemConfiguration#supportsFilters()}, + * which is the default. Otherwise, {@link org.eclipse.rse.core.subsystems.SubSystem#getChildren()} + * is called when the subsystem itself is expanded. + *

    + * When a user expands a filter this method is invoked for each filter string and the + * results are concatenated and displayed to the user. You can affect the post-concatenated + * result by overriding {@link #sortResolvedFilterStringObjects(Object[])} if you desire to + * sort the result, say, or pick our redundancies. + *

    + * The resulting objects are displayed in the tree in the Remote System {@link org.eclipse.rse.ui.view.SystemView view}. + * There are two requirements on the returned objects:

    + *
      + *
    1. They must implement {@link org.eclipse.core.runtime.IAdaptable}. + *
    2. Their must be an RSE {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter remote-adapter} registered + * for the object's class or interface type. Further, if this subsystem is {@link org.eclipse.rse.core.subsystems.SubSystemConfiguration#isVisible() visible} + * in the RSE, which is the default, then there must also be an RSE {@link org.eclipse.rse.ui.view.ISystemViewElementAdapter GUI-adapter} registered + * with the platform. The base class implementation of this interface is {@link org.eclipse.rse.ui.view.AbstractSystemViewAdapter}. + *
    + *

    A good place to start with your remote-resource classes to subclasss {@link org.eclipse.rse.core.internal.subsystems.AbstractResource}, as it + * already implements IAdaptable, and maintains a reference to this owning subsystem, which helps when + * implementing the {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter remote-adapter}. + *

    + * Be sure to register your adapter factory in your plugin's startup method. + *

    + * As per IRunnableWithProgress rules: + *

      + *
    • if the user cancels (monitor.isCanceled()), throw new InterruptedException() + *
    • if something else bad happens, throw new java.lang.reflect.InvocationTargetException(exc); + *
    • do not worry about calling monitor.done() ... caller will do that! + *
    + * YOU MUST OVERRIDE THIS IF YOU SUPPORT FILTERS! + * + * @param monitor - the progress monitor in effect while this operation performs + * @param filterString - one of the filter strings from the expanded filter + */ + protected Object[] internalResolveFilterString(IProgressMonitor monitor, String filterString) + throws java.lang.reflect.InvocationTargetException, + java.lang.InterruptedException + { + return null; + } + + /** + * Remote-accessing method, that does nothing by default. Override if filter strings are supported.
    + * + * Resolve a relative filter string. + *

    + * When a user expands a remote resource this method is invoked and the + * results are potentially sorted and displayed to the user. You can affect the sorting + * behaviour by overriding {@link #sortResolvedFilterStringObjects(Object[])} if you desire to + * sort the result, say, or pick our redundancies. This is only called if the parent object's adapter indicated it can have children. + *

    + * The resulting objects are displayed in the tree in the Remote System {@link org.eclipse.rse.ui.view.SystemView view}. + * There are two requirements on the returned objects:

    + *
      + *
    1. They must implement {@link org.eclipse.core.runtime.IAdaptable}. + *
    2. Their must be an RSE {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter remote-adapter} registered + * for the object's class or interface type. Further, if this subsystem is {@link org.eclipse.rse.core.subsystems.SubSystemConfiguration#isVisible() visible} + * in the RSE, which is the default, then there must also be an RSE {@link org.eclipse.rse.ui.view.ISystemViewElementAdapter GUI-adapter} registered + * with the platform. The base class implementation of this interface is {@link org.eclipse.rse.ui.view.AbstractSystemViewAdapter}. + *
    + *

    A good place to start with your remote-resource classes to subclasss {@link org.eclipse.rse.core.internal.subsystems.AbstractResource}, as it + * already implements IAdaptable, and maintains a reference to this owning subsystem, which helps when + * implementing the {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter remote-adapter}. + *

    + * Be sure to register your adapter factory in your plugin's startup method. + * + *

    + * As per IRunnableWithProgress rules: + *

      + *
    • if the user cancels (monitor.isCanceled()), throw new InterruptedException() + *
    • if something else bad happens, throw new java.lang.reflect.InvocationTargetException(exc); + *
    • do not worry about calling monitor.done() ... caller will do that! + *
    + * YOU MUST OVERRIDE THIS IF YOU SUPPORT FILTERS! + * + * @param monitor - the progress monitor in effect while this operation performs + * @param parent - the parent resource object being expanded + * @param filterString - typically defaults to "*". In future additional user-specific quick-filters may be supported. + */ + protected Object[] internalResolveFilterString(IProgressMonitor monitor, Object parent, String filterString) + throws java.lang.reflect.InvocationTargetException, + java.lang.InterruptedException + { + return null; + } + + + // ------------------------ + // MOF GENERATED METHODS... + // ------------------------ + + /** + * Private method. Do not override or call.
    + * @see org.eclipse.emf.ecore.InternalEObject //GENERICRULES.JSED - replaces InternalEObject. Is this needed? // #refSetValueForEnumAttribute(EAttribute, EEnumLiteral, EEnumLiteral) + * + public void refSetValueForEnumAttribute(EAttribute arg0,EEnumLiteral arg1,EEnumLiteral arg2) + { + super.refSetValueForEnumAttribute(arg0, arg1, arg2); + }*/ + +} //DefaultSubSystemImpl \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/AbstractConnectorService.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/AbstractConnectorService.java new file mode 100644 index 00000000000..9e314802ffa --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/AbstractConnectorService.java @@ -0,0 +1,1105 @@ +/******************************************************************************** + * 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.core.subsystems; +import java.util.ArrayList; +import java.util.List; +import java.util.Vector; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.rse.core.ISystemUserIdConstants; +import org.eclipse.rse.core.PasswordPersistenceManager; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.internal.model.RSEModelObject; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.SystemSignonInformation; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.dialogs.ISignonValidator; +import org.eclipse.rse.ui.dialogs.ISystemPasswordPromptDialog; +import org.eclipse.rse.ui.dialogs.SystemPasswordPromptDialog; +import org.eclipse.rse.ui.messages.SystemMessageDialog; +import org.eclipse.rse.ui.validators.ISystemValidator; +import org.eclipse.swt.widgets.Shell; + + +/** + * This is a base class to make it easier to create system classes. + *

    + * An {@link org.eclipse.rse.core.subsystems.IConnectorService} object is returned from a subsystem object via getSystem(), and + * it is used to represent the live connection to a particular subsystem. + *

    + * All this could have been done in the subsystem object, but that would clutter it + * up too much. + *

    + * You must override/implement + *

      + *
    • isConnected + *
    • internalConnect + *
    • internalDisconnect + *
    + * You should override: + *
      + *
    • reset + *
    • getVersionReleaseModification + *
    • getHomeDirectory + *
    • getTempDirectory + *
    + * + * @see org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager + */ +public abstract class AbstractConnectorService extends RSEModelObject implements IConnectorService, ISystemUserIdConstants +{ + + private ISubSystem _primarySubSystem; + private List _registeredSubSystems; + private String _name, _description; + private int _port; + private String _userId; + private boolean _usingSSL; + private IHost _host; + + /** + * The cached value of the '{@link #getRemoteServerLauncher() Remote Server Launcher}' containment reference. + * + * + * @see #getRemoteServerLauncher() + * @generated + * @ordered + */ + protected IServerLauncherProperties _remoteServerLauncherProperties = null; + + + private transient SystemSignonInformation _passwordInfo; + protected Shell shell; + private Vector commListeners = new Vector(5); + private IServerLauncher starter; + /** + * The result of calling launch in the server launcher object, in the connect method + */ + protected Object launchResult; + /** + * The result of calling connect in the server launcher object, in the connect method + */ + protected Object connectResult; + + // dy: March 24, 2003 Added _suppressSignonPrompt flag to suppress prompting the + // user to signon if they already cancelled signon. Then intent is to allows tools + // writers to prevent multiple signon prompts during a "transaction" if the user cancel + // the first signon prompt + private boolean _suppressSignonPrompt = false; + + + public AbstractConnectorService(String name, String description, IHost host, int port) + { + super(); + _name = name; + _description = description; + _port = port; + _host = host; + _registeredSubSystems = new ArrayList(); + } + + + /** + * Not implemented, you should override if possible.
    + * Return the version, release, modification of the remote system, + * if connected, if applicable and if available. Else return null. It + * is up to each subsystem to decide how to interpret what is returned.
    + * This is used to show the VRM in the property sheet, when the subsystem is selected. + *

    + * Up to each implementer to decide if this will be cached. + *

    + * Returns an empty string by default, override if possible + */ + public String getVersionReleaseModification() + { + return ""; + } + /** + * Not implemented, you should override if possible.
    + * Return the home directory of the remote system for the current user, if available. + *

    + * Up to each implementer to decide how to implement, and if this will be cached. + *

    + * Returns an empty string by default, override if possible + */ + public String getHomeDirectory() + { + return ""; + } + /** + * Not implemented, you should override if possible.
    + * Return the temp directory of the remote system for the current user, if available. + *

    + * Up to each implementer to decide how to implement, and if this will be cached. + *

    + * Returns an empty string by default, override if possible + */ + public String getTempDirectory() + { + return ""; + } + + /** + * Set the subsystem, when its not known at constructor time + */ + public void registerSubSystem(ISubSystem ss) + { + if (!_registeredSubSystems.contains(ss)) + { + _registeredSubSystems.add(ss); + } + } + + /** + * Removes the subsystem from teh list + * @param ss + */ + public void deregisterSubSystem(ISubSystem ss) + { + _registeredSubSystems.remove(ss); + } + + // ------------------ + // Utility methods... + // ------------------ + + public ISubSystem[] getSubSystems() + { + return (ISubSystem[])_registeredSubSystems.toArray(new ISubSystem[_registeredSubSystems.size()]); + } + + public ISubSystem getPrimarySubSystem() + { + if (_primarySubSystem == null) + { + ISubSystem ss = (ISubSystem)_registeredSubSystems.get(0); + _primarySubSystem = ss.getPrimarySubSystem(); + } + return _primarySubSystem; + } + + public IHost getHost() + { + return _host; + } + + /** + * Useful utility method. Fully implemented, do not override.
    + * Returns the system type for this connection:
    getSubSystem().getSystemConnection().getSystemType() + */ + public String getHostType() + { + return getHost().getSystemType(); + } + + /** + * + */ + public String getName() + { + return _name; + } + + public String getDescription() + { + return _description; + } + + /** + * Useful utility method. Fully implemented, do not override.
    + * Returns the host name for the connection this system's subsystem is associated with:
    + * getSubSystem().getSystemConnection().getHostName() + */ + public String getHostName() + { + return getHost().getHostName(); + } + + + /** + * Useful utility method. Fully implemented, do not override.
    + * Returns the user Id for this system's subsystem we are associated with. + * This is the same as {@link #getLocalUserId()}, but first clears the local + * user Id cache if we are not currently connected. + */ + public String getUserId() + { + if (_userId != null) + { + return _userId; + } + + return getLocalUserId(); + } + + public void setUserId(String newId) + { + if (!_userId.equals(newId)) + { + _userId = newId; + setDirty(true); + } + } + + public void setHost(IHost host) + { + _host = host; + } + + /** + * Useful utility method. Fully implemented, do not override.
    + * Return the userId for this systems' subsystem we are associated with. If there + * is no local user Id value here, then it is queried from the subsystem. However, + * if we are connected then the user may have termporarily changed his userId on + * the userId/password prompt dialog, in which that temp value is stored here in + * a local cache and this method will return it, versus the persistent user Id stored + * in the subsystem. + */ + protected String getLocalUserId() + { + if (_userId == null) + { + _userId = System.getProperty("user.name"); + } + return _userId; + } + + /** + * Useful utility method. Fully implemented, do not override.
    + * Clear internal userId cache. Called when user uses the property dialog to + * change his userId. By default, sets internal userId value to null so that on + * the next call to getUserId() it is requeried from subsystem. + * Also calls {@link #clearPasswordCache()}. + */ + public void clearUserIdCache() + { + _userId = null; + clearPasswordCache(); + } + + /** + * Useful utility method. Fully implemented, do not override.
    + * Clear internal password cache. Called when user uses the property dialog to + * change his userId. This method does not remove the password from the disk + * cache - only the memory cache. + * + * @see #clearUserIdCache() + */ + public void clearPasswordCache() + { + clearPasswordCache(false); + } + + /** + * Useful utility method. Fully implemented, do not override.
    + * Clear internal password cache. Called when user uses the property dialog to + * change his userId. + * + * @param onDisk if this is true, clear the password from the disk cache as well + * @see #clearUserIdCache(boolean) + */ + public void clearPasswordCache(boolean onDisk) + { + setPasswordInformation(null); + + if (onDisk) + { + // now get rid of userid/password from disk + String systemType = getHostType(); + String hostName = getHostName(); + if (_userId != null) + PasswordPersistenceManager.getInstance().remove(systemType, hostName, _userId); + } + + if (shareUserPasswordWithConnection()) + { + // clear this uid/password with other ISystems in connection + clearPasswordForOtherSystemsInConnection(_userId, onDisk); + } + } + + + /** + * Useful utility method. Fully implemented, do not override.
    + * Return true if password is currently cached. + */ + public boolean isPasswordCached(boolean onDisk) + { + boolean cached = (getPasswordInformation() != null); + if (!cached && onDisk) + { + // now check if cached on disk + String systemType = getHostType(); + String hostName = getHostName(); + String userId = getUserId(); + if (userId != null) + { + return PasswordPersistenceManager.getInstance().passwordExists(systemType, hostName, getUserId()); + } + } + return cached; + } + + /** + * Useful utility method. Fully implemented, do not override.
    + * Return true if password is currently cached. + */ + public boolean isPasswordCached() + { + return isPasswordCached(false); + } + + /** + * Return true if this system can inherit the uid and password of + * other ISystems in this connection + * + * @return true if it can inherit the user/password + */ + public boolean inheritConnectionUserPassword() + { + return true; + } + + /* + * Return true if this system can share it's uid and password + * with other ISystems in this connection + * + * @return true if it can share the user/password + */ + public boolean shareUserPasswordWithConnection() + { + return true; + } + + /** + * Method used internally, and available externally. Fully implemented, do not override.
    + * Return the password for this system's subsystem we are associated with. + *

    + * The search order for the password is as follows:

    + *
      + *
    1. First check if the password is in transient memory and that it is still valid. + *
    2. If password not found in transient memory then check password on disk and + * verify that it is still valid. + *
    3. If a valid password is not found in transient memory or on disk then prompt + * the user. + *
    + * Throws InterruptedException if user is prompted and user cancels that prompt. + * + * @param shell parent for the prompt dialog if needed. Can be null if know password exists. + */ + public void promptForPassword(Shell shell, boolean forcePrompt) + throws InterruptedException + { + // dy: March 24, 2003: check if prompting is temporarily suppressed by a tool + // vendor, this should only be suppressed if the user cancelled a previous signon + // dialog (or some other good reason) + if (isSuppressSignonPrompt()) + { + throw new InterruptedException(); + } + + SystemSignonInformation passwordInformation = getPasswordInformation(); + // 1a. Check the transient in memory password ... + // Test if userId has been changed... d43274 + String oldUserId = getUserId(); + if (passwordInformation != null && !forcePrompt) + { + boolean same = getPrimarySubSystem().getHost().compareUserIds(oldUserId, passwordInformation.getUserid()); + String hostName = getHostName();//SystemPlugin.getQualifiedHostName(getHostName()); + same = same && hostName.equalsIgnoreCase(passwordInformation.getHostname()); + if (!same) + { + clearPasswordCache(); + passwordInformation = null; + } + } + + + + // 1b. If a transient in memory password was found, test if it is still valid ... + // but don't issue a message yet, just set a flag + boolean pwdInvalidFlag = false; + if (passwordInformation != null && + getSignonValidator() != null && + !getSignonValidator().isValid(shell, passwordInformation)) + { + pwdInvalidFlag = true; + clearPasswordCache(); + passwordInformation = null; + } + + // 2a. Check the saved passwords if we still haven't found a good password. + if (passwordInformation == null && getLocalUserId() != null && !forcePrompt) + { + setPasswordInformation(PasswordPersistenceManager.getInstance().find(getHostType(), getHostName(), getLocalUserId())); + passwordInformation = getPasswordInformation(); + + // 2b. Check if saved passwordInfo is still valid + if (passwordInformation != null + && getSignonValidator() != null + && !getSignonValidator().isValid(shell, passwordInformation)) + { + pwdInvalidFlag = true; + clearPasswordCache(); + passwordInformation = null; + } + } + + // If we had a saved password (in memory or on disk) that was invalid the tell the user + if ((passwordInformation == null) && (pwdInvalidFlag == true)) + { + SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_INVALID); + msg.makeSubstitution(getLocalUserId(), getHostName()); + SystemMessageDialog dialog = new SystemMessageDialog(shell, msg); + dialog.open(); + } + + // Valid password not found so prompt, or force prompt + if (forcePrompt || ((passwordInformation == null) && (shell != null))) + { + ISystemPasswordPromptDialog dlg = getPasswordPromptDialog(shell); + dlg.setSystemInput(this); + + SystemSignonInformation passInfo = PasswordPersistenceManager.getInstance().find(getHostType(), getHostName(), getLocalUserId()); + if (passInfo != null) + { + String password = passInfo.getPassword(); + dlg.setPassword(password); + } + + // Check if password was saved, if so preselect the save checkbox + if (getLocalUserId() != null) + { + dlg.setSavePassword(PasswordPersistenceManager.getInstance().passwordExists(getHostType(), getHostName(), getLocalUserId())); + } + + try + { + dlg.open(); + } + catch (Exception e) + { + e.printStackTrace(); + } + if (!dlg.wasCancelled()) + { + boolean userIdChanged = dlg.getIsUserIdChanged(); + if (userIdChanged) + { + String newUserId = dlg.getUserId(); + boolean userIdChangePermanent = dlg.getIsUserIdChangePermanent(); + if (userIdChangePermanent) + { + updateDefaultUserId(getPrimarySubSystem(), newUserId); + } + else + { + setUserId(newUserId); + _userId = newUserId; + } + } + boolean persistPassword = dlg.getIsSavePassword(); + setPassword(dlg.getUserId(), dlg.getPassword(), persistPassword); + + if (shareUserPasswordWithConnection()) + { + // share this uid/password with other ISystems in connection + updatePasswordForOtherSystemsInConnection(dlg.getUserId(), dlg.getPassword(), persistPassword); + } + } + else + throw new InterruptedException(); + } + //return password; + } + + + protected void clearPasswordForOtherSystemsInConnection(String uid, boolean fromDisk) + { + if (uid != null) + { + IHost connection = getHost(); + ISystemRegistry registry = SystemPlugin.getTheSystemRegistry(); + ISubSystem[] subsystems = registry.getSubSystems(connection); + + List uniqueSystems = new ArrayList(); + for (int i = 0; i < subsystems.length; i++) + { + IConnectorService system = subsystems[i].getConnectorService(); + if (system != this && system.inheritConnectionUserPassword()) + { + if (!uniqueSystems.contains(system)) + { + uniqueSystems.add(system); + } + } + } + + for (int s = 0; s < uniqueSystems.size(); s++) + { + IConnectorService system = (IConnectorService)uniqueSystems.get(s); + if (system.isPasswordCached(fromDisk)) + { + system.clearPasswordCache(fromDisk); + } + } + } + } + + + protected void updatePasswordForOtherSystemsInConnection(String uid, String password, boolean persistPassword) + { + IHost connection = getPrimarySubSystem().getHost(); + ISystemRegistry registry = SystemPlugin.getTheSystemRegistry(); + ISubSystem[] subsystems = registry.getSubSystems(connection); + + List uniqueSystems = new ArrayList(); + for (int i = 0; i < subsystems.length; i++) + { + IConnectorService system = subsystems[i].getConnectorService(); + if (system != this && system.inheritConnectionUserPassword()) + { + if (!uniqueSystems.contains(system)) + { + uniqueSystems.add(system); + } + } + } + + for (int s = 0; s < uniqueSystems.size(); s++) + { + IConnectorService system = (IConnectorService)uniqueSystems.get(s); + if (!system.isConnected() && !system.isPasswordCached()) + { + if (system.getPrimarySubSystem().forceUserIdToUpperCase()) + { + system.setPassword(uid.toUpperCase(), password.toUpperCase(), persistPassword); + } + else + { + system.setPassword(uid, password, persistPassword); + } + } + } + } + + + + /** + * Change the default user Id value in the SubSystem if it is non-null, + * else update it in the Connection object + */ + private void updateDefaultUserId(ISubSystem subsystem, String userId) + { + if (subsystem.getLocalUserId() != null) // defect 42709 + { + subsystem.getSubSystemConfiguration(). + updateSubSystem(shell, subsystem, true, userId, false, 0); + } + // it seems intuitive to update the connection object. defect 42709. Phil + else + { + int whereToUpdate = USERID_LOCATION_CONNECTION; + IHost conn = subsystem.getHost(); + ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry(); + sr.updateHost(null, conn, conn.getSystemType(), conn.getAliasName(), + conn.getHostName(), conn.getDescription(), userId, whereToUpdate); + } + } + + /** + * A default implementation is supplied, but can be overridden if desired.
    + * Instantiates and returns the dialog to prompt for the userId. + *

    + * By default returns an instance of SystemPasswordPromptDialog. + * Calls forcePasswordToUpperCase() to decide whether the + * user Id and password should be folded to uppercase. + *

    + * Calls {@link #getUserIdValidator()} and {@link #getPasswordValidator()} + * to set the validators. These return null by default by you can override them. + *

    + * Before calling open() on the dialog, the getPassword(Shell) method that calls this will + * call setSystemInput(this). + *

    + * After return, it will call wasCancelled() and getUserId(), getIsUserIdChanged(), getIsUserIdChangePermanent() + * and getPassword(). + *

    + * + * @return An instance of a dialog class that implements the ISystemPasswordPromptDialog interface + */ + protected final ISystemPasswordPromptDialog getPasswordPromptDialog(Shell shell) + { + ISystemPasswordPromptDialog dlg = new SystemPasswordPromptDialog(shell); + dlg.setForceToUpperCase(forcePasswordToUpperCase()); + //dlg.setBlockOnOpen(true); now done by default in SystemPromptDialog + dlg.setUserIdValidator(getUserIdValidator()); + dlg.setPasswordValidator(getPasswordValidator()); + dlg.setSignonValidator(getSignonValidator()); + return dlg; + } + + /** + * Useful utility method. Fully implemented, no need to override.
    + * Return the password information for this system's subsystem we are associated with. + * This is transient. Assumes it has been set already. The password stored in + * SystemSignonInformation is encrypted. + */ + protected SystemSignonInformation getPasswordInformation() + { + return _passwordInfo; + } + + /** + * Useful utility method. Fully implemented, no need to override.
    + * Sets the password information for this system's subsystem. + */ + protected void setPasswordInformation(SystemSignonInformation passwordInfo) + { + _passwordInfo = passwordInfo; + if (passwordInfo != null) + { + _userId = passwordInfo.getUserid(); + } + } + + /** + * Useful utility method. Fully implemented, no need to override.
    + * Set the password if you got it from somewhere + */ + public void setPassword(String matchingUserId, String password, boolean persist) + { + if (getPrimarySubSystem().forceUserIdToUpperCase()) + { + matchingUserId = matchingUserId.toUpperCase(); + } + + SystemSignonInformation tempPasswordInfo = new SystemSignonInformation(getHostName(), matchingUserId, + password, getHostType()); + setPasswordInformation(tempPasswordInfo); + + // if password should be persisted, then add to disk + if (persist) { + PasswordPersistenceManager.getInstance().add(tempPasswordInfo, true, true); + } + // otherwise, remove from both memory and disk + else { + // now get rid of userid/password from disk + String systemType = getHostType(); + String hostName = getHostName(); + PasswordPersistenceManager.getInstance().remove(systemType, hostName, _userId); + } + } + + /** + * Useful utility method. Fully implemented, no need to override.
    + * Set the password if you got it from somewhere + */ + public void setPassword(String matchingUserId, String password) + { + setPassword(matchingUserId, password, false); + } + + /** + * Useful utility method. Fully implemented, no need to override.
    + * Should passwords be folded to uppercase? + * By default, returns: + *

    getSubSystem().forceUserIdToUpperCase()
    + */ + protected boolean forcePasswordToUpperCase() + { + return getPrimarySubSystem().forceUserIdToUpperCase(); + } + + /** + * Useful utility method. Fully implemented, no need to override.
    + * Get the userId input validator to use in the password dialog prompt. + *

    + * By default, returns

    + *
    getSubSystem().getParentSubSystemFactory().getUserIdValidator()
    + */ + public ISystemValidator getUserIdValidator() + { + return getPrimarySubSystem().getSubSystemConfiguration().getUserIdValidator(); + } + /** + * Useful utility method. Fully implemented, no need to override.
    + * Get the password input validator to use in the password dialog prompt. + *

    + * By default, returns:

    + *
    getSubSystem().getParentSubSystemFactory().getPasswordValidator()
    + */ + public ISystemValidator getPasswordValidator() + { + return getPrimarySubSystem().getSubSystemConfiguration().getPasswordValidator(); + } + /** + * Optionally overridable, not implemented by default.
    + * Get the signon validator to use in the password dialog prompt. + * By default, returns null. + */ + public ISignonValidator getSignonValidator() + { + return null; + } + + + // --------------------------------------------------- + // methods that must be overridden by child classes... + // --------------------------------------------------- + + + /** + * This connection method wrappers the others (internal connect) so that registered subsystems can be notified and initialized after a connect + * Previous implementations that overrode this method should now change + * their connect() method to internalConnect() + * + */ + public final void connect(IProgressMonitor monitor) throws Exception + { + internalConnect(monitor); + intializeSubSystems(monitor); + } + + protected void intializeSubSystems(IProgressMonitor monitor) + { + for (int i = 0; i < _registeredSubSystems.size(); i++) + { + ISubSystem ss = (ISubSystem)_registeredSubSystems.get(i); + ss.initializeSubSystem(monitor); + } + } + + /** + * Abstract - you must override, unless subsystem.getParentSubSystemFactory().supportsServerLaunchProperties + * returns true + *

    + * Attempt to connect to the remote system.
    + * If the subsystem supports server launch, + * the default behaviour here is to get the remote server launcher via + * {@link #getRemoteServerLauncher()}, and if {@link IServerLauncher#isLaunched()} + * returns false, to call {@link IServerLauncher#launch(IProgressMonitor)}. + *

    + * This is called, by default, from the connect(...) methods of the subsystem. + */ + protected void internalConnect(IProgressMonitor monitor) throws Exception + { + if (supportsServerLaunchProperties()) + { + starter = getRemoteServerLauncher(); + starter.setSignonInformation(getPasswordInformation()); + starter.setServerLauncherProperties(getRemoteServerLauncherProperties()); + launchResult = null; + if (!starter.isLaunched()) + { + try { + launchResult = starter.launch(monitor); + } catch (Exception exc) { + throw new java.lang.reflect.InvocationTargetException(exc); + } + } + connectResult = null; + try { + connectResult = starter.connect(monitor, getConnectPort()); + } catch (Exception exc) { + throw new java.lang.reflect.InvocationTargetException(exc); + } + } + } + /** + * Return the port to use for connecting to the remote server, once it is running. + * By default, this is the subsystem's port property, via {@link #getPort()}. + * Override if appropriate. + *
    This is called by the default implementation of {@link #connect(IProgressMonitor)}, if + * subsystem.getParentSubSystemFactory().supportsServerLaunchProperties() is true. + */ + protected int getConnectPort() + { + return getPort(); + } + + /** + * Disconnects from the remote system. + *

    + * You must override + * if subsystem.getParentSubSystemFactory().supportsServerLaunchProperties + * returns false. + *

    + * If the subsystem supports server launch + * the default behavior is to use the same remote server + * launcher created in connect() and call disconnect(). + *

    + * This is called, by default, from the disconnect() + * method of the subsystem. + * @see IServerLauncher#disconnect() + */ + public void disconnect() throws Exception + { + if (supportsServerLaunchProperties() && + (starter != null)) + { + try { + starter.disconnect(); + starter = null; // for now, to be safe. Maybe we could optimize. + } catch (Exception exc) { + throw new java.lang.reflect.InvocationTargetException(exc); + } + } + } + + + // ----------------------------------------------------- + // Methods that should be overridden by child classes... + // ----------------------------------------------------- + /** + * Return the remote server launcher, which implements IServerLauncher. + * This is called by the default implementation of connect() and disconnect(), if + * subsystem.getParentSubSystemFactory().supportsServerLaunchProperties returns true. + *

    This returns null be default! + */ + public IServerLauncher getRemoteServerLauncher() + { + return null; + } + + /** + * Optionally override if you add any instance variables.
    + * The following is called whenever a system is redefined or disconnected. + * Each subsystem needs to be informed so it can clear out any expansions, etc. + * By default it does nothing. Override if you have an internal object that must be nulled out. + */ + public void reset() + { + } + + + /** + * Fully implemented, no need to override.
    + * @see IConnectorService#addCommunicationsListener(ICommunicationsListener) + */ + public void addCommunicationsListener(ICommunicationsListener listener) + { + if (!commListeners.contains(listener)) { + commListeners.add(listener); + } + } + + /** + * Fully implemented, no need to override.
    + * @see IConnectorService#removeCommunicationsListener(ICommunicationsListener) + */ + public void removeCommunicationsListener(ICommunicationsListener listener) + { + commListeners.remove(listener); + } + + + /** + * Private - used internally.
    + * Helper method for firing communication events + */ + protected void fireCommunicationsEvent(int eventType) + { + CommunicationsEvent e = new CommunicationsEvent(this, eventType); + + Object[] items = commListeners.toArray(); + + for (int loop=0; loop < items.length; loop++) { + ((ICommunicationsListener) items[loop]).communicationsStateChange(e); + } + + } + + /** + * Private - used internally.
    + * Returns the count of active communication listeners (i.e. excludes + * passive listeners.) + */ + protected int getCommunicationListenerCount() + { + int count = 0; + for (int i = 0; i < commListeners.size(); i++) + { + if (!((ICommunicationsListener) commListeners.get(i)).isPassiveCommunicationsListener()) + { + count++; + } + } + + return count; + } + /** + * Private - used internally.
    + */ + protected void clearCommunicationListeners() + { + commListeners.clear(); + } + + /** + * Returns the suppressSignonPrompt flag. If this is set to true then the user + * will not be prompted to signon, instead an InterruptedException will be thrown + * by the promptForPassword method. + * + * @return boolean + */ + public boolean isSuppressSignonPrompt() + { + return _suppressSignonPrompt; + } + + /** + * Sets the suppressSignonPrompt flag. Tool writers can use this to temporarily + * disable the user from being prompted to signon. This would cause the promptForPassword + * method to throw an InterruptedException instead of prompting. The intent of this + * method is to allow tool writeres to prevent multiple signon prompts during a + * set period of time (such as a series of related communication calls) if the user + * cancels the first prompt. It is the callers responsability to set this value + * back to false when the tool no longer needs to suppress the signon prompt or all + * other tools sharing this connection will be affected. + * + * @param suppressSignonPrompt + */ + public void setSuppressSignonPrompt(boolean suppressSignonPrompt) + { + _suppressSignonPrompt = suppressSignonPrompt; + } + + // ------------------------- + // PRIVATE HELPER METHODS... + // ------------------------- + /** + * Call this method to identify specific server launch types that are not to be permitted. + *

    + * You normally do not call this! Rather, your subsystem factory class will override + * {@link org.eclipse.rse.core.subsystems.SubSystemConfiguration#supportsServerLaunchType(ServerLaunchType)}. + * However, this method is needed by ISVs that re-use IBM-supplied subsystem factories, + * and merely supply their own ISystem object via the "systemClass" attribute of the + * subsystemconfiguration extension point. + * + * @see org.eclipse.rse.core.subsystems.ServerLaunchType + */ + protected void enableServerLaunchType(ISubSystem subsystem, ServerLaunchType serverLaunchType, boolean enable) + { + IServerLauncherProperties sl =getRemoteServerLauncherProperties(); + if (sl instanceof IBMServerLauncher) + { + IBMServerLauncher isl = (IBMServerLauncher)sl; + isl.enableServerLaunchType(serverLaunchType, enable); + } + } + /** + * This methods returns the enablement state per server launch type. + * If {@link #enableServerLaunchType(ServerLaunchType,boolean)} has not been + * called for this server launch type, then it is enabled by default. + * @see org.eclipse.rse.core.subsystems.ServerLaunchType + */ + protected boolean isEnabledServerLaunchType(ISubSystem subsystem, ServerLaunchType serverLaunchType) + { + IServerLauncherProperties sl = getRemoteServerLauncherProperties(); + if (sl instanceof IBMServerLauncher) + { + IBMServerLauncher isl = (IBMServerLauncher)sl; + return isl.isEnabledServerLaunchType(serverLaunchType); + } + else + return subsystem.getSubSystemConfiguration().supportsServerLaunchType(serverLaunchType); + } + + /* (non-Javadoc) + * @see org.eclipse.rse.core.subsystems.IConnectorService#notifyDisconnection() + */ + public void notifyDisconnection() + { + + // Fire comm event to signal state changed + if (!isConnected()) fireCommunicationsEvent(CommunicationsEvent.AFTER_DISCONNECT); + } + + /* (non-Javadoc) + * @see org.eclipse.rse.core.subsystems.IConnectorService#notifyConnection() + */ + public void notifyConnection() + { + if (isConnected()) fireCommunicationsEvent(CommunicationsEvent.AFTER_CONNECT); + } + + /* (non-Javadoc) + * @see org.eclipse.rse.core.subsystems.IConnectorService#notifyError() + */ + public void notifyError() + { + fireCommunicationsEvent(CommunicationsEvent.CONNECTION_ERROR); + + } + + + public void setPort(int port) + { + if (port != _port) + { + _port = port; + setDirty(true); + } + } + + public int getPort() + { + return _port; + } + + public boolean isUsingSSL() + { + return _usingSSL; + } + + public void setIsUsingSSL(boolean flag) + { + if (_usingSSL != flag) + { + _usingSSL = flag; + setDirty(true); + } + } + + + public IServerLauncherProperties getRemoteServerLauncherProperties() + { + return _remoteServerLauncherProperties; + } + + + public void setRemoteServerLauncherProperties(IServerLauncherProperties newRemoteServerLauncher) + { + if (_remoteServerLauncherProperties != newRemoteServerLauncher) + { + _remoteServerLauncherProperties = newRemoteServerLauncher; + setDirty(true); + } + } + + public boolean hasRemoteSearchLauncherProperties() + { + return _remoteServerLauncherProperties != null; + } + + public boolean commit() + { + return SystemPlugin.getThePersistenceManager().commit(getHost()); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/AbstractConnectorServiceManager.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/AbstractConnectorServiceManager.java new file mode 100644 index 00000000000..2cffb0d1825 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/AbstractConnectorServiceManager.java @@ -0,0 +1,208 @@ +/******************************************************************************** + * 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.core.subsystems; +import java.util.Hashtable; +import java.util.Set; + +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.model.DummyHost; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.swt.widgets.Shell; + + +/** + * This class is only needed if you need/want to support multiple + * subsystems and want them to share a single {@link org.eclipse.rse.core.subsystems.IConnectorService ISystem} object per + * system connection. This is the base system manager implementation + * that returns the same ISystem object for all subsystems in the + * same system connection, which implement a given interface. + *

    + * For this to work all your subsystem classes that wish to share the + * same ISystem object must implement a common interface of your choosing. + *

    + * Another benefit of using this class or a subclass of it, is that whenever + * the user changes the core properties for a single subsystem (port, userId) + * then this manager is used to cascade that to all other subsystems in this + * connection which share that same common interface. This means the user can change + * these properties in any one subsystem, and they are changed in all related + * subsystems magically. This is necessary because while these properties are + * persisted in the subsystem object, they really belong to the ISystem object, + * so when multiple subsystems share an ISystem object, changes to these properties + * in one subsystem need to be cascaded to the other subsystems. + *

    + * Because you only need a singleton of these class, the constructor is protected. + *

    + * Your subclass must supply a method like the following:

    + *
    
    + * public static AbstractSystemManager getTheSystemManager()
    + *  {
    + *  	if (inst == null)
    + *  	  inst = new AbstractSystemManager();
    + *  	return inst;
    + *  }
    + * 
    + * Your {@link org.eclipse.rse.core.servicesubsystem.SeviceSubSystem SubSystem} class + * should then call this factory method in its {@link org.eclipse.rse.core.servicesubsystem.SeviceSubSystem#getSystemManager() getSystemManager()} method. + */ +public abstract class AbstractConnectorServiceManager implements IConnectorServiceManager +{ + + + // we maintain a hashtable of hashtables. The first is keyed by SystemConnection. + // The hashtable for each connection, maintains a list of ISystem objects keyed by + // a unique interface class object supplied by the subclasses. + private Hashtable systemConnectionRegistry = new Hashtable(); + + /** + * Protected constructor to ensure not instantiated this way. + * Use subclass-supplied static method getTheSystemFactory() instead. + */ + protected AbstractConnectorServiceManager() + { + } + + public void setConnectorService(IHost host, Class commonSSinterface, IConnectorService connectorService) + { + Hashtable connHT = (Hashtable)systemConnectionRegistry.get(host); + if (connHT == null) + { + connHT = new Hashtable(); + systemConnectionRegistry.put(host, connHT); + } + // replaces any previous service here + connHT.put(commonSSinterface, connectorService); + } + + public IConnectorService getConnectorService(IHost host, Class commonSSinterface) + { + Hashtable connHT = (Hashtable)systemConnectionRegistry.get(host); + if (connHT == null) + { + if (!(host instanceof DummyHost)) + { + connHT = findConnHTForDummyHost(host); + } + if (connHT == null) + { + connHT = new Hashtable(); + systemConnectionRegistry.put(host, connHT); + } + } + IConnectorService systemObject = (IConnectorService)connHT.get(commonSSinterface); + if (systemObject == null) + { + systemObject = createConnectorService(host); + connHT.put(commonSSinterface, systemObject); + } + else + { + IHost currentHost = systemObject.getHost(); + if (currentHost instanceof DummyHost && host != currentHost) + { + systemObject.setHost(host); + } + } + + return systemObject; + } + + protected Hashtable findConnHTForDummyHost(IHost newHost) + { + Set keyset = systemConnectionRegistry.keySet(); + Object[] keys = keyset.toArray(); + for (int i = 0; i < keys.length; i++) + { + Object key = keys[i]; + if (key instanceof DummyHost) + { + IHost host = (IHost)key; + if (host.getHostName().equals(newHost.getHostName())) + { + Hashtable table = (Hashtable)systemConnectionRegistry.remove(host); + systemConnectionRegistry.put(newHost, table); + return table; + } + } + } + return null; + } + + /** + * Return the actual ISystem object. Must be overridden by subclass. + */ + public abstract IConnectorService createConnectorService(IHost host); + + /** + * Given another subsystem, return true if that subsystem shares a single ISystem object + * with this one. You must override this to return true if you recognize that subsystem + * as one of your own. You are guaranteed the other subsystem will be from the same + * SystemConnection as this one. + *

    + * You can't assume a SystemConnection will only have subsystems that you created, + * so you should only return true if it implements your interface or you know it is an + * instance of your subsystem class. + *

    + * This should simply return (otherSubSystem instanceof interface) where interface is + * the same one returned from getSubSystemCommonInterface. + */ + public abstract boolean sharesSystem(ISubSystem otherSubSystem); + + /** + * For all subsystems in a particular SystemConnection, we need to know which + * ones are to share a single ISystem object. To do this, we need a key which + * is canonical for all subsystems in a given connection. This can be anything, + * but is typically a unique interface that all subsystems supported a shared + * ISystem object implement. + *

    + * Whatever is returned from here is used as the key into a hashtable to find the + * singleton ISystem object in getSystemObject. + *

    + * @param subsystem - rarely used, but if you support multiple common interfaces then this will help you + * decide which one to return. + * @return a common, yet unique to you, interface that all your subsystems implement. + */ + public abstract Class getSubSystemCommonInterface(ISubSystem subsystem); + + /** + * Internal use. Fully implemented, no need to override.
    + * Updates user-editable attributes of an existing subsystem instance. + * The goal of this method is to intercept the request and forward it on to all our + * subsystems in this SystemConnection, that share a single ISystem, + * so we keep them all in synch in terms of these two properties used + * by all ISystems. + * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#updateSubSystem(Shell,ISubSystem,boolean,String,boolean,Integer) + */ + public void updateSubSystems(Shell shell, ISubSystem subsystem, boolean updateUserId, String userId, boolean updatePort, int port) + { + ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry(); + IHost conn = subsystem.getHost(); + ISubSystem[] subsystems = sr.getSubSystems(conn); + if (subsystems != null) + { + for (int idx=0; idx + * This subclass of {@link IServerLauncherProperties} is for use by IBM-supplied subsystems, although + * is possibly of value to vendors as well. The IBM-supplied subsystems use server code + * written in Java, on top of the datastore technology. You can read about this in the + * developer guide for Remote System Explorer. The bottom line, however, is we offer the + * user a number of ways to start that remote server from the client, as well to connect + * to it if it is already running. This class encapsulates the properties to support that. + *

    + * Create instances via {@link org.eclipse.rse.core.subsystems.SubSystemConfiguration#createIBMServerLauncher(ISubSystem)} + * + *

    + * The following features are implemented: + *

      + *
    • {@link org.eclipse.rse.core.subsystems.IBMServerLauncher#getServerLaunchType Server Launch Type}
    • + *
    • {@link org.eclipse.rse.core.subsystems.IBMServerLauncher#getPort Port}
    • + *
    • {@link org.eclipse.rse.core.subsystems.IBMServerLauncher#getRexecPort Rexec Port}
    • + *
    • {@link org.eclipse.rse.core.subsystems.IBMServerLauncher#getDaemonPort Daemon Port}
    • + *
    • {@link org.eclipse.rse.core.subsystems.IBMServerLauncher#getServerPath Server Path}
    • + *
    • {@link org.eclipse.rse.core.subsystems.IBMServerLauncher#getServerScript Server Script}
    • + *
    • {@link org.eclipse.rse.core.subsystems.IBMServerLauncher#getIbmAttributes Ibm Attributes}
    • + *
    • {@link org.eclipse.rse.core.subsystems.IBMServerLauncher#getRestrictedTypes Restricted Types}
    • + *
    + *

    + * + * @generated + */ +public class IBMServerLauncher extends ServerLauncher implements IIBMServerLauncher +{ + + protected static final ServerLaunchType SERVER_LAUNCH_TYPE_EDEFAULT = ServerLaunchType.DAEMON_LITERAL; + + // proeprty set keys + protected final String PROPERTY_SET_NAME = "Launcher Properties"; + + protected final String KEY_DAEMON_PORT = "daemon.port"; + protected final String KEY_REXEC_PORT = "rexec.port"; + protected final String KEY_SERVER_LAUNCH_TYPE_NAME = "server.launch.type.name"; + protected final String KEY_SERVER_PATH = "server.path"; + protected final String KEY_SERVER_SCRIPT = "server.script"; + + + protected ServerLaunchType _serverLaunchType = SERVER_LAUNCH_TYPE_EDEFAULT; + + protected boolean _hasSetServerLaunchType = false; + + protected static final int REXEC_PORT_EDEFAULT = 512; + + protected int _rexecPort = REXEC_PORT_EDEFAULT; + + protected static final int DAEMON_PORT_EDEFAULT = 4035; + + protected int _daemonPort = DAEMON_PORT_EDEFAULT; + + protected static final String SERVER_PATH_EDEFAULT = null; + + protected String _serverPath = SERVER_PATH_EDEFAULT; + + protected static final String SERVER_SCRIPT_EDEFAULT = null; + + protected String _serverScript = SERVER_SCRIPT_EDEFAULT; + + protected static final String IBM_ATTRIBUTES_EDEFAULT = null; + + protected static final String RESTRICTED_TYPES_EDEFAULT = null; + + protected PropertyType _serverLauncherEnumType; + protected PropertyType _intPropertyType; + + protected IBMServerLauncher(String name, IConnectorService connectorService) + { + super(name, connectorService); + } + + public IPropertyType getIntegerPropertyType() + { + if (_intPropertyType == null) + { + _intPropertyType = new PropertyType(IPropertyType.TYPE_INTEGER); + } + return _intPropertyType; + } + + public IPropertyType getServerLauncherPropertyType() + { + if (_serverLauncherEnumType == null) + { + // for persistance + _serverLauncherEnumType = new PropertyType(IPropertyType.TYPE_ENUM); + List values = ServerLaunchType.VALUES; + String[] enumValues = new String[values.size()]; + for (int i = 0; i < values.size(); i++) + { + ServerLaunchType type = (ServerLaunchType)values.get(i); + enumValues[i] = type.getName(); + } + _serverLauncherEnumType.setEnumValues(enumValues); + } + return _serverLauncherEnumType; + } + + + public void restoreFromProperties() + { + IPropertySet set = getPropertySet(PROPERTY_SET_NAME); + if (set != null) + { + try + { + IProperty launchTypeProperty = set.getProperty(KEY_SERVER_LAUNCH_TYPE_NAME); + launchTypeProperty.setLabel(SystemResources.RESID_PROP_SERVERLAUNCHER_MEANS_LABEL); + String launchTypeName = launchTypeProperty.getValue(); + _serverLaunchType = ServerLaunchType.get(launchTypeName); + + IProperty daemonPortProperty = set.getProperty(KEY_DAEMON_PORT); + daemonPortProperty.setEnabled(_serverLaunchType.getType() == ServerLaunchType.DAEMON); + daemonPortProperty.setLabel(SystemResources.RESID_CONNECTION_DAEMON_PORT_LABEL); + + _daemonPort = Integer.parseInt(daemonPortProperty.getValue()); + + boolean usingRexec = _serverLaunchType.getType() == ServerLaunchType.REXEC; + IProperty rexecPortProperty = set.getProperty(KEY_REXEC_PORT); + rexecPortProperty.setEnabled(usingRexec); + rexecPortProperty.setLabel(SystemResources.RESID_CONNECTION_PORT_LABEL); + + _rexecPort = Integer.parseInt(rexecPortProperty.getValue()); + + IProperty serverPathProperty = set.getProperty(KEY_SERVER_PATH); + serverPathProperty.setEnabled(usingRexec); + serverPathProperty.setLabel(SystemResources.RESID_PROP_SERVERLAUNCHER_PATH); + _serverPath = serverPathProperty.getValue(); + + IProperty serverScriptProperty = set.getProperty(KEY_SERVER_SCRIPT); + serverScriptProperty.setEnabled(usingRexec); + serverScriptProperty.setLabel(SystemResources.RESID_PROP_SERVERLAUNCHER_INVOCATION); + _serverScript = serverScriptProperty.getValue(); + + _hasSetServerLaunchType = true; + + } + catch (Exception e) + { + e.printStackTrace(); + } + } + } + + public void saveToProperties() + { + IPropertySet set = getPropertySet(PROPERTY_SET_NAME); + if (set == null) + { + set = createPropertySet(PROPERTY_SET_NAME, getDescription()); + } + + IProperty launchTypeProperty = set.addProperty(KEY_SERVER_LAUNCH_TYPE_NAME, _serverLaunchType.getName(), getServerLauncherPropertyType()); + launchTypeProperty.setLabel(SystemResources.RESID_PROP_SERVERLAUNCHER_MEANS_LABEL); + + IProperty daemonPortProperty = set.addProperty(KEY_DAEMON_PORT, ""+_daemonPort, getIntegerPropertyType()); + daemonPortProperty.setEnabled(_serverLaunchType.getType() == ServerLaunchType.DAEMON); + daemonPortProperty.setLabel(SystemResources.RESID_CONNECTION_DAEMON_PORT_LABEL); + + IProperty rexecPortProperty = set.addProperty(KEY_REXEC_PORT, ""+_rexecPort, getIntegerPropertyType()); + boolean usingRexec = _serverLaunchType.getType() == ServerLaunchType.REXEC; + rexecPortProperty.setEnabled(usingRexec); + rexecPortProperty.setLabel(SystemResources.RESID_CONNECTION_PORT_LABEL); + + IProperty serverPathProperty = set.addProperty(KEY_SERVER_PATH, ""+_serverPath); + serverPathProperty.setLabel(SystemResources.RESID_PROP_SERVERLAUNCHER_PATH); + serverPathProperty.setEnabled(usingRexec); + + IProperty serverScriptProperty = set.addProperty(KEY_SERVER_SCRIPT, ""+_serverScript); + serverScriptProperty.setEnabled(usingRexec); + serverScriptProperty.setLabel(SystemResources.RESID_PROP_SERVERLAUNCHER_INVOCATION); + } + + + /** + * Clone the contents of this server launcher into the given server launcher + * Your sublcass must override this if you add additional attributes! Be sure + * to call super.cloneServerLauncher(newOne) first. + * @return the given new server launcher, for convenience. + */ + public IServerLauncherProperties cloneServerLauncher(IServerLauncherProperties newOne) + { + super.cloneServerLauncher(newOne); + IIBMServerLauncher ibmNewOne = (IIBMServerLauncher)newOne; + ibmNewOne.addPropertySets(getPropertySets()); + ibmNewOne.setDaemonPort(getDaemonPort()); + ibmNewOne.setRexecPort(getRexecPort()); + ibmNewOne.setServerLaunchType(getServerLaunchTypeGen()); + ibmNewOne.setServerPath(getServerPath()); + ibmNewOne.setServerScript(getServerScript()); + return ibmNewOne; + } + + /** + * + * This is the means by which to start the server-side code, as specified by the user, typically. + * + */ + public ServerLaunchType getServerLaunchType() + { + if (!isSetServerLaunchType()) + { + if (isEnabledServerLaunchType(ServerLaunchType.DAEMON_LITERAL)) + return ServerLaunchType.DAEMON_LITERAL; + else if (isEnabledServerLaunchType(ServerLaunchType.REXEC_LITERAL)) + return ServerLaunchType.REXEC_LITERAL; + else if (isEnabledServerLaunchType(ServerLaunchType.RUNNING_LITERAL)) + return ServerLaunchType.RUNNING_LITERAL; + else if (isEnabledServerLaunchType(ServerLaunchType.TELNET_LITERAL)) + return ServerLaunchType.TELNET_LITERAL; + else if (isEnabledServerLaunchType(ServerLaunchType.SSH_LITERAL)) + return ServerLaunchType.SSH_LITERAL; + else if (isEnabledServerLaunchType(ServerLaunchType.FTP_LITERAL)) + return ServerLaunchType.FTP_LITERAL; + else + return ServerLaunchType.HTTP_LITERAL; + } + return _serverLaunchType; + } + /** + * + * Generated. Do not call or use. + * + * @generated + */ + public ServerLaunchType getServerLaunchTypeGen() + { + return _serverLaunchType; + } + + /** + * + * This is the means by which to start the server-side code, as specified by the user, typically. + * It is one of the constants in the enumeration class {@link org.eclipse.rse.core.subsystems.ServerLaunchType} + * + * @generated + */ + public void setServerLaunchType(ServerLaunchType newServerLaunchType) + { + ServerLaunchType oldServerLaunchType = _serverLaunchType; + if (oldServerLaunchType != newServerLaunchType) + { + _serverLaunchType = newServerLaunchType == null ? SERVER_LAUNCH_TYPE_EDEFAULT : newServerLaunchType; + _hasSetServerLaunchType = true; + setDirty(true); + } + } + + /** + * + * + * @generated + */ + public boolean isSetServerLaunchType() + { + return _hasSetServerLaunchType; + } + + /** + * Return the port used for the REXEC option, as an Integer + */ + public int getRexecPort() + { + return _rexecPort; + } + /** + * Set the REXEC port value, as an int + */ + public void setRexecPort(int newRexecPort) + { + if (newRexecPort != _rexecPort) + { + _rexecPort = newRexecPort; + setDirty(true); + } + } + + /** + * Return the port used for the DAEMON option, as an Integer + */ + public int getDaemonPort() + { + return _daemonPort; + } + /** + * Set the DAEMON port value, as an int + */ + public void setDaemonPort(int newDaemonPort) + { + if (_daemonPort != newDaemonPort) + { + _daemonPort = newDaemonPort; + setDirty(true); + } + } + + /** + * + * The path where the server lives on the remote system. Used by at least the REXEC server launch type. + * Will be null if not set. + * + */ + public String getServerPath() + { + String serverPath = _serverPath; + if ((serverPath == null) || (serverPath.length() == 0)) + { + serverPath = IBMServerLauncherConstants.DEFAULT_REXEC_PATH; + } + return serverPath; + } + /** + * + * The path where the server lives on the remote system. Used by at least the REXEC server launch type. + * + * @generated + */ + public void setServerPath(String newServerPath) + { + String oldServerPath = _serverPath; + if (oldServerPath == null || !oldServerPath.equals(newServerPath)) + { + _serverPath = newServerPath; + setDirty(true); + } + } + + /** + * + * The script to run on the remote system, to start the server code. + * + */ + public String getServerScript() + { + String serverScript = _serverScript; + + if ((serverScript == null) || (serverScript.length() == 0)) + { + serverScript = "server." + getConnectorService().getHost().getSystemType().toLowerCase(); + } + + return serverScript; + } + + + public void setServerScript(String newServerScript) + { + String oldServerScript = _serverScript; + if (oldServerScript != newServerScript) + { + _serverScript = newServerScript; + setDirty(true); + } + } + + /** + * This methods returns the enablement state per server launch type. + * If {@link #enableServerLaunchType(ServerLaunchType,boolean)} has not been + * called for this server launch type, then we defer to the subsystem factory's + * method: + * {@link org.eclipse.rse.core.subsystems.SubSystemConfiguration#supportsServerLaunchType(ServerLaunchType)}. + * @see org.eclipse.rse.core.subsystems.ServerLaunchType + */ + public boolean isEnabledServerLaunchType(ServerLaunchType serverLaunchType) + { + IPropertySet set = getPropertySet("restrictedTypes"); + if (set != null) + { + String value = set.getPropertyValue(serverLaunchType.getName()); + if (value != null) + { + return value.equals("true"); + } + } + return getConnectorService().getPrimarySubSystem().getSubSystemConfiguration().supportsServerLaunchType(serverLaunchType); + } + + + /** + * @deprecated + */ + public void setIBMAttribute(String attributeName, String attributeValue) + { + IPropertySet set = getPropertySet("IBM"); + if (set == null) + { + set = createPropertySet("IBM", getDescription()); + } + set.addProperty(attributeName, attributeValue); + } + + + /** + * @deprecated + */ + public void setRestrictedType(String attributeName, String attributeValue) + { + IPropertySet set = getPropertySet("restrictedTypes"); + if (set == null) + { + set = createPropertySet("restrictedTypes", getDescription()); + } + set.addProperty(attributeName, attributeValue); + } + + public void enableServerLaunchType(ServerLaunchType serverLaunchType, boolean enable) { + // TODO Auto-generated method stubS + + } + +} //IBMServerLauncherImpl \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ICacheManager.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ICacheManager.java new file mode 100644 index 00000000000..1345da07705 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ICacheManager.java @@ -0,0 +1,46 @@ +/******************************************************************************** + * 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.core.subsystems; + +/** + * Interface for a cache manager that can optionally associated with a SubSystem. + * + * @since RSE 6.0 + */ +public interface ICacheManager { + + + /** + * This flag is set if the Remote System Explorer is restoring a remote object + * from a memento. This gives the subsystem the option to restore from the cache + * instead of connecting to the remote system. + * + * @param restore true if the RSE is currently restoring a remote object associated + * with this cache manager from a memento, otherwise false. + */ + public void setRestoreFromMemento(boolean restore); + + /** + * Check if the Remote System Explorer is restoring a remote object + * from a memento. + * + * @return true if the RSE is currently restoring a remote object associated + * with this cache manager from a memento, otherwise false. + */ + public boolean isRestoreFromMemento(); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ICommunicationsListener.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ICommunicationsListener.java new file mode 100644 index 00000000000..b7659c912c7 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ICommunicationsListener.java @@ -0,0 +1,49 @@ +/******************************************************************************** + * 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.core.subsystems; + + +/** + * ICommunicationsListener - listen to communication events + * @see CommunicationsEvent + */ +public interface ICommunicationsListener { + + + /** + * This method is invoked whenever the communications state is invoked + * immediately before and after the state of the communications changes. + * The state field in CommunicationsEvent determines which state + * change is about to or has occured. + */ + public void communicationsStateChange(CommunicationsEvent e); + + /** + * This method determines if the communications listener is a passive or + * active listener. Typically a passive listener registers with the communications + * system and responds to events as they occur. An active listener typically + * registeres with the communications system only for the duration of the task (i.e. + * user editing a file, or outstanding communications request.) + * + * The user will be prompted on a disconnect if there are any active communication + * listeners registered. + * + * @return false if the communications listener is an active listener, true if the + * communications listener is a passive listener. + */ + public boolean isPassiveCommunicationsListener(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IConnectorService.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IConnectorService.java new file mode 100644 index 00000000000..603d42d7d11 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IConnectorService.java @@ -0,0 +1,311 @@ +/******************************************************************************** + * 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.core.subsystems; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.IRSEModelObject; +import org.eclipse.swt.widgets.Shell; + + +/** + * This is the interface implemented by System objects. + *

    + * A system object manages a live connection to a remote system, with + * operations for connecting and disconnecting, and storing information + * typically cached from a subsystem: user ID, password, port, etc. Any + * information in a System object is thrown out when the workbench goes + * down... it is not modelled for persistence. + *

    + * The SubSystem interface includes a method, getSystem(), which returns an + * instance of this interface for that subsystem. + *

    + * A single system object can be unique to a subsystem (which is always unique + * for a particular tool to a particular connection). It can also be shared + * across multiple subsystems in a single connection if those subsystems share + * their physical connection to the remote system. This sharing is done via + * subclasses of {@link org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager} + * which are returned via another getter method in SubSystem. + */ +public interface IConnectorService extends IRSEModelObject +{ + + + + /** + * Return the subsystem object this system is associated with + */ + public ISubSystem getPrimarySubSystem(); + + /** + * Return all the subsystems that use this service + * @return the subsystems that use this service + */ + public ISubSystem[] getSubSystems(); + + /** + * Set the subsystem, when its not known at constructor time + */ + public void registerSubSystem(ISubSystem ss); + + /** + * Deregister the subsystem + * @param ss + */ + public void deregisterSubSystem(ISubSystem ss); + + /** + * Return true if currently connected. + */ + public boolean isConnected(); + /** + * Attempt to connect to the remote system. + */ + public void connect(IProgressMonitor monitor) throws Exception; + /** + * Disconnect from the remote system + */ + public void disconnect() throws Exception; + /** + * Notifies all listeners of a disconnection through a communications event + */ + public void notifyDisconnection(); + /** + * Notifies all listeners of a connection through a communications event + */ + public void notifyConnection(); + /** + * Notifies all listeners of an error through a communications event + */ + public void notifyError(); + /** + * Reset after some fundamental change, such as a hostname change. + * Clear any memory of the current connection. + */ + public void reset(); + /** + * Return the version, release, modification of the remote system, + * if connected, if applicable and if available. Else return null. + *

    + * Up to each implementer to decide if this will be cached. + */ + public String getVersionReleaseModification(); + /** + * Return the home directory of the remote system for the current user, if available. + *

    + * Up to each implementer to decide how to implement, and if this will be cached. + */ + public String getHomeDirectory(); + /** + * Return the temp directory of the remote system for the current user, if available. + *

    + * Up to each implementer to decide how to implement, and if this will be cached. + */ + public String getTempDirectory(); + + // -------------------------------------------------------------------- + // Utility methods that offer combined connection and subsystem info... + // -------------------------------------------------------------------- + /** + * Return the system type for this connection. + */ + public String getHostType(); + + /** + * Return the name of this connector service + * @return the name of this connector service + */ + public String getName(); + + public void setHost(IHost host); + + /** + * Return the host + * @return + */ + public IHost getHost(); + + /** + * Return the host name for the connection this system's subsystem is associated with + */ + public String getHostName(); + + /** + * Return the port for this connector + */ + public int getPort(); + + /** + * Set the port for this connector + * @param port + */ + public void setPort(int port); + + /** + * Return the userId for this system's subsystem we are associated with + */ + public String getUserId(); + + /** + * Set the user id for this connector + * @param userId + */ + public void setUserId(String userId); + + + public boolean isUsingSSL(); + + public void setIsUsingSSL(boolean flag); + + /** + * Return the password for this system's subsystem we are associated with. + *

    + * If not currently set in transient memory, prompts the user for a password. + *

    + * Throws InterruptedException if user is prompted and user cancels that prompt. + * @param shell parent for the prompt dialog if needed. Can be null if know password exists. + * @param forcePrompt forces the prompt dialog to be displayed even if the password is currently + * in memory. + */ + public void promptForPassword(Shell shell, boolean forcePrompt) + throws InterruptedException; + /** + * Set the password if you got it from somewhere + */ + public void setPassword(String matchingUserId, String password); + + /** + * Set the password if you got it from somewhere + */ + public void setPassword(String matchingUserId, String password, boolean persist); + + /** + * Clear internal userId cache. Called when user uses the property dialog to + * change his userId. + */ + public void clearUserIdCache(); + /** + * Clear internal password cache. Called when user uses the property dialog to + * change his userId. + */ + public void clearPasswordCache(); + + /** + * Clear internal password cache. Called when user uses the property dialog to + * change his userId. + * @param clearDiskCache if true, clears the password from disk + */ + public void clearPasswordCache(boolean clearDiskCache); + /** + * Return true if password is currently cached. + */ + public boolean isPasswordCached(); + + + /** + * Return true if password is currently cached. + */ + public boolean isPasswordCached(boolean onDisk); + + /** + * Return true if this system can inherit the uid and password of + * other ISystems in this connection + * + * @return true if it can inherit the user/password + */ + public boolean inheritConnectionUserPassword(); + + /* + * Return true if this system can share it's uid and password + * with other ISystems in this connection + * + * @return true if it can share the user/password + */ + public boolean shareUserPasswordWithConnection(); + + /** + * Register a communications listener + */ + public void addCommunicationsListener(ICommunicationsListener listener); + /** + * Remove a communications listener + */ + public void removeCommunicationsListener(ICommunicationsListener listener); + /** + * Returns the suppressSignonPrompt flag. If this is set to true then the user + * will not be prompted to signon, instead an InterruptedException will be thrown + * by the promptForPassword method. + * + * @return boolean + */ + public boolean isSuppressSignonPrompt(); + /** + * Sets the suppressSignonPrompt flag. Tool writers can use this to temporarily + * disable the user from being prompted to signon. This would cause the promptForPassword + * method to throw an InterruptedException instead of prompting. The intent of this + * method is to allow tool writeres to prevent multiple signon prompts during a + * set period of time (such as a series of related communication calls) if the user + * cancels the first prompt. It is the callers responsability to set this value + * back to false when the tool no longer needs to suppress the signon prompt or all + * other tools sharing this connection will be affected. + * + * @param suppressSignonPrompt + */ + public void setSuppressSignonPrompt(boolean suppressSignonPrompt); + + /** + * Returns the value of the 'Remote Server Launcher' containment reference. + * It is bidirectional and its opposite is '{@link org.eclipse.rse.core.subsystems.IServerLauncherProperties#getParentSubSystem Parent Sub System}'. + * + *

    + * Get the remote server launcher, which may be null. This an optional object containing + * properties used to launch the remote server that communicates with this subsystem. + *

    + * + * @return the value of the 'Remote Server Launcher' containment reference. + * @see #setRemoteServerLauncher(IServerLauncherProperties) + * @see org.eclipse.rse.core.subsystems.SubsystemsPackage#getSubSystem_RemoteServerLauncher() + * @see org.eclipse.rse.core.subsystems.IServerLauncherProperties#getParentSubSystem + * @model opposite="parentSubSystem" containment="true" + * @generated + */ + IServerLauncherProperties getRemoteServerLauncherProperties(); + + /** + * Sets the value of the '{@link org.eclipse.rse.core.subsystems.ISubSystem#getRemoteServerLauncher Remote Server Launcher}' containment reference. + * + * Set the remote server launcher, which is an optional object containing + * properties used to launch the remote server that communicates with this subsystem. + * + * @param value the new value of the 'Remote Server Launcher' containment reference. + * @see #getRemoteServerLauncher() + * @generated + */ + void setRemoteServerLauncherProperties(IServerLauncherProperties value); + + + boolean hasRemoteServerLauncherProperties(); + + boolean supportsRemoteServerLaunching(); + + /** + * Tell us if this subsystem factory supports server launch properties, which allow the user + * to configure how the server-side code for these subsystems are started. There is a Server + * Launch Setting property page, with a pluggable composite, where users can configure these + * properties. + */ + public boolean supportsServerLaunchProperties(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IConnectorServiceManager.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IConnectorServiceManager.java new file mode 100644 index 00000000000..24f8a9d5a9f --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IConnectorServiceManager.java @@ -0,0 +1,26 @@ +/******************************************************************************** + * 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.core.subsystems; + +import org.eclipse.rse.model.IHost; + + +public interface IConnectorServiceManager +{ + IConnectorService getConnectorService(IHost host, Class commonSSinterface); + void setConnectorService(IHost host, Class commonSSinterface, IConnectorService connectorService); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IFileConstants.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IFileConstants.java new file mode 100644 index 00000000000..6733c69aff5 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IFileConstants.java @@ -0,0 +1,72 @@ +/******************************************************************************** + * 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.core.subsystems; +/** + * Constants used in the remote file system support + */ +public interface IFileConstants +{ + + // --------------------------------------- + // UNIX FILE SYSTEM ATTRIBUTE CONSTANTS... + // --------------------------------------- + /** + * Unix-style folder-name separator as a string: "/" + */ + public static String SEPARATOR_UNIX = "/"; + /** + * Unix-style folder-name separator as a char: '/' + */ + public static char SEPARATOR_CHAR_UNIX = '/'; + /** + * Unix-style path separator as a string: ":" + */ + public static String PATH_SEPARATOR_UNIX = ":"; + /** + * Unix-style path separator as a char: ':' + */ + public static char PATH_SEPARATOR_CHAR_UNIX = ':'; + /** + * Unix-style line separator as a byte array: 10 + */ + public static final byte[] LINE_SEPARATOR_BYTE_ARRAY_UNIX = {10}; + + + // ------------------------------------------ + // WINDOWS FILE SYSTEM ATTRIBUTE CONSTANTS... + // ------------------------------------------ + /** + * Windows-style folder-name separator as a string: "\" + */ + public static String SEPARATOR_WINDOWS = "\\"; + /** + * Windows-style folder-name separator as a char: '\' + */ + public static char SEPARATOR_CHAR_WINDOWS = '\\'; + /** + * Windows-style path separator as a string: ";" + */ + public static String PATH_SEPARATOR_WINDOWS = ";"; + /** + * Windows-style path separator as a char: ';' + */ + public static char PATH_SEPARATOR_CHAR_WINDOWS = ';'; + /** + * Windows-style line separator as a byte array: 13 and 10 respectively + */ + public static final byte[] LINE_SEPARATOR_BYTE_ARRAY_WINDOWS = {13, 10}; +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IIBMServerLauncher.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IIBMServerLauncher.java new file mode 100644 index 00000000000..acd26112596 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IIBMServerLauncher.java @@ -0,0 +1,202 @@ +/******************************************************************************** + * 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.core.subsystems; +/** + * + * This is the IBM default implementation of {@link IServerLauncherProperties}. It basically allows for numerous types + * of server connecting, as identified in {@link org.eclipse.rse.core.subsystems.ServerLaunchType}. It + * also captures the attributes needed to support these. + *

    + * A server launcher is responsible for starting the server-side code needed for this client subsystem to + * access remote resources on the remote system. It starts the server half of the client/server code needed + * for this subsystem. It is consulted in the default implementation of connect() in ISystem, and the + * manages the properties in the Remote Server Launcher property page. + * + * + *

    + * The following features are supported: + *

      + *
    • {@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getServerLaunchType Server Launch Type}
    • + *
    • {@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getPort Port}
    • + *
    • {@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getRexecPort Rexec Port}
    • + *
    • {@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getDaemonPort Daemon Port}
    • + *
    • {@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getServerPath Server Path}
    • + *
    • {@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getServerScript Server Script}
    • + *
    • {@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getIbmAttributes Ibm Attributes}
    • + *
    • {@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getRestrictedTypes Restricted Types}
    • + *
    + *

    + * + * @see org.eclipse.rse.core.subsystems.SubsystemsPackage#getIBMServerLauncher() + * @model + * @generated + */ +public interface IIBMServerLauncher extends IServerLauncherProperties{ + /** + * + * + * @generated + */ + String copyright = "(c) Copyright IBM Corporation 2002, 2004."; + + /** + * Returns the value of the 'Server Launch Type' attribute. + * The literals are from the enumeration {@link org.eclipse.rse.core.subsystems.ServerLaunchType}. + * + *

    + * This is the means by which to start the server-side code, as specified by the user, typically. + * It is one of the constants in the enumeration class {@link org.eclipse.rse.core.subsystems.ServerLaunchType} + *

    + * + * @return the value of the 'Server Launch Type' attribute. + * @see org.eclipse.rse.core.subsystems.ServerLaunchType + * @see #isSetServerLaunchType() + * @see #unsetServerLaunchType() + * @see #setServerLaunchType(ServerLaunchType) + * @see org.eclipse.rse.core.subsystems.SubsystemsPackage#getIBMServerLauncher_ServerLaunchType() + * @model unsettable="true" + * @generated + */ + ServerLaunchType getServerLaunchType(); + + /** + * Sets the value of the '{@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getServerLaunchType Server Launch Type}' attribute. + * + * This is the means by which to start the server-side code, as specified by the user, typically. + * It is one of the constants in the enumeration class {@link org.eclipse.rse.core.subsystems.ServerLaunchType} + * + * @param value the new value of the 'Server Launch Type' attribute. + * @see org.eclipse.rse.core.subsystems.ServerLaunchType + * @see #isSetServerLaunchType() + * @see #unsetServerLaunchType() + * @see #getServerLaunchType() + * @generated + */ + void setServerLaunchType(ServerLaunchType value); + + /** + * Returns the value of the 'Rexec Port' attribute. + * + *

    + * If the meaning of the 'Rexec Port' attribute isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Rexec Port' attribute. + * @see #setRexecPort(Integer) + * @see org.eclipse.rse.core.subsystems.SubsystemsPackage#getIBMServerLauncher_RexecPort() + * @model + * @generated + */ + int getRexecPort(); + + + + /** + * Set the REXEC port value, as an int + */ + public void setRexecPort(int newRexecPort); + + + int getDaemonPort(); + + /** + * Set the DAEMON port value, as an int + */ + public void setDaemonPort(int newDaemonPort); + + /** + * Returns the value of the 'Server Path' attribute. + * + *

    + * The path where the server lives on the remote system. Used by at least the REXEC server launch type. + * Will be null if not set. + *

    + * + * @return the value of the 'Server Path' attribute. + * @see #setServerPath(String) + * @see org.eclipse.rse.core.subsystems.SubsystemsPackage#getIBMServerLauncher_ServerPath() + * @model + * @generated + */ + String getServerPath(); + + /** + * Sets the value of the '{@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getServerPath Server Path}' attribute. + * + * Set the path where the server lives on the remote system. Used by at least the REXEC server launch type. + * + * @param value the new value of the 'Server Path' attribute. + * @see #getServerPath() + * @generated + */ + void setServerPath(String value); + + /** + * Returns the value of the 'Server Script' attribute. + * + *

    + * The script to run on the remote system, to start the server code. + *

    + * + * @return the value of the 'Server Script' attribute. + * @see #setServerScript(String) + * @see org.eclipse.rse.core.subsystems.SubsystemsPackage#getIBMServerLauncher_ServerScript() + * @model + * @generated + */ + String getServerScript(); + + /** + * Sets the value of the '{@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getServerScript Server Script}' attribute. + * + * The script to run on the remote system, to start the server code. + * + * @param value the new value of the 'Server Script' attribute. + * @see #getServerScript() + * @generated + */ + void setServerScript(String value); + + /** + * Call this method to identify specific server launch types that are not to be permitted. + * This will disable these types in the property page, effectively preventing the user from + * specifying it. Note this is a transient property, so you should call it each time as part + * of restoring your subsystem. + *

    + * You normally do not call this! Rather, your subsystem factory class will override + * {@link org.eclipse.rse.core.subsystems.SubSystemConfiguration#supportsServerLaunchType(ServerLaunchType)}. + * However, this method is needed by ISVs that re-use IBM-supplied subsystem factories, + * and merely supply their own ISystem object via the "systemClass" attribute of the + * subsystemconfiguration extension point. They don't call this method directly actually, but + * rather {@link AbstractConnectorService#enableServerLaunchType(SubSystem, ServerLaunchType, boolean)}, + * which in turn calls this. + * + * @see org.eclipse.rse.core.subsystems.ServerLaunchType + */ + public void enableServerLaunchType(ServerLaunchType serverLaunchType, boolean enable); + + /** + * This methods returns the enablement state per server launch type. + * If {@link #enableServerLaunchType(ServerLaunchType,boolean)} has not been + * called for this server launch type, then we defer to the subsystem factory's + * method: + * {@link org.eclipse.rse.core.subsystems.SubSystemConfiguration#supportsServerLaunchType(ServerLaunchType)}. + * @see org.eclipse.rse.core.subsystems.ServerLaunchType + */ + public boolean isEnabledServerLaunchType(ServerLaunchType serverLaunchType); +} // IBMServerLauncher \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemoteContainer.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemoteContainer.java new file mode 100644 index 00000000000..e7787240dfb --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemoteContainer.java @@ -0,0 +1,61 @@ +/******************************************************************************** + * 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.core.subsystems; +import org.eclipse.rse.model.ISystemContainer; +import org.eclipse.rse.model.ISystemContentsType; + +/** + * @author dmcknigh + */ +public interface IRemoteContainer extends ISystemContainer +{ + + /** + * Returns whether the object has contents of a particular type associated with the specified filter string. + * @param contentsType type of contents + * @param filter criteria for contained contents + * @return true if the object has contents, false otherwise. + */ + public boolean hasContents(ISystemContentsType contentsType, String filter); + + /** + * Returns the contents of the object. + * @param contentsType type of contents + * @param filter criteria for contained contents. + * @return an array of contents. + */ + public Object[] getContents(ISystemContentsType contentsType, String filter); + + /* + * Replace occurrences of cached object with new object + */ + public void replaceContent(Object oldObject, Object newObject); + + /** + * Sets the contents of this object that match a particular filter + * @param contentsType type of contents + * @param filter matching criteria for the contained objects + * @param con the contained objects that match the filter + */ + public void setContents(ISystemContentsType contentsType, String filter, Object[] con); + + /** + * Copies the persistable contents from this one to another one + * @param container the container to copy contents to + */ + public void copyContentsTo(IRemoteContainer container); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemoteLineReference.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemoteLineReference.java new file mode 100644 index 00000000000..c24ce5e2fed --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemoteLineReference.java @@ -0,0 +1,62 @@ +/******************************************************************************** + * 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.core.subsystems; +/** + * This interface represents an object that can be used to jump into line in source + */ +public interface IRemoteLineReference +{ + + + /** + * Gets the path to the file that this output references if it references any. It may return null if + * no such association exists. This may be used to jump to an editor from a view which displays + * this + * + * @return the path of the referenced file if there is one + */ + public String getAbsolutePath(); + + /** + * Gets the line number within a file that this references if it references any. By default + * it should return 0. If no file association exists, it also returns 0. This may be used to jump into + * a location within an editor from a view which displays remote output. + * + * @return the line number within a referenced file if there is one. + */ + public int getLine(); + + /** + * Get the start offset in a line corresponding to this reference. -1 indicates there is no offset + * @return the offset + */ + public int getCharStart(); + + /** + * Get the end offset in a line corresponding to this reference. -1 indicates there is no offset + * @return the offset + */ + public int getCharEnd(); + + /** + * Get the object that contains this object. + * + * @return the parent object + */ + public Object getParent(); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemoteObjectIdentifier.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemoteObjectIdentifier.java new file mode 100644 index 00000000000..2ef6338fc29 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemoteObjectIdentifier.java @@ -0,0 +1,30 @@ +/******************************************************************************** + * 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.core.subsystems; +public interface IRemoteObjectIdentifier +{ + + + /** + * For drag and drop, and clipboard, support of remote objects. + *

    + * Return the unique ID for the given remote object within the subsystem. + */ + public String getAbsoluteName(Object object); + + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemoteObjectResolver.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemoteObjectResolver.java new file mode 100644 index 00000000000..89bf224c1b1 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemoteObjectResolver.java @@ -0,0 +1,34 @@ +/******************************************************************************** + * 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.core.subsystems; +/** + * Interface for resolving an object in a subsystem from a unique ID + */ +public interface IRemoteObjectResolver +{ + + + /** + * For drag and drop, clipboard, and other object retrieval mechanisms in support of remote objects. + *

    + * Return the remote object within the subsystem that corresponds to + * the specified unique ID. + *

    + * This is the functional opposite of {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getAbsoluteName(Object)}. + */ + public Object getObjectWithAbsoluteName(String key) throws Exception; +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemotePropertyHolder.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemotePropertyHolder.java new file mode 100644 index 00000000000..281c72fa07c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemotePropertyHolder.java @@ -0,0 +1,70 @@ +/******************************************************************************** + * 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.core.subsystems; + +/** + * This interface should be implemented by any remote artifact + * that contains remote properties and (optionally) caches them. + */ +public interface IRemotePropertyHolder { + + /** + * Returns the value of the property with the given key. + * @param key the property key. + * @return the value of the property. + */ + public Object getProperty(String key); + + /** + * Returns the value of the properties with the given keys. + * @param keys the property keys. + * @return the correspoding values of the properties. + */ + public Object[] getProperties(String[] keys); + + /** + * Sets the value of the property with the given key. + * @param key the property key. + * @param value the value of the property. + */ + public void setProperty(String key, Object value); + + /** + * Sets the values of the properties with the given keys. + * @param keys the property keys. + * @param values the corresponding values of the properties. + */ + public void setProperties(String[] keys, Object[] values); + + /** + * Returns whether the property with the given key is stale. + * @param key the property key. + * @return true if the property is stale, false otherwise. + */ + public boolean isPropertyStale(String key); + + /** + * Marks the property with the given key as stale. + * @param key the property key. + */ + public void markPropertyStale(String key); + + /** + * Marks all properties as stale. + */ + public void markAllPropertiesStale(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemoteSystemEnvVar.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemoteSystemEnvVar.java new file mode 100644 index 00000000000..22b14104325 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IRemoteSystemEnvVar.java @@ -0,0 +1,78 @@ +/******************************************************************************** + * 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.core.subsystems; + + + +// + + +/** + * @lastgen interface RemoteSystemEnvVar {} + */ + +public interface IRemoteSystemEnvVar { + + + + /** + * + * + * @generated + */ + String copyright = "(c) Copyright IBM Corporation 2002, 2004."; + + /** + * @generated This field/method will be replaced during code generation + * @return The value of the Name attribute + * The name of the environment variable to set at connect time + */ + String getName(); + + /** + * @generated This field/method will be replaced during code generation + * @param value The new value of the Name attribute + */ + void setName(String value); + + /** + * @generated This field/method will be replaced during code generation + * @return The value of the Value attribute + * The value to set this environment variable to at connect time + */ + String getValue(); + + /** + * @generated This field/method will be replaced during code generation + * @param value The new value of the Value attribute + */ + void setValue(String value); + + /** + * @generated This field/method will be replaced during code generation + * @return The value of the AdditionalAttributes attribute + * Additional attributes that may need to be persisted per environment variable. + */ + String getAdditionalAttributes(); + + /** + * @generated This field/method will be replaced during code generation + * @param value The new value of the AdditionalAttributes attribute + */ + void setAdditionalAttributes(String value); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IServerLauncher.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IServerLauncher.java new file mode 100644 index 00000000000..d6edaad6ac8 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IServerLauncher.java @@ -0,0 +1,100 @@ +/******************************************************************************** + * 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.core.subsystems; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.rse.model.SystemSignonInformation; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; + + +/** + * This interface captures the abstract lifecyle for launching the remote server, + * and subsequently connecting to it. + * @see org.eclipse.rse.core.subsystems.IServerLauncherProperties + */ +public interface IServerLauncher +{ + + /** + * Set the remote system signon information + */ + public void setSignonInformation(SystemSignonInformation info); + + /** + * Get the remote system signon information, as set in + * {@link #setSignonInformation(SystemSignonInformation)} + */ + public SystemSignonInformation getSignonInformation(); + + /** + * Set the object which contains the user-specified properties that + * are used by this launcher + */ + public void setServerLauncherProperties(IServerLauncherProperties propertyInfo); + + /** + * Get the object which contians the user-specified properties that are + * used by this launcher. As set in {@link #setServerLauncherProperties(IServerLauncherProperties)}. + */ + public IServerLauncherProperties getServerLauncherProperties(); + + /** + * Determine if the remote server needs to be launched or not. + * Generally is always false. + * @return true if the remote server is already launched, false if it needs to be. + */ + public boolean isLaunched(); + + /** + * Launch the remote server. Some subclasses may not need this step, + * if the server is already running. + * @see #getErrorMessage() + * @param monitor - a monitor for showing progress + * @return an object. Up to each implementor how to interpret. + */ + public Object launch(IProgressMonitor monitor) throws Exception; + + /** + * Determine if we are connected to the remote server or not. + * @return true if we are connected, false otherwise. + */ + public boolean isConnected(); + + /** + * Connect to the remote server. + * @see #getErrorMessage() + * @param monitor a monitor for showing progress + * @param connectPort the port to use for launching the server + * @return Anything you want. + */ + public Object connect(IProgressMonitor monitor, int connectPort) throws Exception; + + /** + * Disconnect from the remote server + * @see #getErrorMessage() + */ + public void disconnect() throws Exception; + + /** + * Returns the host error message if there was a problem connecting to the host. + * If there was no problem, this returns null + * + * @return the error message. + */ + public SystemMessage getErrorMessage(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IServerLauncherProperties.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IServerLauncherProperties.java new file mode 100644 index 00000000000..c51785dd8be --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/IServerLauncherProperties.java @@ -0,0 +1,51 @@ +/******************************************************************************** + * 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.core.subsystems; +import org.eclipse.rse.model.IRSEModelObject; + + + +/** + * Implement this interface to provide peristable properties for server launching + * All properties to be persisted to be are stored and restored from associated + * IPropertySets + * + */ +public interface IServerLauncherProperties extends IRSEModelObject +{ + + public IServerLauncherProperties cloneServerLauncher(IServerLauncherProperties newOne); + + /** + * Returns the connector service + * @return + */ + public IConnectorService getConnectorService(); + + /** + * Update cached values based on IPropertySets + * + */ + public void restoreFromProperties(); + + /** + * Store cached values based on IPropertySets + * + */ + public void saveToProperties(); + +} // ServerLauncher \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ISubSystem.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ISubSystem.java new file mode 100644 index 00000000000..d3102ea3aa4 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ISubSystem.java @@ -0,0 +1,660 @@ +/******************************************************************************** + * 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.core.subsystems; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.jobs.ISchedulingRule; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.filters.ISystemFilterString; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.IRSEModelObject; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.persistence.IRSEPersistableContainer; +import org.eclipse.rse.services.clientserver.messages.SystemMessageException; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.dialogs.PropertyPage; + + + +/** + * Interface implemented by SubSystem objects. While connections contain information to identify a + * particular remote system, it is the subsystem objects within a connection that contain information + * unique to a particular tool, for that remote system, such as the port the tool uses and the + * user ID for making the connection. There are a set of default properties, but these can be + * extended by subsystem providers, by extending {@link SubSystem}. + *

    + */ +public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, IRemoteObjectResolver, ISchedulingRule, IRSEModelObject, IRSEPersistableContainer +{ + // ------------------------------------- + // Shortcut and helper methods... + // ------------------------------------- + /** + * Return the parent subsystem factory that owns this subsystem. + */ + public ISubSystemConfiguration getSubSystemConfiguration(); + /** + * Set the parent subsystem factory that owns this subsystem. + */ + public void setSubSystemConfiguration(ISubSystemConfiguration ssf); + /** + * Set the parent connection that owns this subsystem. + */ + public void setHost(IHost conn); + + /** + * Set the connector service for this subsystem + * @param connectorService + */ + public void setConnectorService(IConnectorService connectorService); + + /** + * Return the system profile object this subsystem is associated with. + * @see #getName() + */ + public ISystemProfile getSystemProfile(); + /** + * Return the connection object this subsystem is associated with. + */ + public IHost getHost(); + + /** + * Called on each subsystem associated with a particular ISystem after it connects + */ + public void initializeSubSystem(IProgressMonitor monitor); + + /** + * @return true if this subsystem's properties should take precedence over other subsystems that share the same ISystem + */ + public boolean isPrimarySubSystem(); + /** + * Return the primary subsystem associated with this subsystem's ISystem + */ + public ISubSystem getPrimarySubSystem(); + + /** + * @return The name of the connection that owns this. Same as getSystemConnection().getAliasName() + */ + public String getHostAliasName(); + /** + * @return The value of the profile that owns the connection that owns this subsystem. Fastpath. + */ + public String getSystemProfileName(); + /** + * Private method called when the parent profile is being renamed, so + * the subsystem can do any cleanup it needs to. Called after the profile is actually renamed. + */ + public void renamingProfile(String oldName, String newName); + /** + * Private method called when the parent connection is being renamed, so + * the subsystem can do any cleanup it needs to. + */ + public void renamingConnection(String newName); + /** + * Private method called when the parent connection is being deleted, so + * the subsystem can do any pre-death cleanup it needs to. + */ + public void deletingConnection(); + /** + * This is a helper method you can call when performing actions that must be certain there + * is a connection. If there is no connection it will attempt to connect, and if that fails + * will throw a SystemMessageException you can easily display to the user by using a method + * in it. + */ + public void checkIsConnected() throws SystemMessageException; + + // ------------------------------------- + // GUI methods + // ------------------------------------- + /** + * Return the single property page to show in the tabbed notebook for the + * for SubSystem property of the parent Connection. Return null if no + * page is to be contributed for this. You are limited to a single page, + * so you may have to compress. It is recommended you prompt for the port + * if applicable since the common base subsystem property page is not shown + * To help with this you can use the SystemPortPrompt widget. + */ + public PropertyPage getPropertyPage(Composite parent); + + // --------------------------------------------------- + // Methods for business partners to add their own + // persisted attributes to the subsystem object... + // --------------------------------------------------- + + /** + * For business partners defining their own subsystems. + * This method allows an attribute to be persisted in this + * subsystem, given the following information: + *

      + *
    • Vendor name. This name should uniquely differentiate one + * vendor's attributes from anothers. + *
    • Attribute name. The name of the attribute to set. + *
    • attribute value. The value to give the named attribute. It must + * be resolved into a string to use this. Eg, for boolean use + * something like "true" or "false". To clear the attribute + * value pass null for the value. + *
    + * Warning do not use any of the following characters in any of + * given parameters, or it will cause problems with parsing: + *
      + *
    • Pound sign ('#') + *
    • Three underscores ("___") + *
    • Three equals signs ("===") + *
    • Three semicolons (";;;") + *
    + */ + public void setVendorAttribute(String vendorName, + String attributeName, String attributeValue); + /** + * For business partners defining their own subsystems. + * This method allows retrieval of a persisted attribute in this + * subsystem, given the following information: + *
      + *
    • Vendor name. This name should uniquely differentiate one + * vendor's attributes from anothers. + *
    • Attribute name. The name of the attribute whose value is being queried. + *
    + * @return value of the attribute being queried, or null if not found + */ + public String getVendorAttribute(String vendorName, String attributeName); + + + + // ------------------------------------- + // Context and attributue information... + // ------------------------------------- + + /** + * Return true if userId and password should be forced to uppercase. + * Shortcut to calling same method in parent SubSystemFactory. + */ + public boolean forceUserIdToUpperCase(); + /** + * Alternative to getUserId when we don't want to resolve it from parent connection. + * This is used when showing the properties. + *

    + * Unlike getUserId() this one does not defer to the connection's default user Id if + * the subsystem's userId attribute is null. + *

    + * To set the local user Id, simply call setUserId(String id). To clear it, call + * {@link #clearLocalUserId()}. + *

    + * @see org.eclipse.rse.model.IHost#getDefaultUserId() + * @see #clearLocalUserId() + * @see #getUserId() + * @see #setUserId(String) + */ + public String getLocalUserId(); + /** + * Called to clear the local user Id such that subsequent requests to getUserId() will + * return the parent connection's default user Id. Sets the user Id attribute for this + * subsystem to null. + *

    + * @see org.eclipse.rse.model.IHost#getDefaultUserId() + * @see #getUserId() + * @see #getLocalUserId() + * @see #setUserId(String) + */ + public void clearLocalUserId(); + /** + * Return the children for this subsystem. + * This is used to populate the Remote System View explorer. + *

    + * By default, if the parent subsystem factory supports filters, then + * we return getSystemFilterPoolReferencesArray. If filters are not + * supported (supportsFilters() returns false from factory) then we + * return null. In this case you should override this. + */ + public Object[] getChildren(); + /** + * Return true if this subsystem has children objects to + * be displayed in the Remote System View explorer. + */ + public boolean hasChildren(); + + /** + * Return true if the given filter lists the contents of the given remote object. + * For example, if given a folder, return true if any of the filter strings in this filter + * lists the contents of that folder. Used in impact analysis when a remote object is + * created, deleted, renamed, copied or moved, so as to establish which filters need to be + * refreshed or collapsed (if the folder is deleted, say). + *

    + * The default algorithm calls doesFilterStringListContentsOf for each filter string. + */ + public boolean doesFilterListContentsOf(ISystemFilter filter, String remoteObjectAbsoluteName); + /** + * Return true if the given filter string lists the contents of the given remote object. + * For example, if given a folder, return true if the given filter string + * lists the contents of that folder. Used in impact analysis when a remote object is + * created, deleted, renamed, copied or moved, so as to establish which filters need to be + * refreshed or collapsed (if the folder is deleted, say). + */ + public boolean doesFilterStringListContentsOf(ISystemFilterString filterString, String remoteObjectAbsoluteName); + + /** + * Return true if the given remote object name will pass the filtering criteria for any of + * the filter strings in this filter. + */ + public boolean doesFilterMatch(ISystemFilter filter, String remoteObjectAbsoluteName); + /** + * Return true if the given remote object name will pass the filtering criteria for the + * given filter string in this filter. + */ + public boolean doesFilterStringMatch(String filterString, String remoteObjectAbsoluteName, boolean caseSensitive); + + // ------------------------- + // Filter Pool References... + // ------------------------- + /** + * Return the system filter pool reference manager, as per the + * interface SystemFilterPoolReferenceManagerProvider + */ + public ISystemFilterPoolReferenceManager getSystemFilterPoolReferenceManager(); + + /** + * @return The value of the Name attribute + */ + public String getName(); + + /** + * @param value The new value of the Name attribute + */ + public void setName(String value); + + /** + * Returns the value of this subsystem's user id if it is not null. If it + * is null, it returns the parent connection object's default user Id. + *

    + * In fact, we now don't store the user Id in the subsystem object itself, but rather store it in the + * user preferences, so that such things are not shared among the team on a synchronize operation. + * This is transparent to callers of this method however, as this method resolves from the preferences. + * + * @see org.eclipse.rse.model.IHost#getDefaultUserId() + * @see #setUserId(String) + * @see #getLocalUserId() + * @see #clearLocalUserId() + * @return The value of the UserId attribute + */ + public String getUserId(); + + /** + * @return The value of the FactoryId attribute + * Ties this subsystem to its owning subsystemconfiguration, via the + * id key string of the factory + */ + public String getConfigurationId(); + + /** + * @param value The new value of the FactoryId attribute + */ + public void setConfigurationId(String value); + + // --------------------------------------------------- + // The following methods relate to the live connection + // --------------------------------------------------- + /** + * Return the ISystem object that represents the live connection for this system. + */ + public IConnectorService getConnectorService(); + + /** + * Check if the SubSystem supports caching. + */ + public boolean supportsCaching(); + + /** + * Return the CacheManager for this subsystem. If the SubSystem returns true for + * supportsCaching() then it must return a valid CacheManager, otherwise it is free + * to return null. + * + * @see #supportsCaching() + */ + public ICacheManager getCacheManager(); + + /** + * Return true if this subsystem is currently connected to its remote system. + */ + public boolean isConnected(); + + /** + * Return true if the last attempt to connect this subsystem to its remote system failed. + */ + public boolean isConnectionError(); + + /** + * Sets whether the last attempt to connect this subsystem to its remote system failed. + */ + public void setConnectionError(boolean error); + + /** + * Return true if this subsystem is currently being used in "offline" mode. Not necessarily supported + * by all subsystems in which case this will always return false. + */ + public boolean isOffline(); + /** + * Connect to the remote system. + * In addition to calling getSystem().connect(),this might fire events. + * + * @param Shell parent shell used to show error message. Null means you will handle showing the error message. + */ + public void connect(Shell shell) throws Exception; + /** + * Connect to the remote system. + * This uses Display.syncExec to get an active Shell and then calls connect(Shell) + */ + public void connect() throws Exception; + + /** + * Connect to the remote system, optionally forcing a signon prompt even if the password + * is cached in memory or on disk. + * + * @param Shell parent shell used to show error message. Null means you will handle showing the error message. + * @param forcePrompt forces the prompt dialog to be displayed even if the password is currently + * in memory. + */ + public void connect(Shell shell, boolean forcePrompt) throws Exception; + + + /** + * Disconnect from the remote system. + * In addition to calling getSystem().disconnect(),this must fire an + * event to collapse the expanded nodes in the tree under this node. + */ + public void disconnect(Shell shell) throws Exception; + + /** + * Disconnect from the remote system. + * In addition to calling getSystem().disconnect(),this may fire an + * event to collapse the expanded nodes in the tree under this node + * depending on the value of collapseTree. + */ + public void disconnect(Shell shell, boolean collapseTree) throws Exception; + + + + /** + * Modal thread version of resolve filter strings + * Resolve an absolute filter string. This is only applicable if the subsystem + * factory reports true for supportsFilters(). + *

    + * When a user expands a filter containing filter strings, this method is + * invoked for each filter string. + *

    + * The resulting objects are displayed in the remote system view tree. They + * can be anything, but at a minimum must support IAdaptable in order to + * drive the property sheet. You can just defer the getAdapter request to + * the platform's Adapter manager if desired. + *

    + * You should supply an adapter class for the returned object's class, + * to render objects in the Remote System Explorer view. It will uses a + * label and content provider that defers all requests to the adapter, + * which it gets by querying the platform's adapter manager for the object + * type. Be sure to register your adapter factory. + * + * @param monitor the process monitor associated with this operation + * @param filterString filter pattern for objects to return. + * @return Array of objects that are the result of this filter string + */ + public Object[] resolveFilterString(IProgressMonitor monitor, String filterString) + throws Exception; + + /** + * Modal thread version of resolve filter strings + * Resolve an absolute filter string. This is only applicable if the subsystem + * factory reports true for supportsFilters(). + *

    + * When a user expands a filter containing filter strings, this method is + * invoked for each filter string. + *

    + * The resulting objects are displayed in the remote system view tree. They + * can be anything, but at a minimum must support IAdaptable in order to + * drive the property sheet. You can just defer the getAdapter request to + * the platform's Adapter manager if desired. + *

    + * You should supply an adapter class for the returned object's class, + * to render objects in the Remote System Explorer view. It will uses a + * label and content provider that defers all requests to the adapter, + * which it gets by querying the platform's adapter manager for the object + * type. Be sure to register your adapter factory. + * + * @param monitor the process monitor associated with this operation + * @param filterStrings filter patterns for objects to return. + * @return Array of objects that are the result of this filter string + */ + public Object[] resolveFilterStrings(IProgressMonitor monitor, String[] filterStrings) + throws Exception; + + /** + * Modal thread version of resolve filter strings + * Resolve an absolute filter string. This is only applicable if the subsystem + * factory reports true for supportsFilters(). + *

    + * When a user expands a filter containing filter strings, this method is + * invoked for each filter string. + *

    + * The resulting objects are displayed in the remote system view tree. They + * can be anything, but at a minimum must support IAdaptable in order to + * drive the property sheet. You can just defer the getAdapter request to + * the platform's Adapter manager if desired. + *

    + * You should supply an adapter class for the returned object's class, + * to render objects in the Remote System Explorer view. It will uses a + * label and content provider that defers all requests to the adapter, + * which it gets by querying the platform's adapter manager for the object + * type. Be sure to register your adapter factory. + * + * @param monitor the process monitor associated with this operation + * @param parent the parent object to query + * @param filterString filter pattern for objects to return. + * @return Array of objects that are the result of this filter string + */ + public Object[] resolveFilterString(IProgressMonitor monitor, Object parent, String filterString) + throws Exception; + + /** + * Resolve an absolute filter string. This is only applicable if the subsystem + * factory reports true for supportsFilters(). + *

    + * When a user expands a filter containing filter strings, this method is + * invoked for each filter string. + *

    + * The resulting objects are displayed in the remote system view tree. They + * can be anything, but at a minimum must support IAdaptable in order to + * drive the property sheet. You can just defer the getAdapter request to + * the platform's Adapter manager if desired. + *

    + * You should supply an adapter class for the returned object's class, + * to render objects in the Remote System Explorer view. It will uses a + * label and content provider that defers all requests to the adapter, + * which it gets by querying the platform's adapter manager for the object + * type. Be sure to register your adapter factory. + * + * @param filterString filter pattern for objects to return. + * @param Shell parent shell used to show error message. Null means you will handle showing the error message. + * @return Array of objects that are the result of this filter string + */ + public Object[] resolveFilterString(String filterString, Shell shell) + throws Exception; + /** + * Resolve multiple absolute filter strings. This is only applicable if the subsystem + * factory reports true for supportsFilters(). + *

    + * This is the same as {@link #resolveFilterString(String,Shell)} but takes an array of + * filter strings versus a single filter string. + * + * @param filterStrings array of filter patterns for objects to return. + * @param Shell parent shell used to show error message. Null means you will handle showing the error message. + * @return Array of objects that are the result of resolving all the filter strings + */ + public Object[] resolveFilterStrings(String[] filterStrings, Shell shell) + throws Exception; + + /** + * Resolve an relative filter string. This is only applicable if the subsystem + * factory reports true for supportsFilters(). + *

    + * When a user expands an object that came from a previous filter string expansion, + * (such as expanding a folder), this method is invoked to get the children of + * that object. The user can choose to expand all, or choose a pre-defined + * relative filter string to subset/filter the children. In either case, the + * relative filter string is passed in as well as the to-be-expanded parent object. + *

    + * The resulting objects are displayed in the remote system view tree. They + * can be anything, but at a minimum must support IAdaptable in order to + * drive the property sheet. You can just defer the getAdapter request to + * the platform's Adapter manager if desired. + *

    + * You should supply an adapter class for the returned object's class, + * to render objects in the Remote System Explorer view. It will uses a + * label and content provider that defers all requests to the adapter, + * which it gets by querying the platform's adapter manager for the object + * type. Be sure to register your adapter factory. + * + * @param parent Object that is being expanded. + * @param filterString filter pattern for children of parent. + * @param Shell parent shell used to show error message. Null means you will handle showing the error message. + * @return Array of objects that are the result of this filter string + */ + public Object[] resolveFilterString(Object parent, String filterString, Shell shell) + throws Exception; + + /* + * Execute a remote command. This is only applicable if the subsystem factory reports + * true for supportsCommands(). + * @param command Command to be executed remotely. + * @param Shell parent shell used to show error message. Null means you will handle showing the error message. + * @param Object context context of a command (i.e. working directory). Null is valid and means to use the default context. + * @return Array of objects that are the result of running this command. Typically, these + * are messages logged by the command. + * + public Object[] runCommand(String command, Shell shell, Object context) + throws Exception; + + /* + * Provide list of executed commands on subsystem.This is only applicable if the subsystem factory reports + * true for supportsCommands(). + * + public String[] getExecutedCommands(); + */ + + /** + * Set a remote property. Subsystems interpret as they wish. Eg, this might be to set + * a remote environment variable. This is only applicable if the subsystem factory reports + * true for supportsProperties(). + * @param subject Identifies which object to get the properties of + * @param key Identifies property to set + * @param value Value to set property to + * @param Shell parent shell used to show error message. Null means you will handle showing the error message. + * @return Object interpretable by subsystem. Might be a Boolean, or the might be new value for confirmation. + */ + public Object setProperty(Object subject, String key, String value, Shell shell) + throws Exception; + + /** + * Get a remote property. Subsystems interpret as they wish. Eg, this might be to get + * a remote environment variable. This is only applicable if the subsystem factory reports + * true for supportsProperties(). + * @param subject Identifies which object to get the properties of + * @param key Identifies property to get value of + * @param Shell parent shell used to show error message. Null means you will handle showing the error message. + * @return String The value of the requested key. + */ + public String getProperty(Object subject, String key, Shell shell) + throws Exception; + + /** + * Set multiple remote properties. Subsystems interpret as they wish. Eg, this might be to set + * a number of remote environment variables. This is only applicable if the subsystem factory reports + * true for supportsProperties(). + * @param subject Identifies which object to get the properties of + * @param key Identifies property to set + * @param value Values to set properties to. One to one mapping to keys by index number + * @param Shell parent shell used to show error message. Null means you will handle showing the error message. + * @return Object interpretable by subsystem. Might be a Boolean, or the might be new values for confirmation. + */ + public Object setProperties(Object subject, String[] keys, String[] values, Shell shell) + throws Exception; + + /** + * Get a remote property. Subsystems interpret as they wish. Eg, this might be to get + * a remote environment variable. This is only applicable if the subsystem factory reports + * true for supportsProperties(). + * @param subject Identifies which object to get the properties of + * @param key Identifies property to get value of + * @param Shell parent shell used to show error message. Null means you will handle showing the error message. + * @return Object The values of the requested keys. + */ + public String[] getProperties(Object subject, String[] keys, Shell shell) + throws Exception; + + /** + * Generated persistent property method
    + * Return true if this subsystem is to be hidden so it doesn't show in the Remote Systems + * view when a connection is expanded. If so, this subsystem is for programmatic use only, + * or is exposed in alternative view. Such is the case for command subsystems, for example. + * @generated This field/method will be replaced during code generation + * @return The value of the Hidden attribute + */ + boolean isHidden(); + + /** + * Generated persistent property method
    + * Specify true if this subsystem is to be hidden so it doesn't show in the Remote Systems + * view when a connection is expanded. If so, this subsystem is for programmatic use only, + * or is exposed in alternative view. Such is the case for command subsystems, for example. + * @generated This field/method will be replaced during code generation + * @param value The new value of the Hidden attribute + */ + void setHidden(boolean value); + + /** + * Generated persistent property method
    + * Return the object that manages the list of + * filter pools referenced by this subsystem. + * @generated This field/method will be replaced during code generation + * @return The FilterPoolReferenceManager reference + */ + ISystemFilterPoolReferenceManager getFilterPoolReferenceManager(); + + /** + * Generated persistent property method
    + * Set the object that manages the list of + * filter pools referenced by this subsystem. This is called by the subsystem factory + * when creating or restoring subsystems. + * @generated This field/method will be replaced during code generation + * @param l The new value of the FilterPoolReferenceManager reference + */ + void setFilterPoolReferenceManager(ISystemFilterPoolReferenceManager value); + + + + + + + /** + * Returns the parent object associated with a filter reference. It's up to the + * subsystem implementation to decide what "parent object" means for a filter reference. + * @param filterRef the filter reference to determine a target object from. + * @return + */ + Object getTargetForFilter(ISystemFilterReference filterRef); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ISubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ISubSystemConfiguration.java new file mode 100644 index 00000000000..a709f25d1cb --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ISubSystemConfiguration.java @@ -0,0 +1,598 @@ +/******************************************************************************** + * 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.core.subsystems; + + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.persistence.IRSEPersistableContainer; +import org.eclipse.rse.ui.SystemMenuManager; +import org.eclipse.rse.ui.messages.ISystemMessageLine; +import org.eclipse.rse.ui.validators.ISystemValidator; +import org.eclipse.rse.ui.wizards.ISystemNewConnectionWizardPage; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Shell; + + + + +public interface ISubSystemConfiguration extends ISystemFilterPoolManagerProvider, IRSEPersistableContainer +{ + // --------------------------------- + // CONSTANTS... + // --------------------------------- + public static final boolean FORCE_INTO_MEMORY = true; + public static final boolean LAZILY = false; + + /** + * Reset for a full refresh from disk, such as after a team synch. + */ + public void reset(); + // --------------------------------- + // CRITICAL METHODS... + // --------------------------------- + /** + * Return true (default) or false to indicate if subsystems of this factory require a userId to + * do connection or not. If not, no GUI will be supplied related to user Ids in the remote systems + * explorer view. + *

    Returns true in default implementation. + */ + public boolean supportsUserId(); + + /** + * Return true if the subsystem supports more than one filter string + *

    RETURNS true BY DEFAULT + */ + public boolean supportsMultiStringFilters(); + + /** + * Return true if the subsystem supports the exporting of filter strings from it's filters + *

    RETURNS true BY DEFAULT + */ + public boolean supportsFilterStringExport(); + + /** + * Return true if subsystem instances from this factory support connect and disconnect actions + *

    Returns true in default implementation. + */ + public boolean supportsSubSystemConnect(); + /** + * Return true (default) or false to indicate if subsystems of this factory support user-editable + * port numbers. + *

    Returns true in default implementation. + */ + public boolean isPortEditable(); + /** + * Return true if subsystem instances from this factory support remote command execution + *

    Returns false in default implementation, and is usually only true for command subsystems. + */ + public boolean supportsCommands(); + /** + * Return true if subsystem instances from this factory support getting and setting properties + *

    Returns false in default implementation, and not actually used yet. + */ + public boolean supportsProperties(); + /** + * Required method for subsystem factory child classes. Return true if you support filters, false otherwise. + * If you support filters, then some housekeeping will be done for you automatically. Specifically, they + * will be saved and restored for you automatically. + *

    Returns true in default implementation. + */ + public boolean supportsFilters(); + + /** + * Indicates whether the subsystem supports displaying children under + * its filters. By default, this will return true, but if filters that can't + * be expanded are desired, this can be overridden to return false. + */ + public boolean supportsFilterChildren(); + + /** + * Required method for subsystem factory child classes. Return true if you filter caching. + * If you support filter caching, then the views will always check the in-memory cache for + * filter results before attempting a query. + *

    Returns true in default implementation. + */ + public boolean supportsFilterCaching(); + + /** + * Required method for subsystem factory child classes. Return true if you support filters, and you support + * multiple filter strings per filter. Return false to restrict the user to one string per filter. + *

    Returns true in default implementation. + */ + public boolean supportsMultipleFilterStrings(); + /** + * Required method for subsystem factory child classes if returning true from supportsFilters. + * Return true if you support filters within filters, false otherwise. + *

    Returns false in default implementation. + */ + public boolean supportsNestedFilters(); + /** + * Return true if you support quick filters. These allow the user to subset a remote system object at + * the time they expand it in the remote system explorer tree view. + *

    + * Not supported yet + */ + public boolean supportsQuickFilters(); + + /** + * Return true if filters of this subsystem factory support dropping into. + */ + public boolean supportsDropInFilters(); + + /** + * Return true if filters of this subsystem factory provide a custom implementation of drop support. + * By default, the filter reference adapter treats a drop on a filter as an update to the list of filter + * strings for a filter. For things like files, it is more desirable to treat the drop as a physical + * resource copy, so in that case, custom drop makes sense. + * + * By default this returns false. + */ + public boolean providesCustomDropInFilters(); + + /** + * Return true if you support user-defined actions for the remote system objects returned from expansion of + * subsystems created by this subsystem factory + * @see #getActionSubSystem(ISubSystem) + * @see #supportsUserDefinedActions(ISelection) + *

    Returns false in default implementation. + */ + public boolean supportsUserDefinedActions(); + /** + * Return true if you support user-defined actions for the remote system objects explicitly given. This + * calls supportsUserDefinedActions() by default. It is called when decided whether or not to show + * the User Actions menu for the current selection, if supportsUserDefinedActions() returns true. + * @see #getActionSubSystem(ISubSystem) + * @see #createActionSubSystem() + * @see #addCommonRemoteActions(SystemMenuManager, IStructuredSelection, Shell, String, ISubSystem) + */ + public boolean supportsUserDefinedActions(ISelection selection); + /** + * Return true if you support compile actions for the remote system objects returned from expansion of + * subsystems created by this subsystem factory. + * @see #getCompileManager() + *

    Returns false in default implementation. + */ + public boolean supportsCompileActions(); + /** + * Return true if you support user-defined/managed named file types + *

    Returns false in default implementation. + */ + public boolean supportsFileTypes(); + /** + * Tell us if this subsystem factory supports targets, which are destinations for + * pushes and builds. Normally only true for file system factories. + */ + public boolean supportsTargets(); + /** + * Tell us if this subsystem factory supports server launch properties, which allow the user + * to configure how the server-side code for these subsystems are started. There is a Server + * Launch Setting property page, with a pluggable composite, where users can configure these + * properties. + *
    By default we return false here. This is overridden in UniversalFileSubSystemFactory though. + */ + public boolean supportsServerLaunchProperties(IHost host); + /** + * If {@link #supportsServerLaunchProperties()} returns true, this method may be called by + * the server launcher to decide if a given remote server launch type is supported or not. + *
    We return true by default. + * @see org.eclipse.rse.core.subsystems.ServerLaunchType + * @see #getServerLauncherForm(Shell, ISystemMessageLine) + */ + public boolean supportsServerLaunchType(ServerLaunchType serverLaunchType); + + /** + * Tell us if filter strings are case sensitive. + *

    Returns false in default implementation. + */ + public boolean isCaseSensitive(); + + // --------------------------------- + // USER-PREFERENCE METHODS... + // --------------------------------- + /** + * If we support filters, should we show filter pools in the remote system explorer? + * Typically retrieved from user preferences. + */ + public boolean showFilterPools(); + /* + * If we support filters, should we show filter strings in the remote system explorer? + * Typically retrieved from user preferences. + * + public boolean showFilterStrings(); + */ + /** + * If we support filters, should we show filter pools in the remote system explorer? + * This is to set it after the user changes it in the user preferences. It may require + * refreshing the current view. + */ + public void setShowFilterPools(boolean show); + /* + * If we support filters, should we show filter strings in the remote system explorer? + * This is to set it after the user changes it in the user preferences. It may require + * refreshing the current view. + * + public void setShowFilterStrings(boolean show); + */ + + // --------------------------------- + // PROXY METHODS. USED INTERNALLY... + // --------------------------------- + /** + * Private method called by SystemPlugin + */ + public void setSubSystemFactoryProxy(ISubSystemConfigurationProxy proxy); + /** + * Private method + */ + public ISubSystemConfigurationProxy getSubSystemFactoryProxy(); + + // --------------------------------- + // FACTORY ATTRIBUTE METHODS... + // --------------------------------- + /** + * Return vendor of this factory. + * This comes from the xml "vendor" attribute of the extension point. + */ + public String getVendor(); + /** + * Return name of this factory. Matches value in name attribute in extension point xml + */ + public String getName(); + /** + * Return description of this factory. Comes from translated description string in extension point xml + */ + public String getDescription(); + /** + * Return unique id of this factory. Matches value in id attribute in extension point xml + */ + public String getId(); + /** + * Return image descriptor for subsystems created by this factory. Comes from icon attribute in extension point xml + */ + public ImageDescriptor getImage(); + /** + * Return actual graphics Image of this factory. + * This is the same as calling getImage().createImage() but the resulting image is cached + */ + public Image getGraphicsImage(); + /** + * Return image to use when this susystem is connection. Comes from icon attribute in extension point xml + */ + public ImageDescriptor getLiveImage(); + /** + * Return actual graphics LiveImage of this factory. + * This is the same as calling getLiveImage().createImage() but the resulting image is cached + */ + public Image getGraphicsLiveImage(); + /** + * Return the category this subsystem factory subscribes to. + * @see org.eclipse.rse.model.ISubSystemFactoryCategories + */ + public String getCategory(); + /** + * Return the system types this subsystem factory supports. + */ + public String[] getSystemTypes(); + + // --------------------------------- + // PROFILE METHODS... + // --------------------------------- + /** + * Called by SystemRegistry when we are about to delete a profile. + *

    + * Our only mission is to delete the filter pool associated with it, + * because the registry has already called deleteSubSystemsByConnection + * for every subsystem of every connection owned by this profile. + */ + public void deletingSystemProfile(ISystemProfile profile); + /** + * Called by SystemRegistry when we have toggled the active-status of a profile + */ + public void changingSystemProfileActiveStatus(ISystemProfile profile, boolean newStatus); + /** + * Get owning profile object given a filter pool object + */ + public ISystemProfile getSystemProfile(ISystemFilterPool pool); + + // --------------------------------- + // SUBSYSTEM METHODS... + // --------------------------------- + /** + * Return the validator for the userId. + * A default is supplied. + * Note this is only used for the subsystem's properties, so will not + * be used by the connection's default. Thus, is only of limited value. + *

    + * This must be castable to ICellEditorValidator for the property sheet support. + */ + public ISystemValidator getUserIdValidator(); + /** + * Return the validator for the password which is prompted for at runtime. + * No default is supplied. + */ + public ISystemValidator getPasswordValidator(); + /** + * Return the validator for the port. + * A default is supplied. + * This must be castable to ICellEditorValidator for the property sheet support. + */ + public ISystemValidator getPortValidator(); + /** + * Called by SystemRegistry's renameSystemProfile method to ensure we update our + * subsystem names within each subsystem. + *

    + * This is called AFTER changing the profile's name!! + */ + public void renameSubSystemProfile(ISubSystem ss, String oldProfileName, String newProfileName); + /** + * Called by SystemRegistry's renameSystemProfile method to pre-test if we are going to run into errors on a + * profile rename, due to file or folder in use. + */ + public void preTestRenameSubSystemProfile(String oldProfileName) throws Exception; + /** + * Called by SystemRegistry's renameConnection method to ensure we update our + * connection names within each subsystem. + *

    + * Must be called prior to changing the connection's name!! + */ + public void renameSubSystemsByConnection(IHost conn, String newConnectionName); + /** + * Called by SystemRegistry's deleteConnection method to ensure we delete all our + * subsystems for a given connection. + */ + public void deleteSubSystemsByConnection(IHost conn); + + /** + * Creates a new subsystem instance that is associated with the given connection object. + * SystemRegistryImpl calls this when a new connection is created, and appliesToSystemType returns true. + * @param conn The connection to create a subsystem for + * @param creatingConnection true if we are creating a connection, false if just creating + * another subsystem for an existing connection. + * @param yourNewConnectionWizardPages The wizard pages you supplied to the New Connection wizard, via the + * {@link #getNewConnectionWizardPages(IWizard)} method or null if you didn't override this method. + */ + public ISubSystem createSubSystem(IHost conn, boolean creatingConnection, ISystemNewConnectionWizardPage[] yourNewConnectionWizardPages); + + // used in the case where newsubsystems are added after a connection exists + public ISubSystem createSubsystemAfterTheFact(IHost conn); + + public ISubSystem createSubSystemInternal(IHost conn); + + + /** + * Find or create a connector service for this host + * @param host + * @return + */ + public IConnectorService getConnectorService(IHost host); + + /** + * Overridable entry for child classes to contribute a server launcher instance + * for a given subsystem. + *

    + * Create an instance of ServerLauncher, and add it to the given subsystem. + * When a subsystem is created, and {@link #supportsServerLaunchProperties()} + * returns true, this method is called to create the server launcher instance + * associated with the subsystem. The default implementation is to create an + * instance of {@link IIBMServerLauncher}, but override to create your own + * ServerLauncher instance if you have your own class. + */ + public IServerLauncherProperties createServerLauncher(IConnectorService connectorService); + + /** + * Updates user-editable attributes of an existing subsystem instance. + * These attributes typically affect the live connection, so the subsystem will be forced to + * disconnect. + *

    + * The subsystem will be saved to disk. + * @param shell parent shell needed in case an error message is displayed + * @param subsystem target of the update action + * @param updateUserId true if we are updating the userId, else false to ignore userId + * @param userId new local user Id. Ignored if updateUserId is false + * @param updatePort true if we are updating the port, else false to ignore port + * @param port new local port value. Ignored if updatePort is false + */ + public void updateSubSystem(Shell shell, ISubSystem subsystem, boolean updateUserId, String userId, boolean updatePort, int port); + /** + * Update the port for the given subsystem instance. + * Shortcut to {@link #updateSubSystem(Shell,ISubSystem,boolean,String,boolean,Integer)} + */ + public void setSubSystemPort(Shell shell, ISubSystem subsystem, int port); + /** + * Update the user ID for the given subsystem instance. + * Shortcut to {@link #updateSubSystem(Shell,ISubSystem,boolean,String,boolean,Integer)} + */ + public void setSubSystemUserId(Shell shell, ISubSystem subsystem, String userId); + + /** + * Returns true if this factory allows users to delete instances of subsystem objects. + * Would only be true if users are allowed to create multiple instances of subsystem objects + * per connection. + */ + public boolean isSubSystemsDeletable(); + /** + * Deletes a given subsystem instance from the list maintained by this factory. + * SystemRegistryImpl calls this when the user selects to delete a subsystem object, + * or delete the parent connection this subsystem is associated with. + * In former case, this is only called if the factory supports user-deletable subsystems. + */ + public boolean deleteSubSystem(ISubSystem subsystem); + /** + * Clone a given subsystem into the given connection. + * Called when user does a copy-connection action. + * @param oldSubsystem The subsystem to be cloned + * @param newConnection The connection into which to create and clone the old subsystem + * @param copyProfileOperation Pass true if this is an profile-copy operation versus a connection-copy operation + * @return New subsystem within the new connection + */ + public ISubSystem cloneSubSystem(ISubSystem oldSubsystem, IHost newConnection, boolean copyProfileOperation) + throws Exception; + /** + * Returns a list of subsystem objects existing for the given connection. + * @param conn System connection to retrieve subsystems for + * @param force true if we should force all the subsystems to be restored from disk if not already + */ + public ISubSystem[] getSubSystems(IHost conn, boolean force); + /** + * Returns a list of all subsystem objects for all connections. + */ + public ISubSystem[] getSubSystems(boolean force); + /** + * Renames a subsystem. This is better than ss.setName(String newName) as it saves the subsystem to disk. + */ + public void renameSubSystem(ISubSystem subsystem, String newName); + /** + * Disconnect all subsystems currently connected. + * Called by shutdown() of SystemPlugin. + */ + public void disconnectAllSubSystems() + throws Exception; + + // --------------------------------- + // FILTER POOL METHODS... + // --------------------------------- + /** + * Get the filter pool manager for the given profile + */ + public ISystemFilterPoolManager getFilterPoolManager(ISystemProfile profile); + /** + * Copy the filter pool manager and return a new one. Called during profile-copy operations. + * Will also copy all of the filter pools and their respective data. + */ + public ISystemFilterPoolManager copyFilterPoolManager(ISystemProfile oldProfile, ISystemProfile newProfile) + throws Exception; + + /** + * Given a subsystem, return the first (hopefully only) default pool for this + * subsystem's profile. + */ + public ISystemFilterPool getDefaultSystemFilterPool(ISubSystem subsys); + /** + * Test if any filter pools in the given profile are referenced by other profiles, + * which are active. + *

    + * Called when user tries to make a profile inactive. We prevent this if there exists + * active references. + * @param profile The profile being tested + * @return An array of the active subsystems which reference filter pools in this profile, + * or null if none are found. + */ + public ISubSystem[] testForActiveReferences(ISystemProfile profile); + + // --------------------------------- + // FILTER METHODS + // --------------------------------- + /** + * Return the translated string to show in the property sheet for the type property when a filter is selected. + */ + public String getTranslatedFilterTypeProperty(ISystemFilter selectedFilter); + /** + * Return true if we should show the refresh action in the popup for the given element. + */ + public boolean showRefreshOnFilter(); + + /** + * Return true if we should show the show in table action in the popup for the given element. + */ + public boolean showGenericShowInTableOnFilter(); + + + + + /** + * Given a filter, decide whether to show the Filter Strings property page + * for this filter. Default is true. + */ + public boolean showChangeFilterStringsPropertyPage(ISystemFilter filter); + + + /** + * Determines whether this factory is responsible for the creation of subsytems of the specified type + * Subsystem factories should override this to indicate which subsystems they support. + * + * @param subSystemType type of subsystem + * @return whether this factory is for the specified subsystemtype + */ + public boolean isFactoryFor(Class subSystemType); + + // --------------------------------- + // FILTER REFERENCE METHODS + // --------------------------------- + + // --------------------------------- + // STATE METHODS... + // --------------------------------- + /** + * Called by adapters prior to asking for actions, in case the connection of the currently selected + * object is required by the action. + */ + public void setConnection(IHost connection); + /** + * Called by adapters prior to asking for actions. For cases when current selection is needed. + */ + public void setCurrentSelection(Object[] selection); + // --------------------------------- + // SAVE METHODS... + // --------------------------------- + /** + * Saves absolutely everything to disk. This is called as a safety + * measure when the workbench shuts down. + *

    + * Totally handled for you! + *

    + * Calls saveSubSystems() and saveFilterPools() + *

    + * Exceptions are swallowed since we cannot deal with them on shutdown anyway! + */ + public boolean commit(); + /** + * Save one subsystem to disk. + * Called by each subsystem when their data changes. + */ + public void saveSubSystem(ISubSystem subsys) + throws Exception; + + /** + * Private. Do not call or use.
    + * @generated This field/method will be replaced during code generation + * @return The list of SubSystemList references + */ + java.util.List getSubSystemList(); + + /** + * Private. Do not call or use.
    + * @generated This field/method will be replaced during code generation + * @return The list of FilterPoolManagerList references + */ + java.util.List getFilterPoolManagerList(); + + public ISystemFilterPool getDefaultFilterPool(ISystemProfile profile, String oldProfileName); + public ISystemProfile getSystemProfile(String name); + public void renameFilterPoolManager(ISystemProfile profile); + + + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ISubSystemConfigurationProxy.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ISubSystemConfigurationProxy.java new file mode 100644 index 00000000000..57396d8cb38 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ISubSystemConfigurationProxy.java @@ -0,0 +1,103 @@ +/******************************************************************************** + * 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.core.subsystems; +import org.eclipse.jface.resource.ImageDescriptor; + +/** + * Interface to SubSystemFactoryExtension class + * Internal use, not likely you will ever need to use it or access it directly. + */ +public interface ISubSystemConfigurationProxy +{ + /** + * Return value of the name xml attribute. + * Return name of this factory. Matches value in name attribute in extension point xml + */ + public String getName(); + /** + * Return value of the description xml attribute. + * Return description of this factory. Matches value in description attribute in extension point xml + */ + public String getDescription(); + /** + * Return value of the id xml attribute. + * Return unique id of this factory. + */ + public String getId(); + /** + * Return value of the systemtypes xml attribute. + * Return the system types this subsystem factory supports. + */ + public String[] getSystemTypes(); + /** + * Return true if this factory supports all system types + */ + public boolean supportsAllSystemTypes(); + + /** + * Return value of the vendor xml attribute. + * Return vendor of this factory. + */ + public String getVendor(); + /** + * Return value of the category xml attribute. + * Return the category this subsystem factory subscribes to. + * @see org.eclipse.rse.model.ISubSystemFactoryCategories + */ + public String getCategory(); + /** + * Return value of the icon xml attribute. + * Return actual graphics image used for subsystems when there is no live connection. + */ + public ImageDescriptor getImage(); + /** + * Return value of the iconlive xml attribute. + * Return actual graphics image used for subsystems when there is a live connection. + */ + public ImageDescriptor getLiveImage(); + + /** + * Return true if the subsystem factory has been instantiated yet + */ + public boolean isSubSystemFactoryActive(); + /** + * Return the subsystem factory singleton instance. Will instantiate if not already. + */ + public ISubSystemConfiguration getSubSystemFactory(); + /** + * Return an instance of the ISystem class identified by the "systemClass" attribute + * of this subsystemFactory extension point. Note each call to this method returns a + * new instance of the class, or null if no "systemClass" attribute was specified. + */ + public IConnectorService getSystemObject(); + + /** + * Test if the given system type matches one or more of the types declared in the + * systemtypes attribute of this extension. + */ + public boolean appliesToSystemType(String type); + + /** + * Reset for a full refresh from disk, such as after a team synch. + */ + public void reset(); + + /** + * After a reset, restore from disk + */ + public void restore(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/RemoteChildrenContentsType.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/RemoteChildrenContentsType.java new file mode 100644 index 00000000000..a86be63c2e1 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/RemoteChildrenContentsType.java @@ -0,0 +1,50 @@ +/******************************************************************************** + * 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.core.subsystems; + +import org.eclipse.rse.model.ISystemContentsType; + +/** + * Represents contents that are children of a container + */ +public class RemoteChildrenContentsType implements ISystemContentsType +{ + public static String CONTENTS_TYPE_CHILDREN = "contents_children"; + public static RemoteChildrenContentsType _instance = new RemoteChildrenContentsType(); + + public static RemoteChildrenContentsType getInstance() + { + return _instance; + } + + /* (non-Javadoc) + * @see com.ibm.etools.systems.subsystems.IRemoteContentsType#getType() + */ + public String getType() + { + return CONTENTS_TYPE_CHILDREN; + } + + /* (non-Javadoc) + * @see com.ibm.etools.systems.subsystems.IRemoteContentsType#isPersistent() + */ + public boolean isPersistent() + { + return false; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ServerLaunchType.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ServerLaunchType.java new file mode 100644 index 00000000000..38be42e292c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/ServerLaunchType.java @@ -0,0 +1,288 @@ +/******************************************************************************** + * 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.core.subsystems; +import java.util.Arrays; +import java.util.List; + + + + +public final class ServerLaunchType +{ + /** + * The 'Daemon' literal value. + * + * The server code is to be launched by calling a daemon that is listening on a port. + * + * @see #DAEMON_LITERAL + * @model name="Daemon" + * @generated + * @ordered + */ + public static final int DAEMON = 0; + + /** + * The 'Rexec' literal value. + * + * The server code is to be launched using REXEC + * + * @see #REXEC_LITERAL + * @model name="Rexec" + * @generated + * @ordered + */ + public static final int REXEC = 1; + + /** + * The 'Running' literal value. + * + * The server code is to already running, and doesn't need to be launched. + * + * @see #RUNNING_LITERAL + * @model name="Running" + * @generated + * @ordered + */ + public static final int RUNNING = 2; + + /** + * The 'Telnet' literal value. + * + * The server code is to be launched using TELNET. + * + * @see #TELNET_LITERAL + * @model name="Telnet" + * @generated + * @ordered + */ + public static final int TELNET = 3; + + /** + * The 'SSH' literal value. + * + * The server code is to be launched using SSH. + * + * @see #SSH_LITERAL + * @model + * @generated + * @ordered + */ + public static final int SSH = 4; + + /** + * The 'FTP' literal value. + * + * The server code is to be launched using FTP + * + * @see #FTP_LITERAL + * @model + * @generated + * @ordered + */ + public static final int FTP = 5; + + /** + * The 'HTTP' literal value. + * + * The server code is to be launched using HTTP + * + * @see #HTTP_LITERAL + * @model + * @generated + * @ordered + */ + public static final int HTTP = 6; + + /** + * The 'Daemon' literal object. + * + *

    + * The server code is to be launched by calling a daemon that is listening on a port. + *

    + * + * @see #DAEMON + * @generated + * @ordered + */ + public static final ServerLaunchType DAEMON_LITERAL = new ServerLaunchType(DAEMON, "Daemon"); + + /** + * The 'Rexec' literal object. + * + *

    + * The server code is to be launched using REXEC + *

    + * + * @see #REXEC + * @generated + * @ordered + */ + public static final ServerLaunchType REXEC_LITERAL = new ServerLaunchType(REXEC, "Rexec"); + + /** + * The 'Running' literal object. + * + *

    + * The server code is to already running, and doesn't need to be launched. + *

    + * + * @see #RUNNING + * @generated + * @ordered + */ + public static final ServerLaunchType RUNNING_LITERAL = new ServerLaunchType(RUNNING, "Running"); + + /** + * The 'Telnet' literal object. + * + *

    + * The server code is to be launched using TELNET. + *

    + * + * @see #TELNET + * @generated + * @ordered + */ + public static final ServerLaunchType TELNET_LITERAL = new ServerLaunchType(TELNET, "Telnet"); + + /** + * The 'SSH' literal object. + * + *

    + * If the meaning of 'SSH' literal object isn't clear, + * there really should be more of a description here... + *

    + * + * @see #SSH + * @generated + * @ordered + */ + public static final ServerLaunchType SSH_LITERAL = new ServerLaunchType(SSH, "SSH"); + + /** + * The 'FTP' literal object. + * + *

    + * The server code is to be launched using FTP + *

    + * + * @see #FTP + * @generated + * @ordered + */ + public static final ServerLaunchType FTP_LITERAL = new ServerLaunchType(FTP, "FTP"); + + /** + * The 'HTTP' literal object. + * + *

    + * The server code is to be launched using HTTP + *

    + * + * @see #HTTP + * @generated + * @ordered + */ + public static final ServerLaunchType HTTP_LITERAL = new ServerLaunchType(HTTP, "HTTP"); + + /** + * An array of all the 'Server Launch Type' enumerators. + * + * + * @generated + */ + private static final ServerLaunchType[] VALUES_ARRAY = + new ServerLaunchType[] + { + DAEMON_LITERAL, + REXEC_LITERAL, + RUNNING_LITERAL, + TELNET_LITERAL, + SSH_LITERAL, + FTP_LITERAL, + HTTP_LITERAL, + }; + + private String _name; + private int _value; + + /** + * A public read-only list of all the 'Server Launch Type' enumerators. + * + * + * @generated + */ + public static final List VALUES = Arrays.asList(VALUES_ARRAY); + + /** + * Returns the 'Server Launch Type' literal with the specified name. + * + * + * @generated + */ + public static ServerLaunchType get(String name) + { + for (int i = 0; i < VALUES_ARRAY.length; ++i) + { + ServerLaunchType result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) + { + return result; + } + } + return null; + } + + /** + * Returns the 'Server Launch Type' literal with the specified value. + * + * + * @generated + */ + public static ServerLaunchType get(int value) + { + switch (value) + { + case DAEMON: return DAEMON_LITERAL; + case REXEC: return REXEC_LITERAL; + case RUNNING: return RUNNING_LITERAL; + case TELNET: return TELNET_LITERAL; + case SSH: return SSH_LITERAL; + case FTP: return FTP_LITERAL; + case HTTP: return HTTP_LITERAL; + } + return null; + } + + public String getName() + { + return _name; + } + + public int getType() + { + return _value; + } + + private ServerLaunchType(int value, String name) + { + _name = name; + _value = value; + + } + +} //ServerLaunchType \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystem.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystem.java new file mode 100644 index 00000000000..9a998845a40 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystem.java @@ -0,0 +1,3342 @@ +/******************************************************************************** + * 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.core.subsystems; +import java.lang.reflect.InvocationTargetException; +import java.util.Vector; + +import org.eclipse.core.resources.IResource; +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.core.runtime.jobs.ISchedulingRule; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableContext; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.SystemPreferencesManager; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.filters.ISystemFilterString; +import org.eclipse.rse.internal.model.RSEModelObject; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.IPropertySet; +import org.eclipse.rse.model.ISystemModelChangeEvents; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.SystemResourceChangeEvent; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.services.clientserver.messages.SystemMessageException; +import org.eclipse.rse.ui.GenericMessages; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.dialogs.SystemPromptDialog; +import org.eclipse.rse.ui.messages.SystemMessageDialog; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.dialogs.PropertyPage; +import org.eclipse.ui.progress.UIJob; +import org.eclipse.ui.progress.WorkbenchJob; + + + +/** + * This class is designed to be subclassed. Its role is three-fold: + *
      + *
    1. Storing of tool-specific persistent properties per connection. + *
    2. Accessing of an {@com.ibm.etools.systems.subsystems.ISystem ISystem} object to enable the subsystem's connect and disconnect actions. + *
    3. Doing actual remote accessing. This usually just involves overriding the internalResolveFilterString methods to + * populate the remote resources shown when the subsystem's filters are expanded. It might also involve overriding the inherited + * internalRunCommand method if this subsystem supports running commands remotely... although typically such subsystems + * extend {@link ShellServiceSubSystem}, not this class. + *
    + *

    + * This is the base class that subsystem suppliers subclass, although this is usually done + * by subclassing the child class {@link org.eclipse.rse.core.servicesubsystem.impl.SeviceSubSystem DefaultSubSystemImpl}.
    + * Each instance of this class represents a subsystem instance for a particular connection. + *

    + * When a {@link org.eclipse.rse.model.SystemConnection SystemConnection} is created, this subsystem's factory will be asked to create an + * instance of its subsystem. If desired, your GUI may also allow users to create additional + * instances. + *

    + * There are only a handleful of methods to implement in child classes (and indeed most of these + * are supplied as empty, so you only override those you want to support). + * These are required: + *

      + *
    • {@link #getSystem()} or, more typically, {@link #getSystemManager()} + *
    + * These are optional: + *
      + *
    • {@link #getObjectWithAbsoluteName(String)} + *
    • {@link #internalResolveFilterString(IProgressMonitor monitor, String filterString)} + *
    • {@link #internalResolveFilterString(IProgressMonitor monitor, Object parent, String filterString)} + *
    • {@link #internalRunCommand(IProgressMonitor monitor, String cmd, Object)} + *
    • {@link #internalGetProperty(IProgressMonitor monitor, String key)} + *
    • {@link #internalSetProperty(IProgressMonitor monitor, String key, String value)} + *
    • {@link #internalGetProperties(IProgressMonitor monitor, String[] keys)} + *
    • {@link #internalSetProperties(IProgressMonitor monitor, String[] keys, String[] values)} + *
    + * + */ + +public abstract class SubSystem extends RSEModelObject implements IAdaptable, ISystemFilterPoolReferenceManagerProvider, ISystemResourceChangeEvents, ISubSystem +{ + + + protected static final String SUBSYSTEM_FILE_NAME = "subsystem"; + + //protected transient SubSystemFactory parentFactory = null; + protected static final int OPERATION_RESOLVE_ABSOLUTE = 0; + protected static final int OPERATION_RESOLVE_ABSOLUTES= 1; + protected static final int OPERATION_RESOLVE_RELATIVE = 2; + protected static final int OPERATION_RUN_COMMAND = 3; + protected static final int OPERATION_GET_PROPERTY = 4; + protected static final int OPERATION_SET_PROPERTY = 5; + protected static final int OPERATION_GET_PROPERTIES = 6; + protected static final int OPERATION_SET_PROPERTIES = 7; + protected static final int OPERATION_CONNECT = 8; + protected static final int OPERATION_DISCONNECT = 9; + protected static final int OPERATION_RUN_SHELL = 10; + protected static final int OPERATION_SEND_COMMAND_TO_SHELL = 11; + protected static final int OPERATION_CANCEL_SHELL = 12; + protected static final int OPERATION_REMOVE_SHELL = 13; + + protected ISubSystemConfiguration parentSubSystemFactory; + protected String previousUserIdKey; + + protected Shell shell; + protected boolean supportsConnecting = true; + protected boolean sortResults = true; + protected boolean runInThread = true; + + protected boolean cancelable = true; + protected boolean doConnection = false; + protected ProgressMonitorDialog pmDialog; + protected String saveFileName; + protected IConnectorService _connectorService = null; + + protected boolean _connectionError = false; + protected boolean _disconnecting = false; + + protected boolean _isDirty = true; + protected boolean _wasRestored = false; + + protected IHost _host; + + + protected String _name = null; + protected String _factoryId = null; + protected boolean _hidden = false; + + + /** + * @generated This field/method will be replaced during code generation. + */ + protected ISystemFilterPoolReferenceManager filterPoolReferenceManager = null; + + + /** + * Inner class which extends UIJob to connect this connection + * on the UI Thread when no Shell is available from + * the caller + */ + public class ConnectJobNoShell extends UIJob { + + public ConnectJobNoShell() + { + super(GenericMessages.RSESubSystemOperation_Connect_message); + } + + public IStatus runInUIThread(IProgressMonitor monitor) + { + + // Cannot call Display.getCurrent().getActiveShell() because this call may come + // via the ProgramVerifiers and there might not be an active shell. Instead loop + // through all the shells until a valid one is found. + Shell[] shells = Display.getCurrent().getShells(); + Shell shell = null; + for (int i = 0; i < shells.length && shell == null; i++) + { + if (!shells[i].isDisposed() && shells[i].isEnabled() && shells[i].isVisible()) + { + shell = shells[i]; + } + } + if (shell == null) + shell = SystemBasePlugin.getActiveWorkbenchShell(); + + + try + { + connect(shell); + } + catch (Exception e) + { + String excMsg = e.getMessage(); + if ((excMsg == null) || (excMsg.length()==0)) + excMsg = "Exception " + e.getClass().getName(); + SystemMessage sysMsg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_FAILED); + sysMsg.makeSubstitution(getHostName(), excMsg); + return new Status(IStatus.ERROR, SystemPlugin.PLUGIN_ID, IStatus.OK, sysMsg.getLevelOneText(), e); + } + return Status.OK_STATUS; + + } + } + + protected SubSystem(IHost host, IConnectorService connectorService) + { + super(); + _host = host; + _connectorService = connectorService; + _connectorService.registerSubSystem(this); + } + + /** + * Internal method to select the appropriate command subsystem when there are multiple defined for this connection. + * The default implementation is to return the first, but child classes can refine this. Input is always an array of + * length greater than one. + */ + protected ISubSystem selectCommandSubSystem(ISubSystem[] allCmdSubSystems) + { + if (allCmdSubSystems != null && allCmdSubSystems.length > 0) + return allCmdSubSystems[0]; + return null; + } + + /** + * Return the parent subsystem factory that owns this subsystem. + */ + public ISubSystemConfiguration getSubSystemConfiguration() + { + return parentSubSystemFactory; + } + /** + * Return the parent subsystem factory that owns this subsystem. + */ + public void setSubSystemConfiguration(ISubSystemConfiguration ssf) + { + parentSubSystemFactory = ssf; + supportsConnecting = ssf.supportsUserId(); + //System.out.println("subsystem supports connecting? " + supportsConnecting); + } + /** + * Set the parent connection that owns this subsystem. + */ + public void setHost(IHost conn) + { + _host = conn; + previousUserIdKey = getPreferencesKey(); + } + + /** + * Return true if userId and password should be forced to uppercase. + * INTERACTIVEcut to calling same method in parent connection. + */ + public boolean forceUserIdToUpperCase() + { + /* defect 43219 + if (parentSubSystemFactory != null) + return parentSubSystemFactory.forceUserIdToUpperCase(); + else + return true; + */ + IHost currConn = getHost(); + if (currConn != null) + return currConn.getForceUserIdToUpperCase(); + else + return false; + } + + /** + * The profile is being renamed, so we are called to do our thing with + * any information stored that is keyed by the profile name. + *

    + * This is called AFTER the profile is renamed! + */ + public void renamingProfile(String oldName, String newName) + { + String userIdValue = null; + if (previousUserIdKey!=null) + userIdValue = getLocalUserId(previousUserIdKey); + // if the userId attribute held a preference store key of the form profileName.connectionName.subsystemName, + // we have to delete that key entry from the preference store and re-gen a new keyed entry with the same + // value (the actual user id) the old keyed entry held. + String newKey = getPreferencesKey(newName, getHostAliasName()); + if ((userIdValue != null) && (userIdValue.length()>0)) + { + SystemPreferencesManager prefMgr = getPreferencesManager(); + prefMgr.clearUserId(previousUserIdKey); + prefMgr.setUserId(newKey, userIdValue); // store old value with new preference key + } + previousUserIdKey = newKey; + + // now we need to potentially rename any filter pool associated with this connection... + ISystemProfile profile = getSystemProfile(); + ISystemFilterPoolManager mgr = getSubSystemConfiguration().getFilterPoolManager(profile); + ISystemFilterPool[] pools = mgr.getSystemFilterPools(); + boolean done = false; + if (pools != null) + { + for (int idx = 0; !done && (idx < pools.length); idx++) + { + if ( (pools[idx].getOwningParentName()!=null) && // a connection-related pool + (pools[idx].getOwningParentName().equals(getHostAliasName())) ) // this connection! + { + done = true; + try + { + // re-gen name: %1 Filter Pool for connection %2, where %1 is profile name... + mgr.renameSystemFilterPool(pools[idx], getConnectionOwnedFilterPoolName(newName, getHostAliasName())); + } + catch (Exception exc) + { + String msg = "Unexpected error renaming connection-specific filter pool " + getConnectionOwnedFilterPoolName(newName, getHostAliasName()); + SystemBasePlugin.logError(msg, exc); + System.err.println(msg + ": " + exc); + } + } + } + } + } + /** + * The connection is being renamed, so we are called to do our thing with + * any information stored that is keyed by the connection name. + */ + public void renamingConnection(String newName) + { + String userIdValue = null; + if (previousUserIdKey != null) + userIdValue = getLocalUserId(previousUserIdKey); // see if we previous stored a value for this connection + // if the userId attribute held a preference store key of the form profileName.connectionName.subsystemName, + // we have to delete that key entry from the preference store and re-gen a new keyed entry with the same + // value (the actual user id) the old keyed entry held. + String newKey = getPreferencesKey(getSystemProfileName(), newName); + if ((userIdValue != null) && (userIdValue.length()>0)) + { + SystemPreferencesManager prefMgr = getPreferencesManager(); + prefMgr.clearUserId(previousUserIdKey); + prefMgr.setUserId(newKey, userIdValue); // store old value with new preference key + } + previousUserIdKey = newKey; + + // rename the connection-private filter pool, if it exists: + ISystemFilterPool privatePool = getConnectionPrivateFilterPool(false); // false => don't create if not found + if (privatePool != null) + { + ISystemFilterPoolManager mgr = getSubSystemConfiguration().getFilterPoolManager(getSystemProfile()); + privatePool.setOwningParentName(newName); + try { + mgr.renameSystemFilterPool(privatePool, getConnectionOwnedFilterPoolName(getSystemProfileName(), newName)); + } + catch (Exception exc) + { + SystemBasePlugin.logError("Error renaming conection-private pool to: "+newName, exc); + } + } + } + /** + * Private method called when the parent connection is being deleted, so + * the subsystem can do any pre-death cleanup it needs to. + *

    + * What we need to do is delete our entry in the preference store for our userId. + */ + public void deletingConnection() + { + String oldUserId = null; + if (previousUserIdKey != null) + oldUserId = getLocalUserId(previousUserIdKey); + // if the userId attribute held a preference store key of the form profileName.connectionName.subsystemName, + // we have to delete that key entry from the preference store and re-gen a new keyed entry with the same + // value (the actual user id) the old keyed entry held. + if (oldUserId != null) + { + SystemPreferencesManager prefMgr = getPreferencesManager(); + prefMgr.clearUserId(previousUserIdKey); + } + // delete the connection-private filter pool, if it exists: + ISystemFilterPool privatePool = getConnectionPrivateFilterPool(false); // false => don't create if not found + if (privatePool != null) + { + ISystemFilterPoolManager mgr = getSubSystemConfiguration().getFilterPoolManager(getSystemProfile()); + try { + mgr.deleteSystemFilterPool(privatePool); + } + catch (Exception exc) + { + SystemBasePlugin.logError("Error deleting conection-private pool for: "+getHostAliasName(), exc); + } + } + } + + /** + * Returns the value of this subsystem's local user id if it is not null. If it + * is null, it returns the parent connection object's default user Id. It in turn + * queries the preferences if its local value is null. + *

    + * In fact, we now don't store the user Id in the subsystem object itself, but rather store it in the + * user preferences, so that such things are not shared among the team on a synchronize operation. + * This is transparent to callers of this method however, as this method resolves from the preferences. + * + * @see org.eclipse.rse.model.IHost#getDefaultUserId() + * @see #setUserId(String) + * @see #getLocalUserId() + * @see #clearLocalUserId() + * @return The value of the UserId attribute + */ + public String getUserId() + { + String uid = getLocalUserId(); + if ((uid == null) || (uid.length()==0)) + { + IHost conn = getHost(); + uid = conn.getDefaultUserId(); + } + return uid; + } + + /** + * Helper method to return preference manager + */ + protected SystemPreferencesManager getPreferencesManager() + { + return SystemPreferencesManager.getPreferencesManager(); + } + + /** + * Helper method to compute a unique name for a given subsystem instance + */ + protected String getPreferencesKey() + { + if ((_host==null) || (getName()==null)) + return null; + return getPreferencesKey(getSystemProfileName(), getHostAliasName()); + } + /** + * Helper method to compute a unique name for a given subsystem instance, given a profile and connection name + */ + protected String getPreferencesKey(String profileName, String connectionName) + { + String key = profileName + "." + connectionName + "." + getName(); + //System.out.println("in SubSystemImpl.getPreferencesKey(): Subsystem key name: " + key); + return key; + } + + /** + * Internal-use method for getting the local user ID, without resolution. + */ + protected String getLocalUserId(String key) + { + String uid = null; + if ((key!=null) && (key.length()>0)) + { + SystemPreferencesManager prefMgr = getPreferencesManager(); + uid = prefMgr.getUserId(key); // resolve from preferences + } + return uid; + } + + /** + * Alternative to getUserId when we don't want to resolve it from parent connection. + * This is used when showing the properties. + *

    + * Unlike getUserId() this one does not defer to the connection's default user Id if + * the subsystem's userId attribute is null. + *

    + * To set the local user Id, simply call setUserId(String id). To clear it, call + * {@link #clearLocalUserId()}. + *

    + * @see org.eclipse.rse.model.IHost#getDefaultUserId() + * @see #clearLocalUserId() + * @see #getUserId() + * @see #setUserId(String) + */ + public String getLocalUserId() + { + return getLocalUserId(getPreferencesKey()); + } + + /** + * Called to clear the local user Id such that subsequent requests to getUserId() will + * return the parent connection's default user Id. Sets the user Id attribute for this + * subsystem to null. + *

    + * @see org.eclipse.rse.model.IHost#getDefaultUserId() + * @see #getUserId() + * @see #getLocalUserId() + * @see #setUserId(String) + */ + public void clearLocalUserId() + { + if (previousUserIdKey != null) + getPreferencesManager().clearUserId(previousUserIdKey); + IConnectorService system = getConnectorService(); + if (system != null) + system.clearUserIdCache(); + } + + /** + * This is a helper method you can call when performing actions that must be certain there + * is a connection. If there is no connection it will attempt to connect, and if that fails + * will throw a SystemMessageException you can easily display to the user by using a method + * in it. + */ + public void checkIsConnected() throws SystemMessageException + { + if (!isConnected()) + { + try + { + Display display = Display.getCurrent(); + if (display != null) + { + // deduce active shell from display + Shell shell = display.getActiveShell(); + if (shell != null && !shell.isDisposed()) + { + connect(shell); + } + else + { + connect(); + } + } + else + { + // Not on UI-thread + connect(); + } + } + catch (Exception e) + { + if (e instanceof SystemMessageException) + { + throw (SystemMessageException) e; + } + else + if (e instanceof InterruptedException) + { + SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_CANCELLED); + msg.makeSubstitution(getHost().getAliasName()); + throw new SystemMessageException(msg); + } + else + { + SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_FAILED); + throw new SystemMessageException(msg); + } + } + } + } + + /** + * 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. + *

    + * By default this returns Platform.getAdapterManager().getAdapter(this, adapterType); + * This in turn results in the default subsystem adapter SystemViewSubSystemAdapter, + * in package org.eclipse.rse.ui.view. + */ + public Object getAdapter(Class adapterType) + { + return Platform.getAdapterManager().getAdapter(this, adapterType); + } + + /** + * Return the system profile object this subsystem is associated with. + */ + public ISystemProfile getSystemProfile() + { + if (_host != null) + return _host.getSystemProfile(); + else + return null; + } + + /** + * Return the name of system profile object this subsystem is associated with. + */ + public String getSystemProfileName() + { + ISystemProfile profile = getSystemProfile(); + if (profile != null) + return profile.getName(); + else + return null; + } + + /** + * Return the connection object this subsystem is associated with. + */ + public IHost getHost() + { + return _host; + } + + /** + * Return the name of system connection object this subsystem is associated with. + */ + public String getHostAliasName() + { + IHost connection = getHost(); + if (connection != null) + return connection.getAliasName(); + else + return null; + } + + /** + * Return the owning filter pool that is unique to this provider. + * From SystemFilterPoolReferenceManagerProvider interface. We map to + * a call to {@link #getConnectionPrivateFilterPool(boolean)}. + */ + public ISystemFilterPool getUniqueOwningSystemFilterPool(boolean createIfNotFound) + { + return getConnectionPrivateFilterPool(createIfNotFound); + } + /** + * Find or create a new filter pool, unique to this subsystem's connection. This will be + * in the same profile as the connection, and it will follow a naming convention that ties + * it to the connection: Filter Pool for xxx, where xxx is the connection name. + * @param createIfNotFound - true to create the pool if it doesn't exist + */ + public ISystemFilterPool getConnectionPrivateFilterPool(boolean createIfNotFound) + { + ISystemFilterPool pool = null; + ISystemFilterPool[] allPoolsInProfile = getSubSystemConfiguration().getFilterPoolManager(getSystemProfile()).getSystemFilterPools(); + if (allPoolsInProfile!=null) + { + for (int idx=0; idxis deletable by user + pool.setNonRenamable(true); // don't allow users to rename this pool + //pool.setNonDeletable(true); hmm, should we or not? + pool.setOwningParentName(getHostAliasName()); + // now it is time to reference this pool in this subsystem + if (getSystemFilterPoolReferenceManager().getReferenceToSystemFilterPool(pool) == null) + { + getSystemFilterPoolReferenceManager().addReferenceToSystemFilterPool(pool); + } + } catch (Exception exc) + { + SystemBasePlugin.logError("Error creating connection-private filter pool for connection: "+getHostAliasName(),exc); + } + } + return pool; + } + /** + * Return the name for the connection-owned filter pool. + */ + public String getConnectionOwnedFilterPoolName(String profileName, String connectionName) + { + // Similar to SubSystemFactoryImpl#getDefaultFilterPoolName(String)... + //System.out.println("ProfileName: " + profileName); + //System.out.println("ConnectionName: " + connectionName); + + // RESID_PERCONNECTION_FILTERPOOL = com.ibm.etools.systems.ui.perConnection.filterpool=Filter Pool for connection %1 + String name = SystemResources.RESID_PERCONNECTION_FILTERPOOL; + + StringBuffer profileNameBuffer = new StringBuffer(profileName.toLowerCase()); + profileNameBuffer.setCharAt(0, Character.toUpperCase(profileNameBuffer.charAt(0))); + + name = SystemMessage.sub(name, "%1", profileNameBuffer.toString()); + name = SystemMessage.sub(name, "%2", connectionName); + return name; + } + + // ------------------------- + // Filter Testing Methods... + // ------------------------- + /** + * Override this method if you support typed filters. Given an absolute remote object name, + * you can test if this filter's type matches that of the remote object. This is called as + * a pre-test in the following methods. + */ + protected boolean doesFilterTypeMatch(ISystemFilter filter, String remoteObjectAbsoluteName) + { + return true; + } + + /** + * Return true if the given filter lists the contents of the given remote object. + * For example, if given a folder, return true if any of the filter strings in this filter + * lists the contents of that folder. Used in impact analysis when a remote object is + * created, deleted, renamed, copied or moved, so as to establish which filters need to be + * refreshed or collapsed (if the folder is deleted, say). + *

    + * Subclasses do not need to override this method. Rather, this method walks each + * filter string and calls doesFilterStringListContentsOf(...), and that is the method + * that child classes must override. + */ + public boolean doesFilterListContentsOf(ISystemFilter filter, String remoteObjectAbsoluteName) + { + if (filter.isPromptable()) // || !doesFilterTypeMatch(filter, remoteObjectAbsoluteName)) + return false; + boolean would = false; + ISystemFilterString[] strings = filter.getSystemFilterStrings(); + if (strings != null) + for (int idx=0; !would && (idx + * This should only return true if the filter string directly lists the contents of the given + * object, versus indirectly. + *

    + * Subclasses should override this. + */ + public boolean doesFilterStringListContentsOf(ISystemFilterString filterString, String remoteObjectAbsoluteName) + { + return false; + } + + /** + * Return true if the given remote object name will pass the filtering criteria for any of + * the filter strings in this filter. + *

    + * Subclasses do not need to override this method. Rather, this method walks each + * filter string and calls doesFilterStringMatch(...), and that is the method + * that child classes must override. + */ + public boolean doesFilterMatch(ISystemFilter filter, String remoteObjectAbsoluteName) + { + if (filter.isPromptable() || !doesFilterTypeMatch(filter, remoteObjectAbsoluteName)) + return false; + boolean would = false; + ISystemFilterString[] strings = filter.getSystemFilterStrings(); + if (strings != null) + { + for (int idx=0; !would && (idx + * Subclasses need to override this. + * If in doubt, return true. + */ + public boolean doesFilterStringMatch(String filterString, String remoteObjectAbsoluteName, boolean caseSensitive) + { + return true; + } + + // ------------------------------------- + // GUI methods + // ------------------------------------- + /** + * Return the single property page to show in the tabbed notebook for the + * for SubSystem property of the parent Connection. Return null if no + * page is to be contributed for this. You are limited to a single page, + * so you may have to compress. It is recommended you prompt for the port + * if applicable since the common base subsystem property page is not shown + * To help with this you can use the SystemPortPrompt widget. + */ + public PropertyPage getPropertyPage(Composite parent) + { + return null; + } + + // -------------------------------------------------------------------------------------- + // Methods for encoding and decoding remote objects for drag and drop, and clipboard copy + // -------------------------------------------------------------------------------------- + + + /** + * For drag and drop, and clipboard, support of remote objects. + *

    + * Return the object within the subsystem that corresponds to + * the specified unique ID. Because each subsystem maintains it's own + * objects, it's the responsability of the subsystem to determine + * how an ID (or key) for a given object maps to the real object. + * By default this returns null. + *

    + * This is the functional opposite of {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getAbsoluteName(Object)}. + */ + public Object getObjectWithAbsoluteName(String key) throws Exception + { + // by default, the subsystem will attempt to find a filter reference for the key + Object filterRef = getFilterReferenceWithAbsoluteName(key); + if (filterRef != null) + { + return filterRef; + } + return null; + } + + /** + * Return the filter reference that corresponds to the specified key. If there + * is no such filter reference, return null; + * @param key the absolute name for an object. + * @return a filter reference if there is one matching the key + */ + protected Object getFilterReferenceWithAbsoluteName(String key) + { + // figure out if there is a filter + String filterID = key; + try + { + ISystemFilterPoolReferenceManager filterMgr = getFilterPoolReferenceManager(); + ISystemRegistry registry = SystemPlugin.getTheSystemRegistry(); + ISubSystemConfiguration factory = registry.getSubSystemConfiguration(this); + + int indexOfDot = filterID.indexOf('.'); + if (indexOfDot > 0) + { + String mgrName = filterID.substring(0, indexOfDot); + + ISystemFilterPoolManager mgr = factory.getSystemFilterPoolManager(mgrName); + + int indexOfDot2 = filterID.indexOf('.', indexOfDot + 1); + if (mgr != null && indexOfDot2 > 0) + { + String filterPoolName = filterID.substring(indexOfDot + 1, indexOfDot2); + + ISystemFilterPool filterPool = mgr.getSystemFilterPool(filterPoolName); + + String filterName = filterID.substring(indexOfDot2 + 1, filterID.length()); + if (filterPool != null) + { + ISystemFilter filter = filterPool.getSystemFilter(filterName); + ISystemFilterReference ref = filterMgr.getSystemFilterReference(this, filter); + if (ref != null) + { + // if we get here, it's a filter + return ref; + } + } + } + } + } + catch (Exception e) + { + } + return null; + } + + + // --------------------------------------------------- + // Methods for business partners to add their own + // persisted attributes to the subsystem object... + // --------------------------------------------------- + + /** + * @deprecated use property sets directly now + */ + public void setVendorAttribute(String vendor, String attributeName, String attributeValue) + { + IPropertySet set = getPropertySet(vendor); + if (set == null) + { + set = createPropertySet(vendor, ""); + } + set.addProperty(attributeName, attributeValue); + } + /** + * @deprecated use property sets directly now + */ + public String getVendorAttribute(String vendor, String attributeName) + { + IPropertySet set = getPropertySet(vendor); + if (set != null) + { + return set.getPropertyValue(attributeName); + } + else + { + return null; + } + } + + + // --------------------------------------------------- + // Methods for IBM partners to add their own + // persisted attributes to the subsystem object... + // --------------------------------------------------- + + /** + * @deprecated + */ + public void setIBMAttribute(String attributeName, String attributeValue) + { + IPropertySet set = getPropertySet("IBM"); + if (set == null) + { + set = createPropertySet("IBM", getDescription()); + } + set.addProperty(attributeName, attributeValue); + } + /** + * @deprecated + */ + public String getIBMAttribute(String attributeName) + { + IPropertySet set = getPropertySet("IBM"); + if (set != null) + { + return set.getPropertyValue(attributeName); + } + else + { + return null; + } + } + + + + + + // ------------------ + // Utility methods... + // ------------------ + + /** + * Return the system type for this connection. + */ + public String getSystemType() + { + IHost conn = getHost(); + if (conn == null) + return null; + else + return conn.getSystemType(); + } + /** + * Return the host name for the connection this system's subsystem is associated with + */ + public String getHostName() + { + IHost conn = getHost(); + if (conn == null) + return null; + else + return conn.getHostName(); + } + + /** + * Display message on message thread + */ + protected void displayAsyncMsg(org.eclipse.rse.services.clientserver.messages.SystemMessageException msg) + { + DisplayErrorMessageJob job = new DisplayErrorMessageJob(getShell(), msg); + job.setPriority(Job.INTERACTIVE); + job.setSystem(true); + job.schedule(); + } + /** + * Inner class which extends WorkbenchJob to allow us to show an error message, which is a GUI operation, + * from a non-GUI thread. This is done by creating an instance of this class and then scheduling it. + */ + protected class DisplayErrorMessageJob extends WorkbenchJob + { + private Shell shell; + private org.eclipse.rse.services.clientserver.messages.SystemMessageException msgExc; + + /** + * Constructor + */ + public DisplayErrorMessageJob(Shell shell, org.eclipse.rse.services.clientserver.messages.SystemMessageException msgExc) + { + super(""); + this.shell = shell; //FIXME remove this + this.msgExc = msgExc; + } + + /** + * @see UIJob#run(IProgressMonitor monitor) + */ + public IStatus runInUIThread(IProgressMonitor monitor) + { + if ((shell != null) && (shell.isDisposed() || !shell.isEnabled() || !shell.isVisible())) + shell = null; + if (shell == null) + { + Shell[] shells = Display.getCurrent().getShells(); + for (int i = 0; i < shells.length && shell == null; i++) + if (!shells[i].isDisposed() && shells[i].isVisible() && shells[i].isEnabled()) + shell = shells[i]; + } + if (shell != null) + SystemMessageDialog.displayMessage(shell, msgExc); + return Status.OK_STATUS; + } + } + + // --------------------------------------------------- + // SystemFilterPoolReferenceManagerProvider methods... + // --------------------------------------------------- + /** + * Return the system filter pool reference manager, as per the + * interface SystemFilterPoolReferenceManagerProvider + */ + public ISystemFilterPoolReferenceManager getSystemFilterPoolReferenceManager() + { + return getFilterPoolReferenceManager(); + } + /* + * Helper method to fire an event... + */ + protected void fireEvent(SystemResourceChangeEvent event) + { + SystemPlugin.getTheSystemRegistry().fireEvent(event); + } + /* + * Helper method to fire a reference event... + */ + protected void fireEvent(SystemResourceChangeEvent event, Object grandParent) + { + event.setGrandParent(grandParent); + SystemPlugin.getTheSystemRegistry().fireEvent(event); + } + /* + * Helper method to create and then fire an event... + */ + protected void fireEvent(Object src, int eventId, Object parent) + { + fireEvent(new SystemResourceChangeEvent(src, eventId, parent)); + } + /* + * Helper method to create and then fire an event... + */ + protected void fireEvent(Object[] multiSrc, int eventId, Object parent) + { + fireEvent(new SystemResourceChangeEvent(multiSrc, eventId, parent)); + } + /* + * Helper method to create and then fire an event... + */ + protected void fireEvent(Object[] src, int eventId, Object parent, int position) + { + SystemResourceChangeEvent event = new SystemResourceChangeEvent(src, eventId, parent); + event.setPosition(position); + fireEvent(event); + } + + /* + * Helper method to create and then fire a reference event... + */ + protected void fireEvent(Object src, int eventId, Object parent, Object grandParent) + { + fireEvent(new SystemResourceChangeEvent(src, eventId, parent), grandParent); + } + // ------------------------------- + // FILTER POOL REFERENCE EVENTS... + // ------------------------------- + /** + * A new filter pool reference has been created + */ + public void filterEventFilterPoolReferenceCreated(ISystemFilterPoolReference newPoolRef) + { + if (getSubSystemConfiguration().showFilterPools()) + { + fireEvent(newPoolRef, EVENT_ADD, this); + fireEvent(newPoolRef, EVENT_REVEAL_AND_SELECT, this); + } + else if (newPoolRef.getReferencedFilterPool().getSystemFilterCount()>0) + { + ISystemFilterReference[] filterRefs = newPoolRef.getSystemFilterReferences(this); + fireEvent(filterRefs, EVENT_ADD_MANY, this, -1); // -1 means append to end + } + try { + //System.out.println(" calling saveSubSystem(this)..."); + getSubSystemConfiguration().saveSubSystem(this); + //System.out.println(" Back and done!"); + + // fire model change event in case any BP code is listening... + SystemPlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_ADDED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_FILTERPOOLREF, newPoolRef, null); + } + catch (Exception exc) + { + SystemBasePlugin.logError("Error saving subsystem "+getName(),exc); + } + } + /** + * A filter pool reference has been deleted + */ + public void filterEventFilterPoolReferenceDeleted(ISystemFilterPoolReference filterPoolRef) + { + if (getSubSystemConfiguration().showFilterPools()) + { + fireEvent(filterPoolRef, EVENT_DELETE, this); + } + else if (filterPoolRef.getReferencedFilterPool().getSystemFilterCount()>0) + { + ISystemFilterReference[] filterRefs = filterPoolRef.getSystemFilterReferences(this); + fireEvent(filterRefs, EVENT_DELETE_MANY, this); + } + + try { + getSubSystemConfiguration().saveSubSystem(this); + // fire model change event in case any BP code is listening... + SystemPlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_REMOVED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_FILTERPOOLREF, filterPoolRef, null); + } + catch (Exception exc) + { + SystemBasePlugin.logError("Error saving subsystem "+getName(),exc); + } + } + /** + * A single filter pool reference has been reset to reference a new pool + */ + public void filterEventFilterPoolReferenceReset(ISystemFilterPoolReference filterPoolRef) + { + fireEvent(filterPoolRef, EVENT_PROPERTYSHEET_UPDATE, this); // we assume its a move operation so little impact + try { + getSubSystemConfiguration().saveSubSystem(this); + // fire model change event in case any BP code is listening... + SystemPlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_CHANGED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_FILTERPOOLREF, filterPoolRef, null); + } + catch (Exception exc) + { + SystemBasePlugin.logError("Error saving subsystem "+getName(),exc); + } + } + /** + * All filter pool references has been reset. Happens after SelectFilterPools dialog + */ + public void filterEventFilterPoolReferencesReset() + { + fireEvent(this, EVENT_CHANGE_CHILDREN, this); + try + { + getSubSystemConfiguration().saveSubSystem(this); + ISystemFilterPoolReference[] poolRefs = getFilterPoolReferenceManager().getSystemFilterPoolReferences(); + for (int idx=0; idx + * Only the selected node should be expanded if not already. All other references to this pool will already + * have been informed of the new addition, and will have refreshed their children but not expanded them. + */ + public void filterEventFilterCreated(Object selectedObject, ISystemFilter newFilter) + { + fireEvent(newFilter,EVENT_REVEAL_AND_SELECT,selectedObject); + } + // --------------------------------- + // FILTER STRING REFERENCE EVENTS... + // --------------------------------- + /** + * A new filter string has been created. This is called when a filter reference is selected and a new filter + * string is created, so that the provider can expand the selected filter reference and reveal the new filter + * string within the selected filter reference. + *

    + * Only the selected node should be expanded if not already. All other references to this filter will already + * have been informed of the new addition, and will have refreshed their children but not expanded them. + */ + public void filterEventFilterStringCreated(Object selectedObject, ISystemFilterString newFilterString) + { + fireEvent(newFilterString,EVENT_REVEAL_AND_SELECT,selectedObject); + } + + /** + * Represents an operation that can be performed by the subsystem. Since this class + * extends Job, it is run on a separate thread, but reports progress to the Main thread. + * Takes care of some common error handling and Status creation for SubSystem Operations. + * @author mjberger + */ + protected abstract class SubSystemOperationJob extends Job + { + protected Object[] runOutputs; + protected String[] runOutputStrings; + protected boolean _hasStarted = false; + + public class ContextRunnable implements IRunnableWithProgress + { + private SubSystemOperationJob _job; + private IStatus _status; + + public ContextRunnable(SubSystemOperationJob job) + { + _job = job; + } + + public void run(IProgressMonitor monitor) + { + _status = _job.run(monitor); + } + + public IStatus getStatus() + { + return _status; + } + } + + public SubSystemOperationJob(String operationName) + { + super(operationName + " (" + GenericMessages.RSESubSystemOperation_message + ")"); + } + + /** + * Override this method with the actual operation performed by your subsystem operation. Make sure to + * report progress to the Progress monitor. + * @throws InterruptedException if the user presses cancel + * @throws InvocationTargetException if there is some error performing the operation + * @throws Exception if there is some other error + */ + public abstract void performOperation(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException, Exception; + + /** + * SubSystemOperationJobs are designed to be run synchronously - if you require output from them. Clients can query any output + * using getOutputs() or getOutputStrings(). + */ + public Object[] getOutputs() + { + return runOutputs; + } + + /** + * SubSystemOperationJobs are designed to be run synchronously - if you require output from them. Clients can query any output + * using getOutputs() or getOutputStrings(). + */ + public String[] getOutputStrings() + { + return runOutputStrings; + } + + public IStatus runInContext(IRunnableContext context) + { + _hasStarted = true; + ContextRunnable conRun = new ContextRunnable(this); + try + { + context.run(false, true, conRun); + return conRun.getStatus(); + } + catch (Exception e) + { + String excMsg = e.getMessage(); + if ((excMsg == null) || (excMsg.length()==0)) + excMsg = "Exception " + e.getClass().getName(); + SystemMessage sysMsg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_FAILED); + sysMsg.makeSubstitution(excMsg); + return new Status(IStatus.ERROR, SystemPlugin.PLUGIN_ID, IStatus.OK, sysMsg.getLevelOneText(), e); + } + } + + public boolean hasStarted() + { + return _hasStarted; + } + + public IStatus run(IProgressMonitor monitor) + { + _hasStarted = true; + try + { + performOperation(monitor); + + if (monitor.isCanceled()) // sometimes our kids don't do this like they should! + { + return Status.CANCEL_STATUS; + } + monitor.done(); + return Status.OK_STATUS; + } + catch(java.lang.InterruptedException exc) + { + monitor.done(); + return Status.CANCEL_STATUS; + } + catch(InvocationTargetException exc) + { + monitor.done(); + String excMsg = exc.getTargetException().getMessage(); + if ((excMsg == null) || (excMsg.length()==0)) + excMsg = "Exception " + exc.getTargetException().getClass().getName(); + return new Status(IStatus.ERROR, SystemPlugin.PLUGIN_ID, IStatus.OK, excMsg, exc.getTargetException()); + } + catch(Exception exc) + { + monitor.done(); + String excMsg = exc.getMessage(); + if ((excMsg == null) || (excMsg.length()==0)) + excMsg = "Exception " + exc.getClass().getName(); + SystemMessage sysMsg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_FAILED); + sysMsg.makeSubstitution(excMsg); + return new Status(IStatus.ERROR, SystemPlugin.PLUGIN_ID, IStatus.OK, sysMsg.getLevelOneText(), exc); + } + } + } + + /** + * Represents the subsystem operation of resolving absolute filter strings. + */ + protected class ResolveAbsoluteJob extends SubSystemOperationJob + { + protected String _filterString; + + /** + * Create a new ResolveAbsoluteJob + * @param filterString the absolute filter string to resolve + */ + public ResolveAbsoluteJob(String filterString) + { + super(GenericMessages.RSESubSystemOperation_Resolve_filter_strings_message); + _filterString = filterString; + } + + public void performOperation(IProgressMonitor mon) throws InterruptedException, InvocationTargetException, Exception + { + String msg = null; + int totalWorkUnits = IProgressMonitor.UNKNOWN; + + msg = getResolvingMessage(_filterString); + + if (!implicitConnect(false, mon, msg, totalWorkUnits)) throw new Exception(SystemPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_FAILED).makeSubstitution(getHostName()).getLevelOneText()); + runOutputs = internalResolveFilterString(mon, _filterString); + } + } + + /** + * Represents the subsystem operation of resolving a set of absolute filter strings. + */ + protected class ResolveAbsolutesJob extends SubSystemOperationJob + { + protected String _filterString; + protected String[] _filterStrings; + + /** + * Create a new ResolveAbsolutesJob + * @param filterStrings the set of absolute filter strings to resolve + */ + public ResolveAbsolutesJob(String filterString, String[] filterStrings) + { + super(GenericMessages.RSESubSystemOperation_Resolve_filter_strings_message); + _filterString = filterString; + _filterStrings = filterStrings; + } + + public void performOperation(IProgressMonitor mon) throws InterruptedException, InvocationTargetException, Exception + { + String msg = null; + int totalWorkUnits = IProgressMonitor.UNKNOWN; + + msg = getResolvingMessage(_filterString); + + if (!implicitConnect(false, mon, msg, totalWorkUnits)) throw new Exception(SystemPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_FAILED).makeSubstitution(getHostName()).getLevelOneText()); + runOutputs = internalResolveFilterStrings(mon, _filterStrings); + } + } + + /** + * Represents the subsystem operation of resolving relative filter strings. + */ + protected class ResolveRelativeJob extends SubSystemOperationJob + { + protected String _filterString; + protected Object _parent; + + /** + * Create a new ResolveRelativeJob + * @param filterString the relative filter string to resolve + * @param parent the object within which the relative filter string will be resolved + */ + public ResolveRelativeJob(String filterString, Object parent) + { + super(GenericMessages.RSESubSystemOperation_Resolve_filter_strings_message); + _filterString = filterString; + _parent = parent; + } + + public void performOperation(IProgressMonitor mon) throws InterruptedException, InvocationTargetException, Exception + { + String msg = null; + int totalWorkUnits = IProgressMonitor.UNKNOWN; + + if (_filterString == null) + { + // DKM - we shouldn't be using parent context for filter strings because + // now we have multiple contexts for the same resources + _filterString = "*"; + } + msg = getResolvingMessage(_filterString); + + if (!implicitConnect(false, mon, msg, totalWorkUnits)) throw new Exception(SystemPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_FAILED).makeSubstitution(getHostName()).getLevelOneText()); + runOutputs = internalResolveFilterString(mon, _parent, _filterString); + } + } + + /** + * Represents the subsystem operation of getting a property value from a remote object. + */ + protected class GetPropertyJob extends SubSystemOperationJob + { + protected Object _subject; + protected String _key; + + /** + * Constructs a new GetPropertyJob + * @param subject The object whose property will be queried + * @param key The property to query + */ + public GetPropertyJob(Object subject, String key) + { + super(GenericMessages.RSESubSystemOperation_Get_property_message); + _subject = subject; + _key = key; + } + + public void performOperation(IProgressMonitor mon) throws InterruptedException, InvocationTargetException, Exception + { + String msg = null; + int totalWorkUnits = IProgressMonitor.UNKNOWN; + + msg = getQueryingMessage(_key); + + if (!implicitConnect(false, mon, msg, totalWorkUnits)) throw new Exception(SystemPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_FAILED).makeSubstitution(getHostName()).getLevelOneText()); + runOutputStrings = new String[] {internalGetProperty(mon, _subject, _key)}; + } + } + + /** + * Represents the subsystem operation of setting a property of a remote object. + */ + protected class SetPropertyJob extends SubSystemOperationJob + { + protected Object _subject; + protected String _key; + protected String _value; + + /** + * Constructs a new SetPropertyJob + * @param subject the object whose property is to be set + * @param key the property to set + * @param value the new value for the property + */ + public SetPropertyJob(Object subject, String key, String value) + { + super(GenericMessages.RSESubSystemOperation_Set_property_message); + _subject = subject; + _key = key; + _value = value; + } + + public void performOperation(IProgressMonitor mon) throws InterruptedException, InvocationTargetException, Exception + { + String msg = null; + int totalWorkUnits = IProgressMonitor.UNKNOWN; + msg = getSettingMessage(_key); + + if (!implicitConnect(false, mon, msg, totalWorkUnits)) throw new Exception(SystemPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_FAILED).makeSubstitution(getHostName()).getLevelOneText()); + runOutputs = new Object[] {internalSetProperty(mon, _subject, _key, _value)}; + } + } + + /** + * Represents the subsystem operation of getting a set of property values from a remote object. + */ + protected class GetPropertiesJob extends SubSystemOperationJob + { + protected Object _subject; + protected String[] _keys; + + /** + * Constructs a new GetPropertiesJob + * @param subject the object on which to perform the property query + * @param keys the properties to query + */ + public GetPropertiesJob(Object subject, String[] keys) + { + super(GenericMessages.RSESubSystemOperation_Get_properties_message); + _subject = subject; + _keys = keys; + } + + public void performOperation(IProgressMonitor mon) throws InterruptedException, InvocationTargetException, Exception + { + String msg = null; + int totalWorkUnits = IProgressMonitor.UNKNOWN; + msg = getQueryingMessage(); + + if (!implicitConnect(false, mon, msg, totalWorkUnits)) throw new Exception(SystemPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_FAILED).makeSubstitution(getHostName()).getLevelOneText()); + runOutputStrings = internalGetProperties(mon, _subject, _keys); + } + } + + /** + * Represents the subsystem operation of setting a set of properties of a remote object. + */ + protected class SetPropertiesJob extends SubSystemOperationJob + { + protected Object _subject; + protected String[] _keys; + protected String[] _values; + + /** + * Constructs a new SetPropertiesJob + * @param subject the object whose properties are to be set + * @param keys the set of properties to set + * @param values the set of new values for the properties, corresponding with keys + */ + public SetPropertiesJob(Object subject, String[] keys, String[] values) + { + super(GenericMessages.RSESubSystemOperation_Set_properties_message); + _subject = subject; + _keys = keys; + _values = values; + } + + public void performOperation(IProgressMonitor mon) throws InterruptedException, InvocationTargetException, Exception + { + String msg = null; + int totalWorkUnits = IProgressMonitor.UNKNOWN; + + msg = getSettingMessage(); + + if (!implicitConnect(false, mon, msg, totalWorkUnits)) throw new Exception(SystemPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_FAILED).makeSubstitution(getHostName()).getLevelOneText()); + runOutputs = new Object[] {internalSetProperties(mon, _subject, _keys, _values)}; + } + } + + /** + * Represents the subsystem operation of connecting the subsystem to the remote machine. + */ + protected class ConnectJob extends SubSystemOperationJob + { + public ConnectJob() + { + super(GenericMessages.RSESubSystemOperation_Connect_message); + } + + public void performOperation(IProgressMonitor mon) throws InterruptedException, Exception + { + String msg = null; + int totalWorkUnits = IProgressMonitor.UNKNOWN; + + msg = SubSystemConfiguration.getConnectingMessage(getHostName(), getConnectorService().getPort()); + SystemBasePlugin.logInfo(msg); + + if (!implicitConnect(true, mon, msg, totalWorkUnits)) throw new Exception(SystemPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_FAILED).makeSubstitution(getHostName()).getLevelOneText()); + internalConnect(mon); + } + } + + /** + * Represents the subsystem operation of disconnecting the subsystem to the remote machine. + */ + protected class DisconnectJob extends SubSystemOperationJob + { + public DisconnectJob() + { + super(GenericMessages.RSESubSystemOperation_Disconnect_message); + } + + public void performOperation(IProgressMonitor mon) throws InterruptedException, Exception + { + String msg = null; + int totalWorkUnits = IProgressMonitor.UNKNOWN; + + msg = SubSystemConfiguration.getDisconnectingMessage(getHostName(), getConnectorService().getPort()); + + if (!implicitConnect(false, mon, msg, totalWorkUnits)) throw new Exception(SystemPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_FAILED).makeSubstitution(getHostName()).getLevelOneText()); + internalDisconnect(mon); + } + } + + /** + * Represents the operation of changing the connection status of this subsystem. + */ + protected class ChangeStatusJob extends UIJob + { + private final ISubSystem _subsystem; + + public ChangeStatusJob(ISubSystem ss) + { + super(GenericMessages.RSESubSystemOperation_Notifying_registry_message); + _subsystem = ss; + } + + public IStatus runInUIThread(IProgressMonitor monitor) + { + final ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry(); + sr.connectedStatusChange(_subsystem, true, false); + return Status.OK_STATUS; + } + } + + protected boolean implicitConnect(boolean isConnectOperation, IProgressMonitor mon, String msg, int totalWorkUnits) throws SystemMessageException, InvocationTargetException, InterruptedException + { + boolean didConnection = false; + if (doConnection && !isConnected())// caller wants to do connection first as part operation + { + if (isOffline() || (supportsCaching() && getCacheManager().isRestoreFromMemento())) + { + if (!supportsCaching()) + { + // offline and no caching support so throw exception + SystemMessage sMsg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_OFFLINE_CANT_CONNECT); + sMsg.makeSubstitution(getHost().getAliasName()); + throw new SystemMessageException(sMsg); + } + + // we are not either offline or we support caching and are restoring from memento so + // postpone connecting until we determine the information cannot be retrieved from the cache, + // it is left to individual api calls to determine this + doConnection = false; + } + else + { + doConnection = false; // reset + didConnection = true; + mon.beginTask(SubSystemConfiguration.getConnectingMessage(getHostName(), getConnectorService().getPort()), totalWorkUnits); + internalConnect(mon); + mon.worked(1); + + ChangeStatusJob job = new ChangeStatusJob(this); + job.setSystem(true); + job.setPriority(Job.INTERACTIVE); + job.schedule(); + } + } + else + { + doConnection = false; + } + + if (isConnected() || isConnectOperation || isOffline() || (supportsCaching() && getCacheManager().isRestoreFromMemento())) + { + if (!didConnection) + mon.beginTask(msg, (totalWorkUnits==1) ? IProgressMonitor.UNKNOWN : totalWorkUnits); + else + mon.setTaskName(msg); + return true; + } + else // the implicit connect must have failed + { + mon.done(); + return false; + } + } + + 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 connection fails. + * Shows a common message by default. + * Overridable. + */ + protected void showConnectErrorMessage(Shell shell, String hostName, int port, Throwable exc) + { + SystemMessage msg = null; + if (exc instanceof SystemMessageException) + { + SystemBasePlugin.logError("Connection error", exc); + msg = ((SystemMessageException) exc).getSystemMessage(); + } + else if (exc instanceof java.net.UnknownHostException) + { + SystemBasePlugin.logError("Connection error", exc); + msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_UNKNOWNHOST); + msg.makeSubstitution(hostName); + } + else + { + SystemBasePlugin.logError("Connection error", exc); + msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_FAILED); + msg.makeSubstitution(hostName, exc); + } + + SystemMessageDialog msgDlg = new SystemMessageDialog(shell, msg); + msgDlg.setException(exc); + msgDlg.open(); + } + /** + * Show an error message when the user cancels the connection. + * Shows a common message by default. + * Overridable. + */ + protected void showConnectCancelledMessage(Shell shell, String hostName, int port) + { + //SystemMessage.displayMessage(SystemMessage.MSGTYPE_ERROR, shell, SystemPlugin.getResourceBundle(), + // ISystemMessages.MSG_CONNECT_CANCELLED, hostName); + SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_CANCELLED); + msg.makeSubstitution(hostName); + SystemMessageDialog msgDlg = new SystemMessageDialog(shell, msg); + msgDlg.open(); + } + /** + * Show an error message when the disconnection fails. + * Shows a common message by default. + * Overridable. + */ + protected void showDisconnectErrorMessage(Shell shell, String hostName, int port, Exception exc) + { + //SystemMessage.displayMessage(SystemMessage.MSGTYPE_ERROR,shell,SystemPlugin.getResourceBundle(), + // ISystemMessages.MSG_DISCONNECT_FAILED, + // hostName, exc.getMessage()); + //SystemPlugin.logError("Disconnect failed",exc); // temporary + SystemMessageDialog msgDlg = new SystemMessageDialog(shell, + SystemPlugin.getPluginMessage(ISystemMessages.MSG_DISCONNECT_FAILED).makeSubstitution(hostName,exc)); + msgDlg.setException(exc); + msgDlg.open(); + } + /** + * Show an error message when the user cancels the disconnection. + * Shows a common message by default. + * Overridable. + */ + protected void showDisconnectCancelledMessage(Shell shell, String hostName, int port) + { + //SystemMessage.displayMessage(SystemMessage.MSGTYPE_ERROR, shell, SystemPlugin.getResourceBundle(), + // ISystemMessages.MSG_DISCONNECT_CANCELLED, hostName); + SystemMessageDialog msgDlg = new SystemMessageDialog(shell, + SystemPlugin.getPluginMessage(ISystemMessages.MSG_DISCONNECT_CANCELLED).makeSubstitution(hostName)); + msgDlg.open(); + } + + + /** + * Helper method to return the message "Resolving to &1..." + */ + protected static String getResolvingMessage(String filterString) + { + String msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_RESOLVE_PROGRESS).makeSubstitution(filterString).getLevelOneText(); + return msg; + } + /** + * Helper method to return the message "Running command &1..." + */ + protected static String getRunningMessage(String cmd) + { + return SystemPlugin.getPluginMessage(ISystemMessages.MSG_RUN_PROGRESS).makeSubstitution(cmd).getLevelOneText(); + } + /** + * Helper method to return the message "Querying &1..." + */ + protected static String getQueryingMessage(String key) + { + return SystemPlugin.getPluginMessage(ISystemMessages.MSG_QUERY_PROGRESS).makeSubstitution(key).getLevelOneText(); + } + /** + * Helper method to return the message "Setting &1..." + */ + protected static String getSettingMessage(String key) + { + return SystemPlugin.getPluginMessage(ISystemMessages.MSG_SET_PROGRESS).makeSubstitution(key).getLevelOneText(); + } + /** + * Helper method to return the message "Querying properties..." + */ + protected static String getQueryingMessage() + { + return SystemPlugin.getPluginMessage(ISystemMessages.MSG_QUERY_PROPERTIES_PROGRESS).getLevelOneText(); + } + /** + * Helper method to return the message "Setting properties..." + */ + protected static String getSettingMessage() + { + return SystemPlugin.getPluginMessage(ISystemMessages.MSG_SET_PROPERTIES_PROGRESS).getLevelOneText(); + } + + /** + * Show an error message when the operation fails. + * Shows a common message by default, unless the exception is of type SystemMessageException, + * in which case the message is retrieved via getSystemMessage() and it is shown. + * Overridable. + */ + protected void showOperationErrorMessage(Shell shell, Throwable exc) + { + SystemMessage sysMsg = null; + if (exc instanceof SystemMessageException) + { + displayAsyncMsg((SystemMessageException)exc); + //sysMsg = ((SystemMessageException)exc).getSystemMessage(); + } + else + { + String excMsg = exc.getMessage(); + if ((excMsg == null) || (excMsg.length()==0)) + excMsg = "Exception " + exc.getClass().getName(); + sysMsg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_FAILED); + sysMsg.makeSubstitution(excMsg); + + + SystemMessageDialog msgDlg = new SystemMessageDialog(shell, sysMsg); + msgDlg.setException(exc); + msgDlg.open(); + //SystemPlugin.logError("Operation failed",exc); now done successfully in msgDlg.open() + } + + } + /** + * 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, SystemPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_CANCELLED)); + msgDlg.open(); + } + + + // ---------------------------------- + // PUBLIC METHODS HANDLED FOR YOU.... + // ---------------------------------- + /** + * Return true if this subsystem is currently connected to its remote system. + * If the subsystem configuration indicates its subsystems support connecting, then + * this method will call getSystem().isConnect(). + */ + public boolean isConnected() + { + IConnectorService system = getConnectorService(); + if (system != null) + return system.isConnected(); + else if (!supportsConnecting) + return true; + else + return false; + } + + /** + * Returns the offline property for this subsystem's System Connection. + */ + public boolean isOffline() + { + return getHost().isOffline(); + } + /** + * CHILD CLASSES MAY OVERRIDE THIS. + * By default it returns true iff we support filters and there are filter pool references. + */ + public boolean hasChildren() + { + if (getSubSystemConfiguration().supportsFilters()) + { + ISystemFilterPoolReferenceManager mgr = getSystemFilterPoolReferenceManager(); + if (mgr == null) + return false; + else + return mgr.getSystemFilterPoolReferenceCount() > 0; + } + else + return false; + } + /** + * Return the children of this subsystem, to populate the GUI subtree of this subsystem. + * By default, this method: + *

      + *
    • Returns the filter pool references of this subsystem, if supportsFilters() is true for our factory. + *
    • If supportsFilters() is false from our factory, returns null + *
    + * So, be sure to override this method IF you do not support filters. + */ + public Object[] getChildren() + { + if (getSubSystemConfiguration().supportsFilters()) + { + ISystemFilterPoolReferenceManager mgr = getSystemFilterPoolReferenceManager(); + if (mgr == null) + return null; + else + { + boolean showFilterPools = getSubSystemConfiguration().showFilterPools(); + if (showFilterPools) + return mgr.getSystemFilterPoolReferences(); + else + { + ISystemFilterReference[] allRefs = mgr.getSystemFilterReferences(this); + return allRefs; + } + } + } + else + return null; + } + + /** + * Resolve an absolute filter string. This is only applicable if the subsystem + * factory reports true for {@link org.eclipse.rse.core.subsystems.SubSystemConfiguration#supportsFilters()}, + * which is the default. Otherwise, {@link org.eclipse.rse.core.subsystems.SubSystem#getChildren()} + * is called when the subsystem itself is expanded. + *

    + * When a user expands a filter this method is invoked for each filter string and the + * results are concatenated and displayed to the user. You can affect the post-concatenated + * result by overriding {@link #sortResolvedFilterStringObjects(Object[])} if you desire to + * sort the result, say, or pick our redundancies. + *

    + * The resulting objects are displayed in the tree in the Remote System {@link org.eclipse.rse.ui.view.SystemView view}. + * There are two requirements on the returned objects:

    + *
      + *
    1. They must implement {@link org.eclipse.core.runtime.IAdaptable}. + *
    2. Their must be an RSE {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter remote-adapter} registered + * for the object's class or interface type. Further, if this subsystem is {@link org.eclipse.rse.core.subsystems.SubSystem#isHidden() visible} + * in the RSE, which is the default, then there must also be an RSE {@link org.eclipse.rse.ui.view.ISystemViewElementAdapter GUI-adapter} registered + * with the platform. The base class implementation of this interface is {@link org.eclipse.rse.ui.view.AbstractSystemViewAdapter}. + *
    + *

    A good place to start with your remote-resource classes to subclasss {@link org.eclipse.rse.core.internal.subsystems.AbstractResource}, as it + * already implements IAdaptable, and maintains a reference to this owning subsystem, which helps when + * implementing the {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter remote-adapter}. + *

    + * Be sure to register your adapter factory in your plugin's startup method. + *

    + * You do not need to override this, as it does the progress monitor and error message + * displaying for you. Just override internalResolveFilterString. + *

    + * @param filterString filter pattern for objects to return. + * @param Shell parent shell used to show error message. Null means you will handle showing the error message. + */ + public Object[] resolveFilterString(String filterString, Shell shell) + throws Exception + { + boolean ok = true; + if (!isConnected()) + ok = promptForPassword(shell); + if (ok) + { + try + { + this.shell = shell; //FIXME remove this + ResolveAbsoluteJob job = new ResolveAbsoluteJob(filterString); + + IStatus status = scheduleJob(job, null, shell != null); + if (status.isOK()) + { + if (sortResults && (job.getOutputs()!=null)) + return sortResolvedFilterStringObjects(job.getOutputs()); + else + return job.getOutputs(); + } + } + catch (InterruptedException exc) + { + if (shell == null) throw exc; + else showOperationCancelledMessage(shell); + } + + } + else + System.out.println("in SubSystemImpl.resolveFilterString: isConnected() returning false!"); + return null; + } + /** + * Resolve multiple absolute filter strings. This is only applicable if the subsystem + * factory reports true for supportsFilters(). + *

    + * This is the same as {@link #resolveFilterString(String,Shell)} but takes an array of + * filter strings versus a single filter string. + *

    + * The default implementation of this simply calls {@link #resolveFilterString(String,Shell)} + * once for each filter string, and concatenates the result. The method sortResolvedFilterStringObject + * is called on the concatenated result, given subclasses an opportunity to sort the result. + *

    + * After successful resolve, the sort method is called to sort the concatenated results before + * returning them. + * + * @param filterStrings array of filter patterns for objects to return. + * @param Shell parent shell used to show error message. Null means you will handle showing the error message. + * @return Array of objects that are the result of resolving all the filter strings + */ + public Object[] resolveFilterStrings(String[] filterStrings, Shell shell) + throws Exception + { + + boolean ok = true; + + if ((filterStrings == null) || (filterStrings.length == 0)) { + SystemBasePlugin.logInfo("Filter strings are null"); + return null; + } + + if (!isConnected()) { + ok = promptForPassword(shell); + } + + if (ok) + { + try + { + this.shell = shell; //FIXME remove this + ResolveAbsolutesJob job = new ResolveAbsolutesJob(filterStrings[0], filterStrings); + + IStatus status = scheduleJob(job, null, true); + if (status.isOK()) + { + if (sortResults && (job.getOutputs()!=null)) + return sortResolvedFilterStringObjects(job.getOutputs()); + else + return job.getOutputs(); + } + } + catch (InterruptedException exc) + { + if (shell == null) throw exc; + else showOperationCancelledMessage(shell); + } + } + else + System.out.println("in SubSystemImpl.resolveFilterString: isConnected() returning false!"); + return null; + } + + protected IStatus scheduleJob(SubSystemOperationJob job, ISchedulingRule rule, boolean synch) throws InterruptedException + { + IRunnableContext context = getRunnableContext(shell); + if (context instanceof SystemPromptDialog) + { + IStatus status = job.runInContext(context); + if (!status.isOK()) + { + showOperationErrorMessage(shell, status.getException()); + } + return status; + } + job.setPriority(Job.INTERACTIVE); + //job.setUser(true); + if (rule != null) + { + job.setRule(rule); + } + job.schedule(); + + if (synch) + { + while (!job.hasStarted()) + { + Display.getCurrent().readAndDispatch(); + } + while (job.getResult() == null) + { + while (Display.getCurrent().readAndDispatch()); + } + return job.getResult(); + } + else + { + return Status.OK_STATUS; + } + + } + + /** + * Sort the concatenated list of all objects returned by resolving one or more + * filter strings. + * The default implementation does nothing. Child classes can override if they wish + * to show their resulting objects sorted. + */ + protected Object[] sortResolvedFilterStringObjects(Object[] input) + { + return input; + } + + + /** + * Modal thread version of resolve filter strings + * Resolve an absolute filter string. This is only applicable if the subsystem + * factory reports true for supportsFilters(). + *

    + * When a user expands a filter containing filter strings, this method is + * invoked for each filter string. + *

    + * The resulting objects are displayed in the remote system view tree. They + * can be anything, but at a minimum must support IAdaptable in order to + * drive the property sheet. You can just defer the getAdapter request to + * the platform's Adapter manager if desired. + *

    + * You should supply an adapter class for the returned object's class, + * to render objects in the Remote System Explorer view. It will uses a + * label and content provider that defers all requests to the adapter, + * which it gets by querying the platform's adapter manager for the object + * type. Be sure to register your adapter factory. + * + * @param monitor the process monitor associated with this operation + * @param filterString filter pattern for objects to return. + * @return Array of objects that are the result of this filter string + */ + public Object[] resolveFilterString(IProgressMonitor monitor, String filterString) throws Exception + { + boolean ok = true; + if (!isConnected()) + ok = promptForPassword(shell); + if (ok) + { + Object[] results = internalResolveFilterString(monitor, filterString); + if (sortResults && (results!=null)) + results = sortResolvedFilterStringObjects(results); + return results; + } + else + { + return null; + } + } + + /** + * Modal thread version of resolve filter strings + * Resolve an absolute filter string. This is only applicable if the subsystem + * factory reports true for supportsFilters(). + *

    + * When a user expands a filter containing filter strings, this method is + * invoked for each filter string. + *

    + * The resulting objects are displayed in the remote system view tree. They + * can be anything, but at a minimum must support IAdaptable in order to + * drive the property sheet. You can just defer the getAdapter request to + * the platform's Adapter manager if desired. + *

    + * You should supply an adapter class for the returned object's class, + * to render objects in the Remote System Explorer view. It will uses a + * label and content provider that defers all requests to the adapter, + * which it gets by querying the platform's adapter manager for the object + * type. Be sure to register your adapter factory. + * + * @param monitor the process monitor associated with this operation + * @param filterStrings filter patterns for objects to return. + * @return Array of objects that are the result of this filter string + */ + public Object[] resolveFilterStrings(IProgressMonitor monitor, String[] filterStrings) + throws Exception + { + boolean ok = true; + if (!isConnected()) + ok = promptForPassword(shell); + if (ok) + { + Object[] results = internalResolveFilterStrings(monitor, filterStrings); + if (sortResults && (results!=null)) + results = sortResolvedFilterStringObjects(results); + return results; + } + else + { + return null; + } + } + + /** + * Modal thread version of resolve filter strings + * Resolve an absolute filter string. This is only applicable if the subsystem + * factory reports true for supportsFilters(). + *

    + * When a user expands a filter containing filter strings, this method is + * invoked for each filter string. + *

    + * The resulting objects are displayed in the remote system view tree. They + * can be anything, but at a minimum must support IAdaptable in order to + * drive the property sheet. You can just defer the getAdapter request to + * the platform's Adapter manager if desired. + *

    + * You should supply an adapter class for the returned object's class, + * to render objects in the Remote System Explorer view. It will uses a + * label and content provider that defers all requests to the adapter, + * which it gets by querying the platform's adapter manager for the object + * type. Be sure to register your adapter factory. + * + * @param monitor the process monitor associated with this operation + * @param parent the object to query + * @param filterString filter pattern for objects to return. + * @return Array of objects that are the result of this filter string + */ + public Object[] resolveFilterString(IProgressMonitor monitor, Object parent, String filterString) + throws Exception + { + boolean ok = true; + if (!isConnected()) + ok = promptForPassword(shell); + + if (ok) + { + Object[] results= internalResolveFilterString(monitor, parent, filterString); + if (sortResults && (results!=null)) + results = sortResolvedFilterStringObjects(results); + return results; + } + else + { + return null; + } + } + + /** + * Resolve a relative filter string. + *

    + * When a user expands a remote resource this method is invoked and the + * results are potentially sorted and displayed to the user. You can affect the sorting + * behaviour by overriding {@link #sortResolvedFilterStringObjects(Object[])} if you desire to + * sort the result, say, or pick our redundancies. + *

    + * The resulting objects are displayed in the tree in the Remote System {@link org.eclipse.rse.ui.view.SystemView view}. + * There are two requirements on the returned objects:

    + *
      + *
    1. They must implement {@link org.eclipse.core.runtime.IAdaptable}. + *
    2. Their must be an RSE {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter remote-adapter} registered + * for the object's class or interface type. Further, if this subsystem is {@link org.eclipse.rse.core.subsystems.SubSystem#isHidden() visible} + * in the RSE, which is the default, then there must also be an RSE {@link org.eclipse.rse.ui.view.ISystemViewElementAdapter GUI-adapter} registered + * with the platform. The base class implementation of this interface is {@link org.eclipse.rse.ui.view.AbstractSystemViewAdapter}. + *
    + *

    A good place to start with your remote-resource classes to subclasss {@link org.eclipse.rse.core.internal.subsystems.AbstractResource}, as it + * already implements IAdaptable, and maintains a reference to this owning subsystem, which helps when + * implementing the {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter remote-adapter}. + *

    + * Be sure to register your adapter factory in your plugin's startup method. + *

    + * You do not need to override this, as it does the progress monitor and error message + * displaying for you. Override internalResolveFilterString instead. + *

    + * @param parent Object that is being expanded. + * @param filterString filter pattern for children of parent. Typically just "*". + * @param Shell parent shell used to show error message. Null means you will handle showing the error message. + */ + public Object[] resolveFilterString(Object parent, String filterString, Shell shell) + throws Exception + { + boolean ok = true; + if (!isConnected()) + ok = promptForPassword(shell); + if (ok) + { + + try + { + this.shell = shell; //FIXME remove this + + ResolveRelativeJob job = new ResolveRelativeJob(filterString, parent); + + IStatus status = scheduleJob(job, null, true); + if (status.isOK()) + { + if ((job.getOutputs()!=null) && (job.getOutputs().length>1)) + return sortResolvedFilterStringObjects(job.getOutputs()); + else return job.getOutputs(); + } + } + catch (InterruptedException exc) + { + if (shell == null) throw exc; + else showOperationCancelledMessage(shell); + } + } + else + SystemBasePlugin.logDebugMessage(this.getClass().getName(), "in SubSystemImpl.resolveFilterString: isConnected() returning false!"); + return null; + } + + + + + + /** + * Provide list of executed commands on subsystem.This is only applicable if the subsystem factory reports + * true for supportsCommands(). + */ + public String[] getExecutedCommands() + { + return null; + } + + + /** + * Set a remote property. Subsystems interpret as they wish. Eg, this might be to set + * a remote environment variable. This is only applicable if the subsystem factory reports + * true for supportsProperties(). + * @param subject Identifies which object to get the properties of + * @param key Identifies property to set + * @param value Value to set property to + * @param Shell parent shell used to show error message. Null means you will handle showing the error message. + * @return Object interpretable by subsystem. Might be a Boolean, or the might be new value for confirmation. + */ + public Object setProperty(Object subject, String key, String value, Shell shell) + throws Exception + { + boolean ok = true; + if (!isConnected()) + ok = promptForPassword(shell); + if (ok) + { + try + { + this.shell = shell; //FIXME remove this + SetPropertyJob job = new SetPropertyJob(subject, key, value); + + IStatus status = scheduleJob(job, null, true); + if (status.isOK()) + { + return job.getOutputs()[0]; + } + } + catch (InterruptedException exc) + { + if (shell == null) throw exc; + else showOperationCancelledMessage(shell); + } + } + else + System.out.println("in SubSystemImpl.setProperty: isConnected() returning false!"); + return null; + } + + /** + * Get a remote property. Subsystems interpret as they wish. Eg, this might be to get + * a remote environment variable. This is only applicable if the subsystem factory reports + * true for supportsProperties(). + * @param subject Identifies which object to get the properties of + * @param key Identifies property to get value of + * @param Shell parent shell used to show error message. Null means you will handle showing the error message. + * @return String The value of the requested key. + */ + public String getProperty(Object subject, String key, Shell shell) + throws Exception + { + boolean ok = true; + if (!isConnected()) + ok = promptForPassword(shell); + if (ok) + { + try + { + this.shell = shell; //FIXME remove this + GetPropertyJob job = new GetPropertyJob(subject, key); + scheduleJob(job, null, true); + + IStatus status = job.getResult(); + if (status.isOK()) + { + return job.getOutputStrings()[0]; + } + } + catch (InterruptedException exc) + { + if (shell == null) throw exc; + else showOperationCancelledMessage(shell); + } + } + else + System.out.println("in SubSystemImpl.getProperty: isConnected() returning false!"); + return null; + } + + /** + * Set multiple remote properties. Subsystems interpret as they wish. Eg, this might be to set + * a number of remote environment variables. This is only applicable if the subsystem factory reports + * true for supportsProperties(). + * @param subject Identifies which object to get the properties of + * @param key Identifies property to set + * @param value Values to set properties to. One to one mapping to keys by index number + * @param Shell parent shell used to show error message. Null means you will handle showing the error message. + * @return Object interpretable by subsystem. Might be a Boolean, or the might be new values for confirmation. + */ + public Object setProperties(Object subject, String[] keys, String[] values, Shell shell) + throws Exception + { + boolean ok = true; + if (!isConnected()) + ok = promptForPassword(shell); + if (ok) + { + try + { + this.shell = shell; //FIXME remove this + SetPropertiesJob job = new SetPropertiesJob(subject, keys, values); + + IStatus status = scheduleJob(job, null, true); + if (status.isOK()) + { + return job.getOutputs()[0]; + } + } + catch (InterruptedException exc) + { + if (shell == null) throw exc; + else showOperationCancelledMessage(shell); + } + } + else + System.out.println("in SubSystemImpl.setProperties: isConnected() returning false!"); + return null; + } + + /** + * This gets called after the corresponding ISystem connect method finishes. + * This method should be overridden if any initialization for the subsystem needs + * to occur at this time + */ + public abstract void initializeSubSystem(IProgressMonitor monitor); + + /** + * Attempt to connect to the remote system. + * You do not need to override this, as it does the progress monitor and error message + * displaying for you. + *

    + * Override internalConnect if you want, but by default it calls getSystem().connect(IProgressMonitor). + * + * @param Shell parent shell used to show error message. Null means you will handle showing the error message. + */ + public void connect(Shell shell) throws Exception + { + connect(shell, false); + } + /** + * Attempt to connect to the remote system when a Shell is not available. + * You do not need to override this, as it does the progress monitor and error message + * displaying for you. + *

    + * Override internalConnect if you want, but by default it calls getSystem().connect(IProgressMonitor). + */ + public void connect() throws Exception + { + if (isConnected()) return; + + ConnectJobNoShell job = new ConnectJobNoShell(); + job.setPriority(Job.INTERACTIVE); + //job.setUser(true); + job.schedule(); + + while (job.getResult() == null) + { + Display.getCurrent().readAndDispatch(); + } + } + + /** + * Connect to the remote system, optionally forcing a signon prompt even if the password + * is cached in memory or on disk. + * You do not need to override this, as it does the progress monitor and error message + * displaying for you. + *

    + * Override internalConnect if you want, but by default it calls getSystem().connect(IProgressMonitor). + * + * @param Shell parent shell used to show error message. Null means you will handle showing the error message. + * @param forcePrompt Forces the signon prompt to be displayed even if a valid password in cached in memory + * or saved on disk. + */ + public void connect(Shell shell, boolean forcePrompt) throws Exception + { + // yantzi: artemis60, (defect 53082) check that the connection has not been deleted before continuing, + // this is a defenisve measure to protect against code that stores a handle to subsystems but does + // not do this check + if (SystemPlugin.getTheSystemRegistry().getHost(getSystemProfile(), getHost().getAliasName()) == null) + { + // connection no longer exists + SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_CONNECTION_DELETED); + msg.makeSubstitution(getHost().getAliasName()); + throw new SystemMessageException(msg); + } + + this.shell = shell; //FIXME remove this + + // yantzi: artemis 6.0, offline support + if (isOffline()) + { + SystemMessage sMsg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_OFFLINE_CANT_CONNECT); + sMsg.makeSubstitution(getHost().getAliasName()); + throw new SystemMessageException(sMsg); + } + + //DY operation = OPERATION_CONNECT; + if (isConnected() || !supportsConnecting) + return; + + IRunnableContext runnableContext = getRunnableContext(shell); + if (runnableContext instanceof ProgressMonitorDialog) + ((ProgressMonitorDialog)runnableContext).setCancelable(true); + + try + { + getConnectorService().promptForPassword(shell, forcePrompt); // prompt for password + ConnectJob job = new ConnectJob(); + scheduleJob(job, null, shell != null); + + IStatus status = job.getResult(); + if (status != null && status.isOK()) + { + ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry(); + sr.connectedStatusChange(this, true, false); + return; + } + } + catch (InterruptedException exc) + { + throw exc; + } + } + + + + /** + * Prompt the user for a password to the remote system. The primary request was something else, + * but we have detected the user is not connected so we prompt for password outside + * of the progress monitor, then set a flag to do the connection within the progress + * monitor. + * @param Shell parent shell used to show error message. Null means you will handle showing the error message. + */ + protected boolean promptForPassword(Shell shell) throws Exception + { + boolean ok = false; + if (!supportsConnecting) + return true; + + if (isOffline()) + { + // offline so don't bother prompting + doConnection = true; // this gets handled later when it comes time to connect + return true; + } + else if (supportsCaching() && getCacheManager().isRestoreFromMemento()) + { + doConnection = true; // this gets handled later when it comes time to connect + return true; + } + + try + { + getConnectorService().promptForPassword(shell, false); // prompt for password + doConnection = true; + ok = true; + } + catch (InterruptedException exc) // user cancelled + { + throw exc; + } + catch (Exception exc) + { + showConnectErrorMessage(shell, getHostName(), getConnectorService().getPort(), exc); + } + return ok; + } + + /** + * Disconnect from the remote system + * You do not need to override this, as it does the progress monitor and error message + * displaying for you. + *

    + * Override internalDisconnect if you want, but by default it calls getSystem().disconnect(IProgressMonitor). + * + * @param Shell parent shell used to show error message. Null means you will handle showing the error message. + */ + public void disconnect(Shell shell) throws Exception + { + disconnect(shell, true); + } + + /** + * Disconnect from the remote system + * You do not need to override this, as it does the progress monitor and error message + * displaying for you. + *

    + * Override internalDisconnect if you want, but by default it calls getSystem().disconnect(IProgressMonitor). + * + * @param Shell parent shell used to show error message. Null means you will handle showing the error message. + * @param collapseTree collapse the tree in the system view + */ + public void disconnect(Shell shell, boolean collapseTree) throws Exception + { + _disconnecting = true; + this.shell = shell; //FIXME remove this + if (!isConnected() || !supportsConnecting) + { + // disconnected but may not have notified viewers (i.e. network problem) + ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry(); + sr.connectedStatusChange(this, false, true, collapseTree); + return; + } + try + { + DisconnectJob job = new DisconnectJob(); + IStatus status = scheduleJob(job, this, true); + if (status.isOK()) + { + getConnectorService().reset(); + ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry(); + sr.connectedStatusChange(this, false, true, collapseTree); + return; + } + } + catch (InterruptedException exc) + { + if (shell != null) + showDisconnectCancelledMessage(shell, getHostName(), getConnectorService().getPort()); + throw exc; + } + finally + { + _disconnecting = false; + _connectionError = false; + } + } + + /** + * Get a remote property. Subsystems interpret as they wish. Eg, this might be to get + * a remote environment variable. This is only applicable if the subsystem factory reports + * true for supportsProperties(). + * @param subject Identifies which object to get the properties of + * @param key Identifies property to get value of + * @param Shell parent shell used to show error message. Null means you will handle showing the error message. + * @return Object The values of the requested keys. + */ + public String[] getProperties(Object subject, String[] keys, Shell shell) + throws Exception + { + this.shell = shell; //FIXME remove this + boolean ok = true; + + if (!isConnected()) + ok = promptForPassword(shell); + if (ok) + { + try + { + GetPropertiesJob job = new GetPropertiesJob(subject, keys); + + IStatus status = scheduleJob(job, null, true); + if (status.isOK()) + { + return job.getOutputStrings(); + } + } + catch (InterruptedException exc) + { + if (shell == null) throw exc; + else showOperationCancelledMessage(shell); + } + + } + return null; + } + + // ---------------------------------- + // METHODS THAT MUST BE OVERRIDDEN... + // ---------------------------------- + + /** + * Return the {@link org.eclipse.rse.core.subsystems.IConnectorService ISystem} object that represents the live connection for this system. + * This must return an object that implements ISystem. A good starting point for that + * is the base class {@link AbstractConnectorService}. + *

    If you only have a single subsystem class, you may override this method to return the + * ISystem object that manages the connect/disconnect actions. If, on the other hand, + * you have multiple subsystem classes that desire to share a single ISystem connection, + * (ie, share the same communications pipe) then do not override this. By default, this + * calls getSystemManager() which returns an {@link AbstractConnectorServiceManager} object that manages maintaining a singleton + * ISystem object per system connection. You should subclass AbstractSystemManager, + * and override getSystemManager() to return a singleton instance of that subclass. + *

    Default implementation:

    + *
    
    +	 *   return getSystemManager().getSystemObject(this);
    +	 * 
    + * + *

    We recommending using a subclass of {@link AbstractConnectorServiceManager} even for single + * subsystems, because it doesn't hurt and allows easy growth if new subsystems + * are added in the future. + */ + public IConnectorService getConnectorService() + { + return _connectorService; + } + + public void setConnectorService(IConnectorService connectorService) + { + if (_connectorService != connectorService) + { + _connectorService = connectorService; + _connectorService.registerSubSystem(this); + setDirty(true); + } + } + + + + + /** + * Check if the SubSystem supports caching. This is the default implementation + * which returns false. Subclasses must override to support caching. + */ + public boolean supportsCaching() + { + return false; + } + + /** + * Return the CacheManager for this subsystem. This is the default implementation + * which just returns null. + * + * @see #supportsCaching() + */ + public ICacheManager getCacheManager() + { + return null; + } + + /** + * Actually connect to the remote host. This is called by the run(IProgressMonitor monitor) method. + *

    + * You DO NOT OVERRIDE THIS typically. Rather, this calls connect(IProgressMonitor) in your + * ISystem class that is returned from getSystem(). That is where your code to connect should go! + *

    + * Your connect method in your ISystem class must follow these IRunnableWithProgress rules: + *

      + *
    • if the user cancels (monitor.isCanceled()), throw new InterruptedException() + *
    • if something else bad happens, throw new java.lang.reflect.InvocationTargetException(exc) + * - well, actually you can throw anything and we'll wrap it here in an InvocationTargetException + *
    • do not worry about calling monitor.done() ... caller will do that! + *
    + * + */ + protected void internalConnect(IProgressMonitor monitor) + throws java.lang.reflect.InvocationTargetException, + java.lang.InterruptedException + { + try + { + getConnectorService().connect(monitor); + } + catch(Exception exc) + { + if (exc instanceof java.lang.reflect.InvocationTargetException) + throw (java.lang.reflect.InvocationTargetException)exc; + if (exc instanceof java.lang.InterruptedException) + throw (java.lang.InterruptedException)exc; + throw new java.lang.reflect.InvocationTargetException(exc); + } + } + + /** + * Actually disconnect from the remote host. This is called by the run(IProgressMonitor monitor) method. + *

    + * You DO NOT OVERRIDE THIS typically. Rather, this calls connect(IProgressMonitor) in your + * ISystem class that is returned from getSystem(). That is where your code to disconnect should go! + *

    + * Your connect method in your ISystem class must follow these IRunnableWithProgress rules: + *

      + *
    • if the user cancels (monitor.isCanceled()), throw new InterruptedException() + *
    • if the host is unknown, throw new java.lang.reflect.InvocationTargetException(new java.net.UnknownHostException)); + *
    • if something else bad happens, throw new java.lang.reflect.InvocationTargetException(exc); + * - well, actually you can throw anything and we'll wrap it here in an InvocationTargetException + *
    • do not worry about calling monitor.done() ... caller will do that! + *
    + */ + protected void internalDisconnect(IProgressMonitor monitor) + throws java.lang.reflect.InvocationTargetException, + java.lang.InterruptedException + { + try + { + getConnectorService().disconnect(); + } + catch(Exception exc) + { + if (exc instanceof java.lang.reflect.InvocationTargetException) + throw (java.lang.reflect.InvocationTargetException)exc; + if (exc instanceof java.lang.InterruptedException) + throw (java.lang.InterruptedException)exc; + throw new java.lang.reflect.InvocationTargetException(exc); + } + } + + /** + * Resolve an absolute filter string. This is only applicable if the subsystem + * factory reports true for {@link org.eclipse.rse.core.subsystems.SubSystemConfiguration#supportsFilters()}, + * which is the default. Otherwise, {@link org.eclipse.rse.core.subsystems.SubSystem#getChildren()} + * is called when the subsystem itself is expanded. + *

    + * When a user expands a filter this method is invoked for each filter string and the + * results are concatenated and displayed to the user. You can affect the post-concatenated + * result by overriding {@link #sortResolvedFilterStringObjects(Object[])} if you desire to + * sort the result, say, or pick our redundancies. + *

    + * The resulting objects are displayed in the tree in the Remote System {@link org.eclipse.rse.ui.view.SystemView view}. + * There are two requirements on the returned objects:

    + *
      + *
    1. They must implement {@link org.eclipse.core.runtime.IAdaptable}. + *
    2. Their must be an RSE {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter remote-adapter} registered + * for the object's class or interface type. Further, if this subsystem is {@link org.eclipse.rse.core.subsystems.SubSystem#isHidden() visible} + * in the RSE, which is the default, then there must also be an RSE {@link org.eclipse.rse.ui.view.ISystemViewElementAdapter GUI-adapter} registered + * with the platform. The base class implementation of this interface is {@link org.eclipse.rse.ui.view.AbstractSystemViewAdapter}. + *
    + *

    A good place to start with your remote-resource classes to subclasss {@link org.eclipse.rse.core.internal.subsystems.AbstractResource}, as it + * already implements IAdaptable, and maintains a reference to this owning subsystem, which helps when + * implementing the {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter remote-adapter}. + *

    + * Be sure to register your adapter factory in your plugin's startup method. + *

    + * Actually resolve an absolute filter string. This is called by the + * run(IProgressMonitor monitor) method, which in turn is called by resolveFilterString. + *

    + * As per IRunnableWithProgress rules: + *

      + *
    • if the user cancels (monitor.isCanceled()), throw new InterruptedException() + *
    • if something else bad happens, throw new java.lang.reflect.InvocationTargetException(exc); + *
    • do not worry about calling monitor.done() ... caller will do that! + *
    + * YOU MUST OVERRIDE THIS IF YOU SUPPORT FILTERS! + */ + protected Object[] internalResolveFilterString(IProgressMonitor monitor, String filterString) + throws java.lang.reflect.InvocationTargetException, + java.lang.InterruptedException + { + return null; + } + /** + * Resolve multiple absolute filter strings. This is only applicable if the subsystem + * factory reports true for supportsFilters(). + *

    + * This is the same as {@link #resolveFilterString(String,Shell)} but takes an array of + * filter strings versus a single filter string. + *

    + * The default implementation of this simply calls {@link #resolveFilterString(String,Shell)} + * once for each filter string, and concatenates the result. The method sortResolvedFilterStringObject + * is called on the concatenated result, given subclasses an opportunity to sort the result. + *

    + * After successful resolve, the sort method is called to sort the concatenated results before + * returning them. + * @param monitor the progress monitor we are running under + * @param filterStrings array of filter patterns for objects to return. + * @return Array of objects that are the result of resolving all the filter strings + */ + public Object[] internalResolveFilterStrings(IProgressMonitor monitor, String[] filterStrings) + throws java.lang.reflect.InvocationTargetException, + java.lang.InterruptedException + { + Object[] children = null; + Vector vChildren = new Vector(); + for (int idx=0; idx + * Can be used to filter out redundant entries in the concatenated list, if this + * is desired. + */ + protected void addResolvedFilterStringObjects(Vector allChildrenSoFar, Object[] childrenForThisFilterString, + String[] allFilterStrings, int currFilterStringIndex) + { + for (int jdx = 0; jdxrelative filter string. + *

    + * When a user expands a remote resource this method is invoked and the + * results are potentially sorted and displayed to the user. You can affect the sorting + * behaviour by overriding {@link #sortResolvedFilterStringObjects(Object[])} if you desire to + * sort the result, say, or pick our redundancies. + *

    + * The resulting objects are displayed in the tree in the Remote System {@link org.eclipse.rse.ui.view.SystemView view}. + * There are two requirements on the returned objects:

    + *
      + *
    1. They must implement {@link org.eclipse.core.runtime.IAdaptable}. + *
    2. Their must be an RSE {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter remote-adapter} registered + * for the object's class or interface type. Further, if this subsystem is {@link org.eclipse.rse.core.subsystems.SubSystem#isHidden visible} + * in the RSE, which is the default, then there must also be an RSE {@link org.eclipse.rse.ui.view.ISystemViewElementAdapter GUI-adapter} registered + * with the platform. The base class implementation of this interface is {@link org.eclipse.rse.ui.view.AbstractSystemViewAdapter}. + *
    + *

    A good place to start with your remote-resource classes to subclasss {@link org.eclipse.rse.core.internal.subsystems.AbstractResource}, as it + * already implements IAdaptable, and maintains a reference to this owning subsystem, which helps when + * implementing the {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter remote-adapter}. + *

    + * Be sure to register your adapter factory in your plugin's startup method. + *

    + * This is called by the run(IProgressMonitor monitor) method, which in turn is called by resolveFilterString. + *

    + * As per IRunnableWithProgress rules: + *

      + *
    • if the user cancels (monitor.isCanceled()), throw new InterruptedException() + *
    • if something else bad happens, throw new java.lang.reflect.InvocationTargetException(exc); + *
    • do not worry about calling monitor.done() ... caller will do that! + *
    + * YOU MUST OVERRIDE THIS IF YOU SUPPORT FILTERS! + */ + protected Object[] internalResolveFilterString(IProgressMonitor monitor, Object parent, String filterString) + throws java.lang.reflect.InvocationTargetException, + java.lang.InterruptedException + { + return null; + } + /** + * Called by resolveFilterString when given null for the filter string, meaning we defer + * getting a filter string until later, where we query it from the parent. In this case + * we need the first filter string for the progress monitor msg.
    + * Override if needed. By default we return "*"; + */ + protected String getFirstParentFilterString(Object parent) + { + return "*"; + } + + + /** + * Actually get a remote property. This is called by the + * run(IProgressMonitor monitor) method, which in turn is called by getProperty(...). + *

    + * As per IRunnableWithProgress rules: + *

      + *
    • if the user cancels (monitor.isCanceled()), throw new InterruptedException() + *
    • if something else bad happens, throw new java.lang.reflect.InvocationTargetException(exc); + *
    • do not worry about calling monitor.done() ... caller will do that! + *
    + * YOU MUST OVERRIDE THIS IF YOU SUPPORT PROPERTIES! + */ + protected String internalGetProperty(IProgressMonitor monitor, Object subject, String key) + throws java.lang.reflect.InvocationTargetException, + java.lang.InterruptedException + { + return null; + } + + /** + * Actually set a remote property. This is called by the + * run(IProgressMonitor monitor) method, which in turn is called by setProperty(...). + *

    + * As per IRunnableWithProgress rules: + *

      + *
    • if the user cancels (monitor.isCanceled()), throw new InterruptedException() + *
    • if something else bad happens, throw new java.lang.reflect.InvocationTargetException(exc); + *
    • do not worry about calling monitor.done() ... caller will do that! + *
    + * YOU MUST OVERRIDE THIS IF YOU SUPPORT PROPERTIES! + */ + protected Object internalSetProperty(IProgressMonitor monitor, Object subject, String key, String value) + throws java.lang.reflect.InvocationTargetException, + java.lang.InterruptedException + { + return null; + } + + /** + * Actually get multiple remote properties. This is called by the + * run(IProgressMonitor monitor) method, which in turn is called by getProperties(...). + *

    + * As per IRunnableWithProgress rules: + *

      + *
    • if the user cancels (monitor.isCanceled()), throw new InterruptedException() + *
    • if something else bad happens, throw new java.lang.reflect.InvocationTargetException(exc); + *
    • do not worry about calling monitor.done() ... caller will do that! + *
    + * YOU MUST OVERRIDE THIS IF YOU SUPPORT PROPERTIES! + */ + protected String[] internalGetProperties(IProgressMonitor monitor, Object subject, String[] keys) + throws java.lang.reflect.InvocationTargetException, + java.lang.InterruptedException + { + return null; + } + + /** + * Actually set multiple remote properties. This is called by the + * run(IProgressMonitor monitor) method, which in turn is called by setProperties(...). + *

    + * As per IRunnableWithProgress rules: + *

      + *
    • if the user cancels (monitor.isCanceled()), throw new InterruptedException() + *
    • if something else bad happens, throw new java.lang.reflect.InvocationTargetException(exc); + *
    • do not worry about calling monitor.done() ... caller will do that! + *
    + * YOU MUST OVERRIDE THIS IF YOU SUPPORT PROPERTIES! + */ + protected Object internalSetProperties(IProgressMonitor monitor, Object subject, String[] keys, String[] values) + throws java.lang.reflect.InvocationTargetException, + java.lang.InterruptedException + { + return null; + } + + + + + /** + * 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. + */ + protected IRunnableContext getRunnableContext(Shell rshell) + { + // for wizards and dialogs, use the specified context + IRunnableContext irc = SystemPlugin.getTheSystemRegistry().getRunnableContext(); + if (irc != null) + { + SystemBasePlugin.logInfo("Got runnable context from system registry"); + 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"); + shell = winShell; + return win; + } + else + { + win = null; + } + } + + if (shell == null || shell.isDisposed() || !shell.isVisible()) + { + SystemBasePlugin.logInfo("Using progress monitor dialog with given shell as parent"); + shell = rshell; + } + + + IRunnableContext dlg = new ProgressMonitorDialog(rshell); + return dlg; + } + } + + /** + * Return the shell for the current operation + */ + protected Shell getShell() + { + return shell; + } + + /** + * Helper/convenience method. Return shell of active window. + */ + public static Shell getActiveWorkbenchShell() + { + Shell result = null; + IWorkbenchWindow window = getActiveWorkbenchWindow(); + if (window != null) { + result = window.getShell(); + } + return result; + } + /** + * Helper/convenience method. Return active window + */ + public static IWorkbenchWindow getActiveWorkbenchWindow() + { + return SystemPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow(); + } + + /** + * Private. Do not override. + * @generated This field/method will be replaced during code generation + */ + public String getName() + { + return _name; + } + + /** + * Private. Do not override. + * @generated This field/method will be replaced during code generation. + */ + public void setName(String newName) + { + String oldName = _name; + if (oldName == null || !oldName.equals(newName)) + { + _name = newName; + setDirty(true); + } + } + + + + + /** + * Private. Do not override. + * @generated This field/method will be replaced during code generation + * Ties this subsystem to its owning subsystemconfiguration, via the + * id key string of the factory + */ + public String getConfigurationId() + { + return _factoryId; + } + + /** + * Private. Do not override. + * @generated This field/method will be replaced during code generation. + */ + public void setConfigurationId(String newFactoryId) + { + String oldFactoryId = _factoryId; + if (oldFactoryId == null || !oldFactoryId.equals(newFactoryId)) + { + _factoryId = newFactoryId; + setDirty(true); + } + } + + /** + * Private. Do not override. + * @generated This field/method will be replaced during code generation + */ + public boolean isHidden() + { + return _hidden; + } + + /** + * Private. Do not override. + * @generated This field/method will be replaced during code generation. + */ + public void setHidden(boolean newHidden) + { + boolean oldHidden = _hidden; + if (oldHidden != newHidden) + { + _hidden = newHidden; + setDirty(true); + } + } + + /** + * Private. Do not override. + * @generated This field/method will be replaced during code generation + */ + public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager() + { + return filterPoolReferenceManager; + } + + public void setFilterPoolReferenceManager(ISystemFilterPoolReferenceManager newFilterPoolReferenceManager) + { + filterPoolReferenceManager = newFilterPoolReferenceManager; + return; + } + + + + + /** + * @return true if this subsystem's properties should take precedence over other subsystems that share the same ISystem + */ + public boolean isPrimarySubSystem() + { + return false; + } + + /* + * Returns the first subsystem associated with the connection + */ + public ISubSystem getPrimarySubSystem() + { + ISubSystem firstSS = null; + ISystemRegistry registry = SystemPlugin.getTheSystemRegistry(); + ISubSystem[] sses = registry.getSubSystems(getHost(), false); + for (int i = 0; i < sses.length; i++) + { + ISubSystem ss = sses[i]; + if (ss.getConnectorService() == getConnectorService()) + { + if (firstSS == null) + { + firstSS = ss; + } + if (ss.isPrimarySubSystem()) + { + return ss; + } + } + } + if (firstSS == null) + { + firstSS = this; + } + return firstSS; + } + + + + public Object getTargetForFilter(ISystemFilterReference filterRef) + { + return null; + } + /* (non-Javadoc) + * @see com.ibm.etools.systems.subsystems.SubSystem#isConnectionError() + */ + public boolean isConnectionError() + { + return _connectionError; + } + /* (non-Javadoc) + * @see com.ibm.etools.systems.subsystems.SubSystem#setConnectionError(boolean) + */ + public void setConnectionError(boolean error) + { + _connectionError = error; + } + + public Object[] getTargetsForFilter(ISystemFilterReference filterRef) + { + return null; + } + + /** + * @see org.eclipse.core.runtime.jobs.ISchedulingRule#contains(org.eclipse.core.runtime.jobs.ISchedulingRule) + */ + public boolean contains(ISchedulingRule rule) + { + if (this.equals(rule)) return true; + if (rule instanceof IResource) return true; + else return false; + } + + /** + * @see org.eclipse.core.runtime.jobs.ISchedulingRule#isConflicting(org.eclipse.core.runtime.jobs.ISchedulingRule) + */ + public boolean isConflicting(ISchedulingRule rule) + { + if (this == rule) return true; + else return false; + } + + public boolean isDirty() + { + return _isDirty; + } + + public void setDirty(boolean flag) + { + _isDirty = false; + } + + public boolean commit() + { + return SystemPlugin.getThePersistenceManager().commit(this); + } + + + + public boolean wasRestored() + { + return _wasRestored; + } + + public void setWasRestored(boolean flag) + { + _wasRestored = flag; + } + + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystemConfiguration.java new file mode 100644 index 00000000000..d7ec4d86b14 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystemConfiguration.java @@ -0,0 +1,3049 @@ +/******************************************************************************** + * 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.core.subsystems; + +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Vector; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.rse.core.ISystemTypes; +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.core.SystemPreferencesManager; +import org.eclipse.rse.core.internal.subsystems.IBMServerLauncherConstants; +import org.eclipse.rse.core.internal.subsystems.SubSystemFilterNamingPolicy; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterContainer; +import org.eclipse.rse.filters.ISystemFilterContainerReference; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager; +import org.eclipse.rse.filters.ISystemFilterSavePolicies; +import org.eclipse.rse.filters.ISystemFilterString; +import org.eclipse.rse.filters.SystemFilterPoolWrapperInformation; +import org.eclipse.rse.filters.SystemFilterStartHere; +import org.eclipse.rse.internal.filters.SystemFilterPoolManager; +import org.eclipse.rse.internal.model.SystemProfileManager; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemModelChangeEvents; +import org.eclipse.rse.model.ISystemProfile; +import org.eclipse.rse.model.ISystemProfileManager; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.SystemResourceChangeEvent; +import org.eclipse.rse.model.SystemStartHere; +import org.eclipse.rse.references.ISystemBaseReferencingObject; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.SystemMenuManager; +import org.eclipse.rse.ui.SystemPropertyResources; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.filters.actions.SystemNewFilterAction; +import org.eclipse.rse.ui.messages.ISystemMessageLine; +import org.eclipse.rse.ui.messages.SystemMessageDialog; +import org.eclipse.rse.ui.propertypages.ISystemSubSystemPropertyPageCoreForm; +import org.eclipse.rse.ui.propertypages.SystemSubSystemPropertyPageCoreForm; +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.view.ISystemRemoteElementAdapter; +import org.eclipse.rse.ui.widgets.IBMServerLauncherForm; +import org.eclipse.rse.ui.widgets.IServerLauncherForm; +import org.eclipse.rse.ui.wizards.ISubSystemPropertiesWizardPage; +import org.eclipse.rse.ui.wizards.ISystemNewConnectionWizardPage; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.dialogs.PropertyPage; + + +/** + * Abstract base class for subsystem factory extension points. + * Child classes must implement the methods: + *
      + *
    • #createSubSystemInternal(SystemConnection conn) + *
    + * Child classes can optionally override: + *
      + *
    • SubSystemFactory#supportsFilters() to indicate if filters are to be enabled for this factory + *
    • SubSystemFactory#supportsNestedFilters() to indicate if filters can exist inside filters. + *
    • SubSystemFactory#supportsDuplicateFilterStrings() to indicate if filter strings can be duplicates within a filter + *
    • SubSystemFactory#isCaseSensitive() to indicate if filter strings are case sensitive or not + *
    • SubSystemFactory#supportsQuickFilters() to indicate if filters can be specified at contain expansion time. + *
    • SubSystemFactory#supportsUserActions() to indicate if users can define their own actions for your subsystems' child objects. + *
    • SubSystemFactory#supportsCompileActions() to indicate if users can compile remote objects using menu actions + *
    • SubSystemFactory#supportsFileTypes() to indicate if users can define their own named file types. + *
    • SubSystemFactory#isSubSystemsDeletable() if they support user-deleting of subsystems. Default is false + *
    • SubSystemFactory#supportsSubSystemConnect() to return false if the connect() action is not supported + *
    • SubSystemFactory#supportsTargets() to return true if this factory supports the notions of targets. Normally, this is only for file system factories. + *
    • SubSystemFactory#getSubSystemActions() if they wish to supply actions for the right-click menu when + * the user right clicks on a subsystem object created by this factory. + *
    • CreateDefaultFilterPool() to create any default filter pool when a new profile is created. + *
    • #initializeSubSystem(SubSystem ss, ISystemNewConnectionWizardPage[]) + *
    + *

    + * A factory will maintain in memory a list of all subsystem objects it has. This + * list should be initialize from disk at restore time, and maintained as the subsystems are + * created and deleted throughout the session. At save time, each subsystem in the list + * is asked to save itself. The getSubSystems method should return this list. + *

    + * To help with maintaining this list, this base class contains a Vector instance variable + * named subsystems. It is returned by the getSubSystems method in this base class. For this + * to be accurate you though, you should: + *

      + *
    • Not implement createSubSystem directly, but rather let this class handle it. Instead + * implement the method createSubSystemInternal. This is called by createSubSystem in this + * class. + *
    + * Should you prefer to maintain your own list, simply override getSubSystems. + */ + +public abstract class SubSystemConfiguration implements ISubSystemConfiguration +{ + + + // subsystem stuff... + private Hashtable subSystemsRestoredFlags = new Hashtable(); + private ISubSystemConfigurationProxy proxy = null; + private ISubSystem[] subsystems = null; + private Hashtable subsystemsByConnection = new Hashtable(); + + private boolean allSubSystemsRestored = false; + private static final ISubSystem[] EMPTY_SUBSYSTEM_ARRAY = new ISubSystem[0]; + + // filters stuff... + protected SubSystemFilterNamingPolicy filterNamingPolicy = new SubSystemFilterNamingPolicy(); + protected ISystemFilterPoolManager[] filterPoolManagers = null; + protected Hashtable filterPoolManagersPerProfile = new Hashtable(); + + + // other stuff... + private String translatedFilterType = null; + private static Hashtable brokenReferenceWarningsIssued = new Hashtable(); + protected Hashtable imageTable = null; + protected IHost currentlySelectedConnection; + protected Object[] currentlySelected; + + // support for default subclasses for non-mof users + protected static IHost currentlyProcessingConnection; + protected static SubSystemConfiguration currentlyProcessingSubSystemFactory; + + + protected java.util.List subSystemList = null; + protected java.util.List filterPoolManagerList = null; + + protected boolean _isDirty; + + + /** + * Constructor + */ + public SubSystemConfiguration() + { + super(); + //initSubSystems(); + SystemBasePlugin.logDebugMessage(this.getClass().getName(), "STARTED SSFACTORY"); + } + + + + /** + * Reset for a full refresh from disk, such as after a team synch. + * Override this as required, but please call super.reset()!! + */ + public void reset() + { + subSystemsRestoredFlags = new Hashtable(); + subsystems = null; + subsystemsByConnection = new Hashtable(); + allSubSystemsRestored = false; + filterPoolManagersPerProfile = new Hashtable(); + filterPoolManagers = null; + brokenReferenceWarningsIssued = new Hashtable(); + } + + // --------------------------------- + // CRITICAL METHODS... + // --------------------------------- + /** + * Return true (default) or false to indicate if subsystems of this factory require a userId to + * do connection or not. If not, no GUI will be supplied related to user Ids in the remote systems + * explorer view. + *

    + * Returns TRUE by default. + */ + public boolean supportsUserId() + { + return true; + } + /** + * Return true if instance of this factory's subsystems support connect and disconnect actions. + * By default, returns true. + * Override if this is not the case. + */ + public boolean supportsSubSystemConnect() + { + return true; + } + /** + * Return true (default) or false to indicate if subsystems of this factory support user-editable + * port numbers. + */ + public boolean isPortEditable() + { + return true; + } + /** + * Return true if subsystem instances from this factory support remote command execution + *

    RETURNS FALSE BY DEFAULT. + */ + public boolean supportsCommands() + { + return false; + } + /** + * Return true if subsystem instances from this factory support getting and setting properties + *

    RETURNS FALSE BY DEFAULT. + */ + public boolean supportsProperties() + { + return false; + } + /** + * Return true if you support filters, false otherwise. + * If you support filters, then some housekeeping will be + * done for you automatically. Specifically, they + * will be saved and restored for you automatically. + * The default is to support filters. + */ + public boolean supportsFilters() { + return true; + } + + /** + * Indicates whether the subsystem supports displaying children under + * its filters. By default, this will return true, but if filters that can't + * be expanded are desired, this can be overridden to return false. + */ + public boolean supportsFilterChildren() + { + return true; + } + + /** + * Required method for subsystem factory child classes. Return true if you filter caching. + * If you support filter caching, then the views will always check the in-memory cache for + * filter results before attempting a query. + *

    Returns true in default implementation. + */ + public boolean supportsFilterCaching() + { + return true; + } + + /** + * Required method for subsystem factory child classes. Return true if you support filters, and you support + * multiple filter strings per filter. Return false to restrict the user to one string per filter. + *

    Returns TRUE by default. + */ + public boolean supportsMultipleFilterStrings() + { + return true; + } + + /** + * Required method for subsystem factory child classes if returning true from supportsFilters. + * Return true if you support filters within filters, false otherwise. + *

    RETURNS supportsFilters() BY DEFAULT. + */ + public boolean supportsNestedFilters() + { + return supportsFilters(); + } + /** + * Return true if you support quick filters. These allow the user to subset a remote system object at + * the time they expand it in the remote system explorer tree view. + *

    RETURNS supportsFilters() BY DEFAULT. + *

    THIS IS NOT SUPPORTED BY THE FRAMEWORK YET + */ + public boolean supportsQuickFilters() + { + return supportsFilters(); + } + + /** + * Return true if filters of this subsystem factory support dropping into. + * Override this method to provide drop support for filters. + */ + public boolean supportsDropInFilters() + { + return false; + } + + /** + * Return true if filters of this subsystem factory provide a custom implementation of drop support. + * By default, the filter reference adapter treats a drop on a filter as an update to the list of filter + * strings for a filter. For things like files, it is more desirable to treat the drop as a physical + * resource copy, so in that case, custom drop makes sense. + * + * By default this returns false. + */ + public boolean providesCustomDropInFilters() + { + return false; + } + + /** + * Return true if you support user-defined actions for the remote system objects returned from expansion of + * subsystems created by this subsystem factory + *

    RETURNS false BY DEFAULT + * + * @see #supportsUserDefinedActions(ISelection) + * @see #getActionSubSystem(ISubSystem) + * @see #createActionSubSystem() + */ + public boolean supportsUserDefinedActions() + { + return false; + } + + + /** + * Return true if you support user-defined actions for the remote system objects explicitly given. This + * calls supportsUserDefinedActions() by default. It is called when decided whether or not to show + * the User Actions menu for the current selection, if supportsUserDefinedActions() returns true. + * + * @see #getActionSubSystem(ISubSystem) + * @see #createActionSubSystem() + * @see #addCommonRemoteActions(SystemMenuManager, IStructuredSelection, Shell, String, ISubSystem) + */ + public boolean supportsUserDefinedActions(ISelection selection) + { + // no selection or empty selection, so default to subsystem factory + if (selection == null || selection.isEmpty()) { + return supportsUserDefinedActions(); + } + else { + + // selection is a structured selection + if (selection instanceof IStructuredSelection) { + + IStructuredSelection sel = (IStructuredSelection)selection; + + Iterator iter = sel.iterator(); + + boolean supportsUserDefinedActions = true; + + // check if adapter of each object supports user defined actions + while (iter.hasNext()) { + Object obj = iter.next(); + + // we query adapter as to whether it supports user defined actions only + // if the adapter is a remote element adapter + ISystemRemoteElementAdapter adapter = (ISystemRemoteElementAdapter)(Platform.getAdapterManager().getAdapter(obj, ISystemRemoteElementAdapter.class)); + + if (adapter != null) { + supportsUserDefinedActions = adapter.supportsUserDefinedActions(obj); + } + else { + supportsUserDefinedActions = supportsUserDefinedActions(); + } + + // if one of the selections doesn't support user defined actions, we return false + if (!supportsUserDefinedActions) { + return false; + } + } + + // all adapters support user defined actions, so return whether the subsystem factory + // supports user defined actions + return supportsUserDefinedActions(); + } + // not a structured selection, so default to asking subsystem factory + else { + return supportsUserDefinedActions(); + } + } + } + /** + * Return true if you support compile actions for the remote system objects returned from expansion of + * subsystems created by this subsystem factory. + *

    + * By returning true, user sees a "Work with->Compile Commands..." action item in the popup menu for this + * subsystem. The action is supplied by the framework, but is populated using overridable methods in this subsystem. + *

    RETURNS false BY DEFAULT + * @see #getCompileManager() + * @see #createCompileManager() + */ + public boolean supportsCompileActions() + { + return false; + } + + /** + * Return true if you support user-defined/managed named file types + *

    RETURNS false BY DEFAULT + */ + public boolean supportsFileTypes() + { + return false; + } + + /** + * Return true if the subsystem supports more than one filter string + *

    RETURNS true BY DEFAULT + */ + public boolean supportsMultiStringFilters() + { + return true; + } + + /** + * Return true if the subsystem supports the exporting of filter strings from it's filters + *

    RETURNS true BY DEFAULT + */ + public boolean supportsFilterStringExport() + { + return true; + } + + /** + * Tell us if filter strings are case sensitive. The default is false. + */ + public boolean isCaseSensitive() + { + return false; + } + /** + * Tell us if duplicate filter strings are supported. The default is false. + */ + public boolean supportsDuplicateFilterStrings() + { + return false; + } + /** + * Tell us if this subsystem factory supports targets, which are destinations for + * pushes and builds. Normally only true for file system factories. + */ + public boolean supportsTargets() + { + return false; + } + /** + * Tell us if this subsystem factory supports server launch properties, which allow the user + * to configure how the server-side code for these subsystems are started. There is a Server + * Launch Setting property page, with a pluggable composite, where users can configure these + * properties. + *

    + * If you return true here, you may also want to override {@link #supportsServerLaunchType(ServerLaunchType)}. + *
    By default we return false here. This is overridden in UniversalFileSubSystemFactory though. + */ + public abstract boolean supportsServerLaunchProperties(IHost host); + + /** + * If {@link #supportsServerLaunchProperties()} returns true, this method may be called by + * the server launcher to decide if a given remote server launch type is supported or not. + *
    We return true by default. + * @see org.eclipse.rse.core.subsystems.ServerLaunchType + * @see #getServerLauncherForm(Shell, ISystemMessageLine) + */ + public boolean supportsServerLaunchType(ServerLaunchType serverLaunchType) + { + return true; + } + + /** + * Determines whether this factory is responsible for the creation of subsytems of the specified type + * Subsystem factories should override this to indicate which subsystems they support. + * + * @param subSystemType type of subsystem + * @return whether this factory is for the specified subsystemtype + */ + public boolean isFactoryFor(Class subSystemType) + { + //return SubSystem.class.isAssignableFrom(subSystemType); + return false; + } + + /* + * Return the form used in the subsyste property page. This default implementation returns Syste + */ + public ISystemSubSystemPropertyPageCoreForm getSubSystemPropertyPageCoreFrom(ISystemMessageLine msgLine, Object caller) + { + return new SystemSubSystemPropertyPageCoreForm(msgLine, caller); + } + + /** + * Gets the list of property pages applicable for a subsystem associated with this factory + * @return the list of subsystem property pages + */ + protected List getSubSystemPropertyPages() + { + List propertyPages= new ArrayList(); + // Get reference to the plug-in registry + IExtensionRegistry registry = Platform.getExtensionRegistry(); + + // Get configured property page extenders + IConfigurationElement[] propertyPageExtensions = + registry.getConfigurationElementsFor("org.eclipse.ui", "propertyPages"); + + for (int i = 0; i < propertyPageExtensions.length; i++) + { + IConfigurationElement configurationElement = propertyPageExtensions[i]; + String objectClass = configurationElement.getAttribute("objectClass"); + String name = configurationElement.getAttribute("name"); + Class objCls = null; + try + { + ClassLoader loader = getClass().getClassLoader(); + objCls = Class.forName(objectClass, false, loader); + } + catch (Exception e) + { + } + + + if (objCls != null && ISubSystem.class.isAssignableFrom(objCls) && isFactoryFor(objCls)) + { + try + { + PropertyPage page = (PropertyPage) configurationElement.createExecutableExtension("class"); + page.setTitle(name); + propertyPages.add(page); + } + catch (Exception e) + { + } + } + } + return propertyPages; + } + + + + + +// FIXME - compile actions no longer part of core +// // --------------------------------- +// // COMPILE ACTIONS METHODS... +// // --------------------------------- +// /** +// * Get the singleton compile manager responsible for enabling the compile support +// * for remote source objects. +// *

    +// * Do not override this, as the implementation is complete. However, +// * you must override createCompileManager() +// * +// * @see #supportsCompileActions() +// * @see #createCompileManager() +// */ +// public SystemCompileManager getCompileManager() +// { +// if (compileManager == null) +// { +// compileManager = createCompileManager(); +// if (compileManager != null) +// compileManager.setSubSystemFactory(this); +// } +// return compileManager; +// } +// +// /** +// * Overridable method to instantiate the SystemCompileManager for this factory. +// * This is typically your unique subclass of SystemCompileManager. +// * Called once only by getCompileManager (it is only instantiated once). +// * +// * @see #supportsCompileActions() +// * @see #getCompileManager() +// */ +// protected SystemCompileManager createCompileManager() +// { +// return null; +// } + + // --------------------------------- + // USER-PREFERENCE METHODS... + // --------------------------------- + + /** + * If we support filters, should we show filter pools in the remote system explorer? + * By default, this retrieves the setting from user preferences. + */ + public boolean showFilterPools() + { + return SystemPreferencesManager.getPreferencesManager().getShowFilterPools(); + } + /* + * If we support filters, should we show filter strings in the remote system explorer? + * By default, this retrieves the setting from user preferences. + * + public boolean showFilterStrings() + { + return SystemPreferencesManager.getPreferencesManager().getShowFilterStrings(); + }*/ + /** + * If we support filters, should we show filter pools in the remote system explorer? + * This is to set it after the user changes it in the user preferences. It may require + * refreshing the current view. + */ + public void setShowFilterPools(boolean show) + { + ISubSystem[] subsystems = getSubSystems(false); // false=> lazy get; don't restore from disk if not already + for (int idx = 0; idx < subsystems.length; idx++) + { + ISubSystem ss = subsystems[idx]; + SystemPlugin.getTheSystemRegistry().fireEvent(new org.eclipse.rse.model.SystemResourceChangeEvent(ss, ISystemResourceChangeEvents.EVENT_CHANGE_CHILDREN, ss)); + } + } + /* + * If we support filters, should we show filter strings in the remote system explorer? + * This is to set it after the user changes it in the user preferences. It may require + * refreshing the current view. + * + public void setShowFilterStrings(boolean show) + { + SubSystem[] subsystems = getSubSystems(false); // false=> lazy get; don't restore from disk if not already + for (int idx=0; idx + * Our only mission is to delete the filter pool associated with it, + * because the registry has already called deleteSubSystemsByConnection + * for every subsystem of every connection owned by this profile. + */ + public void deletingSystemProfile(ISystemProfile profile) + { + deleteFilterPoolManager(profile); + } + /** + * Called by SystemRegistry when we have toggled the active-status of a profile + */ + public void changingSystemProfileActiveStatus(ISystemProfile profile, boolean newStatus) + { + if (newStatus) // making a profile active/ + { + allSubSystemsRestored = false; // next call to getSubSystems will restore the subsystems for the newly activated connections + } + } + + // --------------------------------- + // SUBSYSTEM METHODS... + // --------------------------------- + /** + * Return the validator for the userId. + * A default is supplied. + * Note this is only used for the subsystem's properties, so will not + * be used by the connection's default. Thus, is only of limited value. + *

    + * This must be castable to ICellEditorValidator for the property sheet support. + */ + public ISystemValidator getUserIdValidator() + { + SystemPlugin sp = SystemPlugin.getDefault(); + ISystemValidator userIdValidator = + new ValidatorSpecialChar( + "=;", + false, + SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_USERID_NOTVALID), + SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_USERID_EMPTY)); + // false => allow empty? No. + return userIdValidator; + } + /** + * Return the validator for the password which is prompted for at runtime. + * Returns null by default. + */ + public ISystemValidator getPasswordValidator() + { + 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() + { + ISystemValidator portValidator = new ValidatorPortInput(); + return portValidator; + } + + /** + * Called by SystemRegistry's renameSystemProfile method to ensure we update our + * subsystem names within each subsystem. + *

    + * This is called AFTER changing the profile's name!! + */ + public void renameSubSystemProfile(ISubSystem ss, String oldProfileName, String newProfileName) + { + //SystemPlugin.logDebugMessage(this.getClass().getName(), "Inside renameSubSystemProfile. newProfileName = "+newProfileName+", old ssName = "+ss.getName()); + //renameFilterPoolManager(getSystemProfile(newProfileName)); // update filter pool manager name + ss.renamingProfile(oldProfileName, newProfileName); + ISystemFilterPoolReferenceManager sfprm = ss.getSystemFilterPoolReferenceManager(); + if (sfprm != null) + { + sfprm.regenerateReferencedSystemFilterPoolNames(); // ask it to re-ask each pool for its reference name + } + try + { + saveSubSystem(ss); + } + catch (Exception exc) + { + // already dealt with in save? + } + + } + + /** + * Called by SystemRegistry's renameSystemProfile method to pre-test if we are going to run into errors on a + * profile rename, due to file or folder in use. + */ + public void preTestRenameSubSystemProfile(String oldProfileName) throws Exception + { + ISystemProfile profile = getSystemProfile(oldProfileName); + if (profile.isDefaultPrivate()) + { + ISystemFilterPool defaultPoolForThisProfile = getDefaultFilterPool(profile, oldProfileName); + if (defaultPoolForThisProfile != null) + getFilterPoolManager(profile).preTestRenameFilterPool(defaultPoolForThisProfile); + } + } + + /** + * Return the default filter pool for the given profile... + */ + public ISystemFilterPool getDefaultFilterPool(ISystemProfile profile, String oldProfileName) + { + ISystemFilterPool pool = null; + ISystemFilterPoolManager mgr = getFilterPoolManager(profile); + ISystemFilterPool[] pools = mgr.getSystemFilterPools(); + if (pools != null) + { + for (int idx = 0; (pool==null) && (idx < pools.length); idx++) + { + // first and best test + if (pools[idx].isDefault() && pools[idx].getName().equals(getDefaultFilterPoolName(oldProfileName, getId()))) + pool = pools[idx]; + } + if (pool == null) // no perfect match? + pool = mgr.getFirstDefaultSystemFilterPool(); // settle for 2nd best. It may be that the filter was created in a different language. + } + + return pool; + } + + /** + * Called by SystemRegistry's renameConnection method to ensure we update our + * connection names within each subsystem. + *

    + * Must be called prior to changing the connection's name!! + */ + public void renameSubSystemsByConnection(IHost conn, String newConnectionName) + { + ISubSystem[] subsystems = getSubSystems(conn, ISubSystemConfiguration.FORCE_INTO_MEMORY); + for (int idx = 0; idx < subsystems.length; idx++) + { + subsystems[idx].renamingConnection(newConnectionName); + } + try + { + saveSubSystems(conn); + } + catch (Exception exc) + { + // already dealt with in save? + } + } + /** + * Called by SystemRegistry's deleteConnection method to ensure we delete all our + * subsystems for a given connection. + */ + public void deleteSubSystemsByConnection(IHost conn) + { + ISubSystem[] subsystems = conn.getSubSystems(); + + //System.out.println("in deleteSubSystemsByConnection. Nbr subsystems = " + subsystems.length); + for (int idx = 0; idx < subsystems.length; idx++) + { + try + { + subsystems[idx].disconnect((Shell) null); // be nice if we had a shell to pass! + } + catch (Exception exc) + { + } + subsystems[idx].deletingConnection(); // let subsystem do any clean up needed prior to death + deleteSubSystem(subsystems[idx]); + } + invalidateSubSystemCache(conn); + try + { + saveSubSystems(conn); + } + catch (Exception exc) + { + // already dealt with? + } + } + + /** + * Invalidate internal cached array of subsystems. Call whenever + * a new subsystem is created, repositioned or deleted. + */ + protected void invalidateSubSystemCache(IHost conn) + { + subsystems = null; + if (conn != null) + subsystemsByConnection.remove(conn); // remove key and value + } + + /** + * Return list of all subsystems. + * @param true if we should force all the subsystems to be restored from disk if not already + */ + public ISubSystem[] getSubSystems(boolean force) + { + if (force && !allSubSystemsRestored) + { + // the safest way is to re-use existing method that will restore for every defined connection + // in the active profiles (although if user makes another profile active, we'll have to revisit) + IHost[] allActiveConnections = SystemPlugin.getTheSystemRegistry().getHosts(); + if (allActiveConnections != null) + { + for (int idx = 0; idx < allActiveConnections.length; idx++) + if (proxy.appliesToSystemType(allActiveConnections[idx].getSystemType())) + getSubSystems(allActiveConnections[idx], force); // will load from disk if not already loaded + } + allSubSystemsRestored = true; + subsystems = null; // force re-gen + } + if ((subsystems == null) || (subsystems.length != getSubSystemList().size())) + { + java.util.List alist = null; + if (SystemProfileManager.getSystemProfileManager().getSystemProfileNamesVector().size() > 0) // 42913 + alist = getSubSystemList(); + if (alist == null) + return new ISubSystem[0]; + Iterator i = alist.iterator(); + subsystems = new ISubSystem[alist.size()]; + int idx = 0; + while (i.hasNext()) + { + ISubSystem subsys = (ISubSystem) i.next(); + subsystems[idx++] = subsys; + } + } + return subsystems; + } + + /** + * Returns a list of subsystem objects existing for the given connection. + * For performance, the calculated array is cached until something changes. + * @param conn System connection to retrieve subsystems for + * @param true if we should force all the subsystems to be restored from disk if not already + */ + public ISubSystem[] getSubSystems(IHost conn, boolean force) + { + ISubSystem[] subsystemArray = (ISubSystem[]) subsystemsByConnection.get(conn); + if (subsystemArray == null || subsystemArray.length ==0) + { + //System.out.println("SubSystemFactoryImpl.getSubSystems(conn): subSystemsHaveBeenRestored(conn): "+subSystemsHaveBeenRestored(conn)); + boolean subsystemsRestored = subSystemsHaveBeenRestored(conn); + if (!subsystemsRestored && force) + { + /*FIXME - this should now be triggered by new persistance model + try + { + //System.out.println("SubSystemFactoryImpl.getSubSystems(conn): before restoreSubSystems"); + subsystemArray = SystemPlugin.getThePersistenceManager().restoreSubSystems(this, conn); + //System.out.println("After restoreSubSystems: "+subsystemArray.length); + if (subsystemArray != null) + { + for (int idx = 0; idx < subsystemArray.length; idx++) + addSubSystem(subsystemArray[idx]); + subsystemsByConnection.put(conn, subsystemArray); + } + } + catch (Exception exc) + { + SystemPlugin.logError("Exception restoring subsystems for connection " + conn, exc); + } + */ + } + else if (!subsystemsRestored && !force) + { + return EMPTY_SUBSYSTEM_ARRAY; + } + else + { + //System.out.println("...calling internalGet..."); + subsystemArray = internalGetSubSystems(conn); + //System.out.println("...back from calling internalGet..."); + subsystemsByConnection.put(conn, subsystemArray); + } + } + return subsystemArray; + } + /** + * Private method to subset master list of all subsystems by a given connection + */ + protected ISubSystem[] internalGetSubSystems(IHost conn) + { + java.util.List mofList = getSubSystemList(); + Iterator i = mofList.iterator(); + Vector v = new Vector(); + String connProfileName = conn.getSystemProfile().getName(); + String connAliasName = conn.getAliasName(); + while (i.hasNext()) + { + ISubSystem subsys = (ISubSystem) i.next(); + if (subsys.getHost() == conn) + v.addElement(subsys); + } + ISubSystem[] array = new ISubSystem[v.size()]; + for (int idx = 0; idx < v.size(); idx++) + array[idx] = (ISubSystem) v.elementAt(idx); + return array; + } + /** + * Returns a list of subsystem objects existing for all the connections in the + * given profile. Will force restoring all subsystems from disk. + */ + public ISubSystem[] getSubSystems(ISystemProfile profile) + { + String profileName = profile.getName(); + ISubSystem[] allSubSystems = getSubSystems(true); + Vector v = new Vector(); + for (int idx = 0; idx < allSubSystems.length; idx++) + { + ISubSystem ss = allSubSystems[idx]; + if (ss.getSystemProfile() == profile) + v.addElement(ss); + } + ISubSystem[] subsystems = new ISubSystem[v.size()]; + for (int idx = 0; idx < v.size(); idx++) + subsystems[idx] = (ISubSystem) v.elementAt(idx); + return subsystems; + } + /** + * Returns a list of subsystem objects existing in memory, + * which contain a reference to the given filter pool. + */ + public ISubSystem[] getSubSystems(ISystemFilterPool pool) + { + ISubSystem[] allSubSystems = getSubSystems(false); // // false=> lazy get; don't restore from disk if not already + Vector v = new Vector(); + for (int idx = 0; idx < allSubSystems.length; idx++) + { + ISystemFilterPoolReferenceManager mgr = subsystems[idx].getSystemFilterPoolReferenceManager(); + if ((mgr != null) && (mgr.isSystemFilterPoolReferenced(pool))) + { + v.addElement(allSubSystems[idx]); + } + } + ISubSystem[] subsystems = new ISubSystem[v.size()]; + for (int idx = 0; idx < v.size(); idx++) + subsystems[idx] = (ISubSystem) v.elementAt(idx); + return subsystems; + } + + /** + * Helper method to allow child classes to add a subsystem object to the in-memory + * list maintained and returned by this base class. + */ + protected void addSubSystem(ISubSystem subsys) + { + getSubSystemList().add(subsys); + } + + /** + * Helper method to allow child classes to remove a subsystem object from the in-memory + * list maintained and returned by this base class. + */ + protected void removeSubSystem(ISubSystem subsys) + { + getSubSystemList().remove(subsys); + /* FIXME + // now in EMF, the profiles are "owned" by the Resource, and only referenced by the profile manager, + // so I don't think just removing it from the manager is enough... it must also be removed from its + // resource. Phil. + Resource res = subsys.eResource(); + if (res != null) + res.getContents().remove(subsys); + */ + } + + /** + * Creates a new subsystem instance that is associated with the given connection object. + * SystemRegistryImpl calls this when a new connection is created, and appliesToSystemType returns true. + *

    + * This method doe sthe following: + *

      + *
    • calls {@link #createSubSystemInternal(IHost)} to create the subsystem + *
    • does initialization of common attributes + *
    • if {@link #supportsFilters()}, creates a {@link org.eclipse.rse.filters.ISystemFilterPoolReferenceManager} for the + * subsystem to manage references to filter pools + *
    • if (@link #supportsServerLaunchProperties()}, calls {@link #createServerLauncher(ISubSystem)}, to create + * the server launcher instance to associate with this subsystem. This can be subsequently + * retrieved via calling subsystem's {@link ISubSystem#getRemoteServerLauncher()}. + *
    • calls {@link #initializeSubSystem(ISubSystem, ISystemNewConnectionWizardPage[])} so subclasses can + * do their thing to initialize the subsystem. + *
    • finally, saves the subsystem to disk. + *
    + * @param conn The connection to create a subsystem for + * @param creatingConnection true if we are creating a connection, false if just creating + * another subsystem for an existing connection. + * @param yourNewConnectionWizardPages The wizard pages you supplied to the New Connection wizard, via the + * {@link #getNewConnectionWizardPages(IWizard)} method or null if you didn't override this method. + * Note there may be more pages than you originally supplied as it is all pages contributed by + * this factory object, including subclasses. + */ + public ISubSystem createSubSystem(IHost conn, boolean creatingConnection, ISystemNewConnectionWizardPage[] yourNewConnectionWizardPages) + { + invalidateSubSystemCache(conn); // re-gen list of subsystems-by-connection on next call + if (creatingConnection) + subSystemsRestoredFlags.put(conn, Boolean.TRUE); // do not try to restore subsequently. Nothing to restore! + ISubSystem subsys = createSubSystemInternal(conn); + if (subsys != null) + { + internalInitializeNewSubsystem(subsys, conn); + if (supportsFilters()) + { + // We create a filter pool reference manager object to manage the filter pool references + // that are stored with a subsystem. + //SystemFilterPoolManager[] relatedFilterPoolManagers = + // getReferencableFilterPoolManagers(conn.getSystemProfile()); + ISystemFilterPoolReferenceManager fprMgr = SystemFilterStartHere.createSystemFilterPoolReferenceManager(subsys, this, subsys.getName(), filterNamingPolicy); + subsys.setFilterPoolReferenceManager(fprMgr); + ISystemFilterPoolManager defaultFilterPoolManager = getFilterPoolManager(conn.getSystemProfile()); + fprMgr.setDefaultSystemFilterPoolManager(defaultFilterPoolManager); + } + + IConnectorService connectorService = subsys.getConnectorService(); + if (supportsServerLaunchProperties(conn)) + { + IServerLauncherProperties sl = connectorService.getRemoteServerLauncherProperties(); + if (sl == null) + { + sl = createServerLauncher(connectorService); + if (sl != null) + { + connectorService.setRemoteServerLauncherProperties(sl); + } + } + } + initializeSubSystem(subsys, yourNewConnectionWizardPages); + try + { + saveSubSystem(subsys); + //DKM - save this event til all the processing is done! + // fire model change event in case any BP code is listening... + //SystemPlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_ADDED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_SUBSYSTEM, subsys, null); + } + catch (Exception exc) + { + SystemBasePlugin.logError("Error saving new subsystem " + subsys.getName(), exc); + } + + addSubSystem(subsys); // only add to list even if save was not successful. + //if (lastExc != null) + //throw lastExc; + } + return subsys; + } + /** + * Clone a given subsystem into the given connection. + * Called when user does a copy-connection action. + * @param oldSubsystem The subsystem to be cloned + * @param newConnection The connection into which to create and clone the old subsystem + * @param copyProfileOperation Pass true if this is an profile-copy operation versus a connection-copy operation + * @return New subsystem within the new connection + */ + public ISubSystem cloneSubSystem(ISubSystem oldSubsystem, IHost newConnection, boolean copyProfileOperation) throws Exception + { + Exception lastExc = null; + invalidateSubSystemCache(newConnection); // re-gen list of subsystems-by-connection on next call + subSystemsRestoredFlags.put(newConnection, Boolean.TRUE); // do not try to restore subsequently. Nothing to restore! + ISubSystem subsys = createSubSystemInternal(newConnection); + if (subsys != null) + { + internalInitializeNewSubsystem(subsys, newConnection); + // copy common data + subsys.setName(oldSubsystem.getName()); // just in case it was changed + subsys.addPropertySets(oldSubsystem.getPropertySets()); + subsys.setHidden(oldSubsystem.isHidden()); + + + // connector service + IConnectorService oldConnectorService = oldSubsystem.getConnectorService(); + IConnectorService newConnectorService = subsys.getConnectorService(); + if (oldConnectorService != null) + { + if (newConnectorService != null) + { + newConnectorService.setPort(oldConnectorService.getPort()); + newConnectorService.setUserId(oldConnectorService.getUserId()); + newConnectorService.setIsUsingSSL(oldConnectorService.isUsingSSL()); + } + } + + // server launcher + IServerLauncherProperties sl = oldConnectorService.getRemoteServerLauncherProperties(); + if ((sl != null) && supportsServerLaunchProperties(newConnection)) + { + IServerLauncherProperties newSL = createServerLauncher(newConnectorService); + if (newSL != null) + { + newConnectorService.setRemoteServerLauncherProperties(sl.cloneServerLauncher(newSL)); + } + } + copySubSystemData(oldSubsystem, subsys); // let child classes copy their own data + if (supportsFilters()) + { + // We create a filter pool reference manager object to manage the filter pool references + // that are stored with a subsystem. + //SystemFilterPoolManager[] relatedFilterPoolManagers = + // getReferencableFilterPoolManagers(newConnection.getSystemProfile()); + ISystemFilterPoolReferenceManager newRefMgr = SystemFilterStartHere.createSystemFilterPoolReferenceManager(subsys, this, subsys.getName(), filterNamingPolicy); + ISystemFilterPoolManager defaultFilterPoolManager = null; + if (copyProfileOperation) + defaultFilterPoolManager = getFilterPoolManager(newConnection.getSystemProfile()); + else + defaultFilterPoolManager = oldSubsystem.getFilterPoolReferenceManager().getDefaultSystemFilterPoolManager(); + newRefMgr.setDefaultSystemFilterPoolManager(defaultFilterPoolManager); + subsys.setFilterPoolReferenceManager(newRefMgr); + // copy filter pool references... + ISystemFilterPoolReferenceManager oldRefMgr = oldSubsystem.getSystemFilterPoolReferenceManager(); + newRefMgr.setProviderEventNotification(false); + ISystemFilterPoolReference[] oldReferences = oldRefMgr.getSystemFilterPoolReferences(); + String oldSubSystemProfileName = oldSubsystem.getSystemProfileName(); + if ((oldReferences != null) && (oldReferences.length > 0)) + { + for (int idx = 0; idx < oldReferences.length; idx++) + { + ISystemFilterPoolReference poolRef = oldReferences[idx]; + ISystemFilterPool pool = poolRef.getReferencedFilterPool(); + // if just copying a connnection, then copy references to pools as-is + if (!copyProfileOperation) + { + newRefMgr.addReferenceToSystemFilterPool(pool); + } + // if copying a profile, update references to pools in old profile to become references to pools in new profile... + else + { + ISystemFilterPoolManager poolMgr = pool.getSystemFilterPoolManager(); + String poolProfileName = getSystemProfileName(poolMgr); + if (poolProfileName.equals(oldSubSystemProfileName)) + { + //SystemPlugin.logDebugMessage(this.getClass().getName(),"found reference to copied filter pool " + pool.getName() + ", so changing to reference to new copy"); + ISystemFilterPoolManager newPoolMgr = getFilterPoolManager(newConnection.getSystemProfile()); + ISystemFilterPool newPool = newPoolMgr.getSystemFilterPool(pool.getName()); + //SystemPlugin.logDebugMessage(this.getClass().getName(),"...new pool = " + newPoolMgr.getName()+"."+newPool.getName()); + newRefMgr.addReferenceToSystemFilterPool(newPool); + } + else + { + //SystemPlugin.logDebugMessage(this.getClass().getName(),"found reference to filter pool from another profile " + poolProfileName+"."+pool.getName() + ", so not changing to reference to new copy"); + newRefMgr.addReferenceToSystemFilterPool(pool); + } + } + } + } + newRefMgr.setProviderEventNotification(true); + } + try + { + saveSubSystem(subsys); + + // fire model change event in case any BP code is listening... + SystemPlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_ADDED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_SUBSYSTEM, subsys, null); + } + catch (Exception exc) + { + lastExc = exc; + SystemBasePlugin.logError("Error saving cloned subsystem " + subsys.getName(), exc); + } + addSubSystem(subsys); // only add to list even if save was not successful. + if (lastExc != null) + throw lastExc; + } + return subsys; + } + + /** + * Called after successfully creating a new subsystem via createSubSystemInternal when creating a new connection, or + * when cloning a subsystem + * @param ss The new subsystem + * @param conn The new connection containing this new subsystem + */ + private void internalInitializeNewSubsystem(ISubSystem subsys, IHost conn) + { + subsys.setSubSystemConfiguration(this); + subsys.setHost(conn); + subsys.setName(internalGetSubSystemName(subsys)); + subsys.setConfigurationId(getId()); + } + + /** + * Overridable. + *

    + * Return the name to give a new subsystem. By default, it is given the name of this + * factory object. This is fine, unless you support multiple subsystem instances per + * connection, in which case it is your responsibility to supply a unique name for + * each. + *

    + * By default returns getName() + */ + protected String internalGetSubSystemName(ISubSystem subsys) + { + return getName(); + } + + /** + * Method called by default implementation of createSubSystem method in AbstractSubSystemFactory. + */ + public abstract ISubSystem createSubSystemInternal(IHost conn); + + /** + * Overridable method to initialize subsystems after creation. The default behaviour here is to + * set the subsystem's port property to 0, and to add to it a reference to the default filter pool for this + * factory, if there is one. Typically subclasses call super().initializeSubSystem(...) + * to get this default behaviour, then extend it. + * + *

    The reason for the connect wizard pages parm is in case your factory contributes a page to that wizard, + * whose values are needed to set the subsystem's initial state. For example, you might decide to add a + * page to the connection wizard to prompt for a JDBC Driver name. If so, when this method is called at + * the time a new connection is created apres the wizard, your page will have the user's value. You can + * thus use it here to initialize that subsystem property. Be use to use instanceof to find your particular + * page. + *

    + * + * @param ss - The subsystem that was created via createSubSystemInternal + * @param yourNewConnectionWizardPages - The wizard pages you supplied to the New Connection wizard, via the + * {@link #getNewConnectionWizardPages(IWizard)} method or null if you didn't override this method. + * Note there may be more pages than you originally supplied, as you are passed all pages contributed + * by this factory object, including subclasses. This is null when this method is called other than + * for a New Connection operation. + */ + protected void initializeSubSystem(ISubSystem ss, ISystemNewConnectionWizardPage[] yourNewConnectionWizardPages) + { + IConnectorService connectorService = ss.getConnectorService(); + if (connectorService != null) + { + connectorService.setPort(0); + } + if (supportsFilters()) + { + // -------------------------------------------- + // add a reference to the default filter pool + // -------------------------------------------- + ISystemFilterPool pool = getDefaultSystemFilterPool(ss); + if (pool != null) + { + ISystemFilterPoolReferenceManager refMgr = ss.getSystemFilterPoolReferenceManager(); + refMgr.setProviderEventNotification(false); + refMgr.addReferenceToSystemFilterPool(pool); + refMgr.setProviderEventNotification(true); + } + } + + // apply properties set in the wizard to the subsystem + if (yourNewConnectionWizardPages != null) + { + ISubSystemPropertiesWizardPage ourPage = null; + for (int idx=0; (ourPage==null) && (idx + * If you have your own attributes and own GUI to prompt for these, then call your own + * method to set your attributes, and call this method via super().xxx(...). + *

    + * The subsystem will be saved to disk. + * Further, it will be asked to disconnect as this data affects the connection. + *

    + * @param shell parent shell needed in case an error message is displayed + * @param subsystem target of the update action + * @param updateUserId true if we are updating the userId, else false to ignore userId + * @param userId new local user Id. Ignored if updateUserId is false + * @param updatePort true if we are updating the port, else false to ignore port + * @param port new local port value. Ignored if updatePort is false + */ + public void updateSubSystem(Shell shell, ISubSystem subsystem, boolean updateUserId, String userId, boolean updatePort, int port) + { + // we pushed down the code that checks if this change is real, such that + // in a multi-subsystem environment it will not enter an infinite loop + // when the event is fired. + if (!needsUpdate(subsystem, updateUserId, userId, updatePort, port)) // port was changed or userId was changed + return; + + IConnectorService connectorService = subsystem.getConnectorService(); + if (connectorService != null) + { + // do the actual update + if (updateUserId) + { + if ((userId != null) && (userId.trim().length() > 0)) + { + connectorService.setUserId(userId); + } + else + { + connectorService.setUserId(null); + } + } + if (updatePort) + { + connectorService.setPort(port); + } + } + else + { + + } + + // inform interested listeners... + fireEvent(subsystem, ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE, subsystem.getHost()); + + // fire model change event in case any BP code is listening... + SystemPlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_CHANGED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_SUBSYSTEM, subsystem, null); + + // if the updated subsystem is one of many that share a single ISystem, then + // update all of them too... + // DKM - now that ConnectorService is independent of subsystme, this should be unnecessary + /* AbstractConnectorServiceManager systemManager = subsystem.getConnectorService(); + if (systemManager != null) + systemManager.updateSubSystems(shell, subsystem, updateUserId, userId, updatePort, port);*/ + } + /** + * Update the port for the given subsystem instance. + * Shortcut to {@link #updateSubSystem(Shell,ISubSystem,boolean,String,boolean,Integer)} + */ + public void setSubSystemPort(Shell shell, ISubSystem subsystem, int port) + { + updateSubSystem(shell, subsystem, false, null, true, port); + } + /** + * Update the user ID for the given subsystem instance. + * Shortcut to {@link #updateSubSystem(Shell,ISubSystem,boolean,String,boolean,Integer)} + */ + public void setSubSystemUserId(Shell shell, ISubSystem subsystem, String userId) + { + updateSubSystem(shell, subsystem, true, userId, false, 0); + } + + /** + * Used by child classes that override updateSubSystem to establish if anything really + * needs to be changed. + */ + protected boolean needsUpdate(ISubSystem subsystem, boolean updateUserId, String userId, boolean updatePort, int port) + { + IConnectorService connectorService = subsystem.getConnectorService(); + if (connectorService != null) + { + if (updatePort) // we pass this parameter for a reason! + { + + int oldPort = connectorService.getPort(); + updatePort = oldPort != port; + } + if (!updatePort && updateUserId) + { + if ((userId == null) || (userId.trim().length() == 0)) // given empty + { + + updateUserId = (connectorService.getUserId() != null); + } + else + { + + String oldUserId = connectorService.getUserId(); + if (oldUserId != null) + { // if it is null, then we need to update it! + // DY defect 43374 + if (subsystem.forceUserIdToUpperCase()) + updateUserId = !userId.equalsIgnoreCase(oldUserId); + else + updateUserId = !userId.equals(oldUserId); + } + } + } + } + return updatePort || updateUserId; + } + + /** + * Returns true if this factory allows users to delete instances of subsystem objects. + * Would only be true if users are allowed to create multiple instances of subsystem objects + * per connection. + * Returns false by default. Override this and deleteSubSystem(SubSystem subsystem) to + * support user deletes + */ + public boolean isSubSystemsDeletable() + { + return false; + } + + /** + * Deletes a given subsystem instance from the list maintained by this factory. + * SystemRegistryImpl calls this when the user selects to delete a subsystem object, + * or deletes the parent connection this subsystem is associated with. + *

    + * In former case, this is only called if the factory supports user-deletable subsystems. + *

    + * Handled for you! + */ + public boolean deleteSubSystem(ISubSystem subsystem) + { + try + { + subsystem.disconnect((Shell) null); // just in case. + } + catch (Exception exc) + { + } + removeSubSystem(subsystem); // remove from our in-memory cache + ISystemFilterPoolReferenceManager fpRefMgr = subsystem.getSystemFilterPoolReferenceManager(); + if (fpRefMgr != null) + { + ISystemFilterPoolReference[] fpRefs = fpRefMgr.getSystemFilterPoolReferences(); + if (fpRefs != null) + { + for (int idx = 0; idx < fpRefs.length; idx++) + fpRefs[idx].removeReference(); + } + } + + // fire model change event in case any BP code is listening... + SystemPlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_REMOVED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_SUBSYSTEM, subsystem, null); + return true; + } + + /** + * Renames a subsystem. This is better than ss.setName(String newName) as it saves the subsystem to disk. + */ + public void renameSubSystem(ISubSystem subsystem, String newName) + { + subsystem.setName(newName); + try + { + subsystem.commit(); + } + catch (Exception exc) + { + } + } + + /** + * 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. + *

    + * 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. + *

    + * This method is from the ISystemNewFilterActionConfigurator interface + */ + public void configureNewFilterAction(SystemNewFilterAction newFilterAction, Object callerData) + { + //System.out.println("Inside configureNewFilterAction! It worked!"); + newFilterAction.setFromRSE(true); + boolean showFilterPools = 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("SubSystemFactoryImpl::getSubSystemActions - getReferencedSystemFilterPools returned array of length zero."); + // 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; + SystemFilterPoolWrapperInformation poolWrapperInfo = getNewFilterWizardPoolWrapperInformation(); + ISystemProfile[] activeProfiles = SystemPlugin.getTheSystemRegistry().getActiveSystemProfiles(); + ISystemProfile activeProfile = selectedSubSystem.getHost().getSystemProfile(); + for (int idx = 0; idx < activeProfiles.length; idx++) + { + ISystemFilterPool defaultPool = getDefaultSystemFilterPool(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); + } + } + } + /** + * Overridable entry for child classes to supply their own flavour of ISystemFilterPoolWrapperInformation for + * the new filter wizards. + */ + protected SystemFilterPoolWrapperInformation getNewFilterWizardPoolWrapperInformation() + { + return new SystemFilterPoolWrapperInformation(SystemResources.RESID_NEWFILTER_PAGE2_PROFILE_LABEL, SystemResources.RESID_NEWFILTER_PAGE2_PROFILE_TOOLTIP, + SystemResources.RESID_NEWFILTER_PAGE2_PROFILE_VERBAGE); + } + + /** + * Disconnect all subsystems currently connected. + * Called by shutdown() of SystemPlugin. + */ + public void disconnectAllSubSystems() throws Exception + { + ISubSystem[] subsystems = getSubSystems(false); //// false=> lazy get; don't restore from disk if not already + if (subsystems != null) + { + //System.out.println("DISCONNECT ALL FOR "+getClass().getName()+", #subsystems = " + subsystems.length); + for (int idx = 0; idx < subsystems.length; idx++) + { + ISubSystem ss = subsystems[idx]; + if (ss.isConnected()) + { + try + { + ss.getConnectorService().disconnect(); + } + catch (Exception exc) + { + } + } + } + } + else + { + //System.out.println("DISCONNECT ALL FOR "+getClass().getName()+", #subsystems = 0"); + } + } + + + + // --------------------------------- + // FILTER FRAMEWORK METHODS... + // --------------------------------- + + /** + * OVERRIDABLE METHOD FOR CHILD CLASSES TO ENABLE THEM TO CREATE A DEFAULT POOL + * WHENEVER A NEW FILTER POOL MANAGER IS CREATED (EG, WHEN PROFILE CREATED). + *

    + * You should only pre-populate your default filter pool if this new manager + * (eg, its really a profile) is the user's private own. Call {@link #isUserPrivateProfile(ISystemFilterPoolManager)} + * to find out if it is. + */ + protected abstract ISystemFilterPool createDefaultFilterPool(ISystemFilterPoolManager mgr); + + /** + * Return true if the given filter pool manager maps to the private profile for this user. + */ + protected boolean isUserPrivateProfile(ISystemFilterPoolManager mgr) + { + //System.out.println("mgr name = " + mgr.getName()); + //String name = mgr.getName(); + //return name.equalsIgnoreCase("private"); + ISystemProfile profile = getSystemProfile(mgr); + //System.out.println("Testing for user private profile for mgr " + mgr.getName() + ": " + profile.isDefaultPrivate());; + return profile.isDefaultPrivate() || mgr.getName().equalsIgnoreCase("private"); + } + + /** + * Given a subsystem, return the first (hopefully only) default pool for this + * subsystem's profile. + */ + public ISystemFilterPool getDefaultSystemFilterPool(ISubSystem subsys) + { + ISystemFilterPool pool = getDefaultSystemFilterPool(subsys.getSystemProfile()); + /* hopefully this is no longer needed, now that we are into our 2nd release! + if (pool == null) + { + // temporary for pre-default users + String defaultPoolName = "Filters"; + if (subsys.getName().equals("Local Files")) + defaultPoolName = "DefaultFilterPool"; + pool = mgr.getSystemFilterPool(defaultPoolName); + } + */ + //SystemPlugin.logDebugMessage(this.getClass().getName(), "...inside getDefaultFilterPool for "+subsys.getName()+", default pool="+pool); + return pool; + } + /** + * Given a profile, return the first (hopefully only) default pool for this + * profile. + */ + public ISystemFilterPool getDefaultSystemFilterPool(ISystemProfile profile) + { + ISystemFilterPool pool = null; + ISystemFilterPoolManager mgr = getFilterPoolManager(profile); + pool = mgr.getFirstDefaultSystemFilterPool(); // RETURN FIRST + return pool; + } + /** + * Invalidate any internal caches related to filters + */ + public void invalidateFilterCache() + { + filterPoolManagers = null; + } + /** + * Return an array of all filter pool managers owned by this subsystem factory. + * This is a runtime array that only captures those filter pools that have been restored + * as a result of someone calling getFilterPoolManager(SystemProfile). + */ + public ISystemFilterPoolManager[] getFilterPoolManagers() + { + if ((filterPoolManagers == null) || (filterPoolManagers.length != getFilterPoolManagerList().size())) + { + filterPoolManagers = new ISystemFilterPoolManager[getFilterPoolManagerList().size()]; + Iterator i = getFilterPoolManagerList().iterator(); + int idx = 0; + while (i.hasNext()) + filterPoolManagers[idx++] = (ISystemFilterPoolManager) i.next(); + } + return filterPoolManagers; + } + + /** + * Get the filter pool managers for the active profiles. + */ + public ISystemFilterPoolManager[] getActiveFilterPoolManagers() + { + ISystemProfile[] activeProfiles = SystemPlugin.getTheSystemRegistry().getActiveSystemProfiles(); + ISystemFilterPoolManager[] activeManagers = new ISystemFilterPoolManager[activeProfiles.length]; + for (int idx = 0; idx < activeProfiles.length; idx++) + { + activeManagers[idx] = getFilterPoolManager(activeProfiles[idx]); + } + return activeManagers; + } + + /** + * Get the filter pool manager for the given profile + */ + public ISystemFilterPoolManager getFilterPoolManager(ISystemProfile profile) + { + // it is important to key by profile object not profile name, since that + // name can change but the object never should for any one session. + ISystemFilterPoolManager mgr = (ISystemFilterPoolManager) filterPoolManagersPerProfile.get(profile); + //System.out.println("in getFilterPoolManager for ssfactory "+getId()+" for profile " + profile.getName() + ", mgr found? " + (mgr!=null)); + if (mgr == null) + { + try + { + mgr = SystemFilterPoolManager.createSystemFilterPoolManager(profile, SystemPlugin.getDefault().getLogger(), this, // the caller + getFilterPoolManagerName(profile), // the filter pool manager name + supportsNestedFilters(), // whether or not nested filters are allowed + ISystemFilterSavePolicies.SAVE_POLICY_ONE_FILE_PER_FILTER, filterNamingPolicy); + mgr.setSingleFilterStringOnly(!supportsMultipleFilterStrings()); + } + catch (Exception exc) + { + SystemBasePlugin.logError("Restore/Creation of SystemFilterPoolManager " + getFilterPoolManagerName(profile) + " failed!", exc); + SystemMessageDialog.displayExceptionMessage(null, exc); + return null; // something very bad happend! + } + if (mgr == null) + { + SystemBasePlugin.logError("Restore/Creation of SystemFilterPoolManager " + getFilterPoolManagerName(profile) + " failed!", null); + return null; // something very bad happend! + } + + addFilterPoolManager(profile, mgr); + + boolean restored = mgr.wasRestored(); + //System.out.println("...after createSystemFilterPoolManager for " + mgr.getName() + ", restored = " + restored); + + // allow subclasses to create default filter pool... + if (!restored) + { + ISystemFilterPool defaultPool = createDefaultFilterPool(mgr); + if (defaultPool != null) + { + defaultPool.setDefault(true); + try + { + SystemPlugin.getThePersistenceManager().commit(defaultPool); + } + catch (Exception exc) + { + } + } + } + // else filter pools restored for this profile. Allow subclasses chance to do post-processing, + // such as any migration needed + else + { + if (doPostRestoreProcessing(mgr)) + { + try + { + mgr.commit(); + } + catch (Exception exc) + { + } + } + } + // these should be inside the above logic but we need them outside for now because they were + // added late and there are existing filter pool managers that need this to be set for. + // In a future release we should move them inside the if (!restored) logic. Phil. + if (supportsDuplicateFilterStrings()) + mgr.setSupportsDuplicateFilterStrings(true); + if (isCaseSensitive()) + mgr.setStringsCaseSensitive(isCaseSensitive()); + } + return mgr; + } + /** + * Do post-restore-processing of an existing filter pool manager. + * This is where child classes do any required migration work. By default, we do nothing. + *

    + * You can query the release of the filter pool managers, filter pools and filters, by querying the + * release attribute via getRelease().getValue(). You can compare to the current release number using + * the CURRENT_RELEASE constant in ISystemConstants. + * @return false if no changes made. True if changes made, and hence save required. + */ + protected boolean doPostRestoreProcessing(ISystemFilterPoolManager restoredFilterPoolMgr) + { + return false; + } + + /** + * Copy the filter pool manager and return a new one. Called during profile-copy operations. + * Will also copy all of the filter pools and their respective data. + */ + public ISystemFilterPoolManager copyFilterPoolManager(ISystemProfile oldProfile, ISystemProfile newProfile) throws Exception + { + + ISystemFilterPoolManager oldMgr = getFilterPoolManager(oldProfile); // will restore it if necessary + + ISystemFilterPoolManager mgr = SystemFilterPoolManager.createSystemFilterPoolManager(newProfile, SystemPlugin.getDefault().getLogger(), this, // the caller + getFilterPoolManagerName(newProfile), // the filter pool manager name + supportsNestedFilters(), // whether or not nested filters are allowed + ISystemFilterSavePolicies.SAVE_POLICY_ONE_FILE_PER_FILTER, filterNamingPolicy); + mgr.setStringsCaseSensitive(oldMgr.areStringsCaseSensitive()); + mgr.setSupportsDuplicateFilterStrings(oldMgr.supportsDuplicateFilterStrings()); + addFilterPoolManager(newProfile, mgr); + oldMgr.copySystemFilterPools(mgr); + return mgr; + } + + /** + * Get the filter pool manager for the given profile. + * REQUIRED BY SYSTEMFILTERPOOLMANAGERPROVIDER INTERFACE + */ + public ISystemFilterPoolManager getSystemFilterPoolManager(String mgrName) + { + ISystemProfile profile = getSystemProfile(mgrName); + if (profile != null) + { + return getFilterPoolManager(profile); + } + return null; + } + + /** + * Get the filter pool manager for the given profile. + * REQUIRED BY SYSTEMFILTERPOOLMANAGERPROVIDER INTERFACE + */ + public ISystemFilterPoolManager[] getSystemFilterPoolManagers() + { + return getActiveFilterPoolManagers(); + } + /** + * Return all the manager objects this provider owns, to which it wants + * to support referencing from the given filter reference manager. + *

    + * Called by SystemFilterPoolReferenceManager. + *

    + * REQUIRED BY SYSTEMFILTERPOOLMANAGERPROVIDER INTERFACE + */ + public ISystemFilterPoolManager[] getReferencableSystemFilterPoolManagers(ISystemFilterPoolReferenceManager refMgr) + { + return getActiveFilterPoolManagers(); + } + + /** + * Last chance call, by a filter pool reference manager, when a reference to a filter + * pool is found but the referenced master filter pool is not found in those the reference + * manager by getSystemFilterPoolManagers(). + *

    + * If this returns null, then this broken reference will be deleted + *

    + * REQUIRED BY SYSTEMFILTERPOOLMANAGERPROVIDER INTERFACE + */ + public ISystemFilterPool getSystemFilterPoolForBrokenReference(ISystemFilterPoolReferenceManager callingRefMgr, String missingPoolMgrName, String missingPoolName) + { + ISystemFilterPool match = null; + ISystemRegistry sr = SystemPlugin.getTheSystemRegistry(); + ISystemProfile profile = sr.getSystemProfile(missingPoolMgrName); + if (profile != null) + { + match = getFilterPoolManager(profile).getSystemFilterPool(missingPoolName); + } + if (match != null) // log and issue warning + { + ISubSystem ss = ((ISubSystem) callingRefMgr.getProvider()); + // only issue the warning if it is NOT for a reference to a filter pool in the same profile as the + // the one we are restoring. That is, we should not issue warnings about our own references when + // restoring the subsystems for an inactive profile, as happens when an inactive profile is deleted, + // for example. Defect 42675. Phil. + if (ss.getSystemProfile() != profile) // if restoring subsystem's profile != found pool's profile + { + IHost conn = ss.getHost(); + String connectionName = conn.getSystemProfileName() + "." + conn.getAliasName(); + SystemMessage sysMsg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_LOADING_PROFILE_SHOULDBE_ACTIVATED); + sysMsg.makeSubstitution(missingPoolMgrName, connectionName); + SystemBasePlugin.logWarning(sysMsg.getFullMessageID() + ": " + sysMsg.getLevelOneText()); + if (brokenReferenceWarningsIssued.get(missingPoolMgrName) == null) + { + SystemMessageDialog msgDlg = new SystemMessageDialog(null, sysMsg); + msgDlg.open(); + brokenReferenceWarningsIssued.put(missingPoolMgrName, Boolean.TRUE); // only issue once per inactive profile + } + } + } + return match; + } + + + /** + * Add the given filter pool manager object to internal lists + */ + protected void addFilterPoolManager(ISystemProfile profile, ISystemFilterPoolManager mgr) + { + filterPoolManagersPerProfile.put(profile, mgr); + getFilterPoolManagerList().add(mgr); // MOF generated list + invalidateFilterCache(); // force regen of any cached lists + } + /** + * Get the filter pool manager for the given filter pool + */ + protected ISystemFilterPoolManager getFilterPoolManager(ISystemFilterPool pool) + { + return pool.getSystemFilterPoolManager(); + } + /** + * Get the filter pool manager for the given filter pool or filter + */ + protected ISystemFilterPoolManager getFilterPoolManager(ISystemFilterContainer poolOrFilter) + { + return poolOrFilter.getSystemFilterPoolManager(); + } + /** + * Get the filter pool manager for the given reference to a filter pool or filter + */ + protected ISystemFilterPoolManager getFilterPoolManager(ISystemFilterContainerReference poolOrFilterReference) + { + return getFilterPoolManager(poolOrFilterReference.getReferencedSystemFilterContainer()); + } + /** + * Get the filter pool manager for the given connection + */ + protected ISystemFilterPoolManager getFilterPoolManager(IHost conn) + { + return getFilterPoolManager(conn.getSystemProfile()); + } + + /** + * Return the name of the filter pool manager, given the profile. + */ + protected String getFilterPoolManagerName(ISystemProfile profile) + { + return profile.getName(); + } + /** + * Return the name of the profile, given the filter pool manager + */ + protected String getSystemProfileName(ISystemFilterPoolManager manager) + { + return manager.getName(); + } + /** + * Delete the filter pool manager associated with the given profile + */ + protected void deleteFilterPoolManager(ISystemProfile profile) + { + ISystemFilterPoolManager mgr = (ISystemFilterPoolManager) filterPoolManagersPerProfile.get(profile); + if (mgr != null) + { + mgr.deleteAllSystemFilterPools(); // blow 'em all away, and de-reference anybody referencing any of them + filterPoolManagersPerProfile.remove(profile); + } + getFilterPoolManagerList().remove(mgr); + invalidateFilterCache(); + } + /** + * Rename the filter pool manager associated with the given profile + */ + public void renameFilterPoolManager(ISystemProfile profile) + { + ISystemFilterPoolManager mgr = (ISystemFilterPoolManager) filterPoolManagersPerProfile.get(profile); + if (mgr != null) + { + mgr.setName(getFilterPoolManagerName(profile)); + } + } + + // ------------------------------------------------ + // HELPER METHODS TO SIMPLY EVENT FIRING... + // ------------------------------------------------ + + /** + * Helper method to fire an event... + */ + protected void fireEvent(SystemResourceChangeEvent event) + { + SystemPlugin.getTheSystemRegistry().fireEvent(event); + } + /** + * Helper method to create and then fire an event... + */ + protected void fireEvent(Object src, int eventId, Object parent) + { + fireEvent(createEvent(src, eventId, parent)); + } + /** + * Helper method to create and then fire an event with a position or delta... + */ + protected void fireEvent(Object[] multiSrc, int eventId, Object parent, int delta) + { + fireEvent(createEvent(multiSrc, eventId, parent, delta)); + } + + /** + * Helper method to create a single-source event + */ + protected SystemResourceChangeEvent createEvent(Object src, int eventId, Object parent) + { + return new SystemResourceChangeEvent(src, eventId, parent); + } + /** + * Helper method to create a multi-source event + */ + protected SystemResourceChangeEvent createEvent(Object[] src, int eventId, Object parent) + { + return new SystemResourceChangeEvent(src, eventId, parent); + } + /** + * Helper method to create a multi-source event + */ + protected SystemResourceChangeEvent createEvent(Object[] src, int eventId, Object parent, int delta) + { + SystemResourceChangeEvent event = new SystemResourceChangeEvent(src, eventId, parent); + event.setPosition(delta); + return event; + } + + /** + * Fire given event to the given subsystem + */ + protected void fireSubSystemEvent(SystemResourceChangeEvent event, ISubSystem subsystem) + { + event.setGrandParent(subsystem); + fireEvent(event); + } + + /** + * Fire given event to all currently known subsystems + */ + protected void fireSubSystemEvent(SystemResourceChangeEvent event) + { + ISubSystem[] subsystems = getSubSystems(false); // false=> lazy get; don't restore from disk if not already + for (int idx = 0; idx < subsystems.length; idx++) + fireSubSystemEvent(event, subsystems[idx]); + } + + /** + * Fire given event to all subsystems in the given profile + */ + protected void fireSubSystemEvent(SystemResourceChangeEvent event, ISystemProfile profile) + { + String profileName = profile.getName(); + ISubSystem[] allSubSystems = getSubSystems(false); // false=> lazy get; don't restore from disk if not already + for (int idx = 0; idx < allSubSystems.length; idx++) + { + if (allSubSystems[idx].getSystemProfile().getName().equals(profileName)) + fireSubSystemEvent(event, allSubSystems[idx]); + } + } + /** + * Fire an event of a given id to subsystems that hold a reference to the given filter + */ + protected void fireSubSystemFilterEvent(int eventId, ISystemFilter filter) + { + SystemResourceChangeEvent event = createEvent(filter, eventId, null); + fireSubSystemFilterEvent(event, filter); + } + + /** + * Fire an event of a given id to subsystems that hold a reference to the given filter + */ + protected void fireSubSystemFilterEvent(int eventId, ISystemFilter[] filters) + { + if (filters.length > 0) + { + SystemResourceChangeEvent event = createEvent(filters, eventId, null); + fireSubSystemFilterEvent(event, filters[0]); + } + } + /** + * Fire an event of a given id to subsystems that hold a reference to the given filter + */ + protected void fireSubSystemFilterEvent(SystemResourceChangeEvent event, ISystemFilter filter) + { + // STEP 1: FIND ALL SUBSYSTEMS THAT CONTAIN A REFERENCE TO THIS FILTER'S POOL + ISystemFilterPool pool = filter.getParentFilterPool(); + ISubSystem[] subsystems = getSubSystems(pool); + if ((subsystems != null) && (subsystems.length > 0)) + { + // STEP 2: FOR EACH AFFECTED SUBSYSTEM FIRE AN EVENT... + // ... TRICKY PART ==> WHO IS THE PARENT? MIGHT BE A FILTER (IF NESTED), A FILTER POOL OR A SUBSYSTEM (IF NOT SHOWING FILTER POOLS) + ISystemFilterContainer parent = filter.getParentFilterContainer(); + boolean nested = !(parent instanceof ISystemFilterPool); + ISystemFilter nestedParentFilter = nested ? (ISystemFilter) parent : null; + for (int idx = 0; idx < subsystems.length; idx++) + { + // CASE 1: FILTER IS NOT NESTED, SO SIMPLY GET ITS FILTER POOL REFERENCE AND USE AS A PARENT... + if (!nested) + { + // SPECIAL CASE 1A: it makes a difference if we are showing filter pools or not... + if (showFilterPools()) + event.setParent(subsystems[idx].getSystemFilterPoolReferenceManager().getReferenceToSystemFilterPool(pool)); + else + event.setParent(subsystems[idx]); + fireSubSystemEvent(event, subsystems[idx]); + } + // CASE 2: FILTER IS NESTED, THIS IS MORE DIFFICULT, AS EVERY FILTER CONTAINS A RANDOMLY + // GENERATED REFERENCE THAT ONLY THE GUI KNOWS ABOUT. + // ONLY OPTION IS TO LET THE GUI FIGURE IT OUT. + else + { + event.setParent(nestedParentFilter); + fireSubSystemEvent(event, subsystems[idx]); + } + } + } + } + + /* + * Fire an event of a given id to subsystems that hold a reference to the given filter string + */ + protected void fireSubSystemFilterEvent(int eventId, ISystemFilterString filterString) + { + SystemResourceChangeEvent event = createEvent(filterString, eventId, null); + fireSubSystemFilterEvent(event, filterString); + } + + /* + * Fire an event of a given id to subsystems that hold a reference to the given filter string + */ + protected void fireSubSystemFilterEvent(int eventId, ISystemFilterString[] filterStrings, int delta) + { + if (filterStrings.length > 0) + { + SystemResourceChangeEvent event = createEvent(filterStrings, eventId, null, delta); + //event.setPosition(delta); + fireSubSystemFilterEvent(event, filterStrings[0]); + } + } + /* + * Fire an event of a given id to subsystems that hold a reference to the given filter string + */ + protected void fireSubSystemFilterEvent(SystemResourceChangeEvent event, ISystemFilterString filterString) + { + // STEP 1: FIND ALL SUBSYSTEMS THAT CONTAIN A REFERENCE TO THIS FILTER STRING FILTER'S POOL + ISystemFilter filter = filterString.getParentSystemFilter(); + ISystemFilterPool pool = filter.getParentFilterPool(); + ISubSystem[] subsystems = getSubSystems(pool); + if ((subsystems != null) && (subsystems.length > 0)) + { + // STEP 2: FOR EACH AFFECTED SUBSYSTEM FIRE AN EVENT... + // ... TRICKY PART ==> WHO IS THE PARENT? WELL, EASY REALLY, IT IS ALWAYS THE PARENT FILTER! + event.setParent(filter); + for (int idx = 0; idx < subsystems.length; idx++) + { + fireSubSystemEvent(event, subsystems[idx]); + } + } + } + + // ------------------------------------------------ + // FILTER POOL MANAGER PROVIDER CALLBACK METHODS... + // ------------------------------------------------ + + // --------------------- + // FILTER POOL EVENTS... + // --------------------- + /** + * A new filter pool has been created + */ + public void filterEventFilterPoolCreated(ISystemFilterPool newPool) + { + //fireEvent(newPool, EVENT_ADD, this); // hmm, might not need to do this since we only work on references? + + // fire model change event in case any BP code is listening... + SystemPlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_ADDED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_FILTERPOOL, newPool, null); + } + /** + * A filter pool has been deleted + */ + public void filterEventFilterPoolDeleted(ISystemFilterPool oldPool) + { + //fireEvent(oldPool, EVENT_DELETE, this); currently called by SystemView's delete support + + // fire model change event in case any BP code is listening... + SystemPlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_REMOVED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_FILTERPOOL, oldPool, null); + } + /** + * A filter pool has been renamed + */ + public void filterEventFilterPoolRenamed(ISystemFilterPool pool, String oldName) + { + //fireEvent(pool, EVENT_RENAME, this); subsystem handles in firing of reference rename + + // fire model change event in case any BP code is listening... + SystemPlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_RENAMED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_FILTERPOOL, pool, oldName); + } + /** + * One or more filter pools have been re-ordered within their manager + */ + public void filterEventFilterPoolsRePositioned(ISystemFilterPool[] pools, int delta) + { + fireEvent(pools, ISystemResourceChangeEvents.EVENT_MOVE_MANY, this, delta); + + // fire model change event in case any BP code is listening... + if (pools!=null) + for (int idx=0; idx 0)) + { + SystemResourceChangeEvent event = createEvent(filters, ISystemResourceChangeEvents.EVENT_MOVE_FILTER_REFERENCES, null); + event.setPosition(delta); + fireSubSystemFilterEvent(event, filters[0]); + // fire model change event in case any BP code is listening... + for (int idx=0; idx0)) + SystemPlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_CHANGED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_FILTER, filterStrings[0].getParentSystemFilter(), null); + } + + // --------------------------------- + // FILTER POOL METHODS... + // --------------------------------- + + /** + * Returns a filter pool, given its profile and pool name + */ + public ISystemFilterPool getFilterPool(ISystemProfile profile, String name) + { + return getFilterPoolManager(profile).getSystemFilterPool(name); + } + /** + * Returns an array of filter pool objects within a profile. + */ + public ISystemFilterPool[] getFilterPools(ISystemProfile profile) + { + return getFilterPoolManager(profile).getSystemFilterPools(); + } + + /** + * Given a filter, decide whether to show the Filter Strings property page + * for this filter. Default is true. + */ + public boolean showChangeFilterStringsPropertyPage(ISystemFilter filter) + { + return true; + } + // --------------------------------- + // FILTER POOL REFERENCE METHODS... + // --------------------------------- + /** + * Test if any filter pools in the given profile are referenced by other profiles, + * which are active. + *

    + * Called when user tries to make a profile inactive. We prevent this if there exists + * active references. + * @param profile The profile being tested + * @return An array of the active subsystems which reference filter pools in this profile, + * or null if none are found. + */ + public ISubSystem[] testForActiveReferences(ISystemProfile profile) + { + Vector v = new Vector(); + ISystemProfileManager profileMgr = SystemProfileManager.getSystemProfileManager(); + ISystemFilterPoolManager sfpm = getFilterPoolManager(profile); + String profileName = profile.getName(); + if (sfpm != null) + { + ISystemFilterPool[] pools = sfpm.getSystemFilterPools(); + if ((pools != null) && (pools.length > 0)) + { + for (int idx = 0; idx < pools.length; idx++) + { + ISystemBaseReferencingObject[] refs = pools[idx].getReferencingObjects(); + if ((refs != null) && (refs.length > 0)) + { + for (int jdx = 0; jdx < refs.length; jdx++) + { + if (refs[jdx] instanceof ISystemFilterPoolReference) + { + ISystemFilterPoolReference fpRef = (ISystemFilterPoolReference) refs[jdx]; + //SystemFilterPoolReferenceManager fpRefMgr = fpRef.getFilterPoolReferenceManager(); + ISubSystem subsystem = (ISubSystem) fpRef.getProvider(); + String ssProfileName = subsystem.getSystemProfileName(); + if ((!ssProfileName.equals(profileName)) && (profileMgr.isSystemProfileActive(ssProfileName))) + { + v.addElement(subsystem); + } + } + } + } + } + } + } + + ISubSystem[] referencingSubSystems = null; + if (v.size() > 0) + { + referencingSubSystems = new ISubSystem[v.size()]; + for (int idx = 0; idx < referencingSubSystems.length; idx++) + referencingSubSystems[idx] = (ISubSystem) v.elementAt(idx); + } + + return referencingSubSystems; + } + + + + // --------------------------------- + // FILTER METHODS + // --------------------------------- + + /** + * Return the translated string to show in the property sheet for the type property. + */ + public String getTranslatedFilterTypeProperty(ISystemFilter selectedFilter) + { + if (translatedFilterType == null) + //translatedFilterType = "Remote system filter"; + translatedFilterType = SystemPropertyResources.RESID_PROPERTY_FILTERTYPE_VALUE; + return translatedFilterType; + } + /* + * Return the translated string to show in the property sheet for the type property when a filter string is selected. + * + public String getTranslatedFilterStringTypeProperty(SystemFilterString selectedFilterString) + { + if (translatedFilterStringType == null) + //translatedFilterType = "Remote system filter string"; + translatedFilterStringType = SystemResources.RESID_PROPERTY_FILTERSTRINGTYPE_VALUE); + return translatedFilterStringType; + }*/ + + /** + * Return true if we should show the refresh action in the popup for the given element. + */ + public boolean showRefreshOnFilter() + { + return true; + } + + /** + * Return true if we should show the show in table action in the popup for the given element. + */ + public boolean showGenericShowInTableOnFilter() + { + return true; + } + + /* + * Overridable method to return the actions for creating a new filter string in a filter. + * By default returns one action created by calling {@link #getNewFilterStringAction(SystemFilter, Shell)}. + *

    + * If you have multiple actions for creating new filter strings, override this. + *

    + * If you have only a single action for creating new filter strings, override getNewFilterStringAction (without the 's'). + *

    + * @param selectedFilter the currently selected filter + * @param shell parent shell of viewer where the popup menu is being constructed + * + protected IAction[] getNewFilterStringActions(SystemFilter selectedFilter, Shell shell) + { + IAction[] actions = null; + IAction newAction = getNewFilterStringAction(selectedFilter, shell); + if (newAction != null) + { + actions = new IAction[1]; + actions[0] = newAction; + } + return actions; + }*/ + + /* + * Overridable method to return the single action for creating a new filter string in a filter. + * By default returns a new SystemDefaultNewFilterAction. + *

    + * If you have multiple actions for creating new filters, override getNewFilterStringActions (note the 's'). + *

    + * If you have only a single action for creating new filters, override this. + *

    + * @param filter the currently selected filter + * @param shell parent shell of viewer where the popup menu is being constructed + * + protected IAction getNewFilterStringAction(SystemFilter selectedFilter, Shell shell) + { + //SystemFilterDefaultNewFilterStringAction action = + // new SystemFilterDefaultNewFilterStringAction(shell, selectedFilter); + //return action; + return null; + }*/ + + /** + * Overridable entry for child classes to contribute a server launcher instance + * for a given subsystem. + *

    + * Create an instance of ServerLauncher, and add it to the given subsystem. + * When a subsystem is created, and {@link #supportsServerLaunchProperties()} + * returns true, this method is called to create the server launcher instance + * associated with the subsystem. The default implementation is to create an + * instance of {@link IIBMServerLauncher}, but override to create your own + * ServerLauncher instance if you have your own class. + */ + public IServerLauncherProperties createServerLauncher(IConnectorService connectorService) + { + IIBMServerLauncher sl = new IBMServerLauncher("IBM Server Launcher", connectorService); + String systemType = connectorService.getHostType(); + + if (systemType.equals(ISystemTypes.SYSTEMTYPE_LINUX) || + systemType.equals(ISystemTypes.SYSTEMTYPE_POWER_LINUX) || + systemType.equals(ISystemTypes.SYSTEMTYPE_ZSERIES_LINUX)) { + sl.setServerScript(IBMServerLauncherConstants.LINUX_REXEC_SCRIPT); + } + else if (systemType.equals(ISystemTypes.SYSTEMTYPE_UNIX) || + systemType.equals(ISystemTypes.SYSTEMTYPE_AIX)) { + sl.setServerScript(IBMServerLauncherConstants.UNIX_REXEC_SCRIPT); + } + + sl.saveToProperties(); + return sl; + } + /** + * Return the form used in the property page, etc for this server launcher. + * Only called if {@link #supportsServerLaunchProperties()} returns true. + *

    + * We return {@link org.eclipse.rse.ui.widgets.ServerLauncherForm}. + * Override if appropriate. + */ + public IServerLauncherForm getServerLauncherForm(Shell shell, ISystemMessageLine msgLine) + { + return new IBMServerLauncherForm(shell, msgLine); + } + + // ------------------------------------------ + // SAVE METHODS... + // ------------------------------------------ + /** + * Saves absolutely everything to disk. This is called as a safety + * measure when the workbench shuts down. + *

    + * Totally handled for you! + *

    + * Calls saveSubSystems() and saveFilterPools() + *

    + * Exceptions are swallowed since we can deal with them on shutdown anyway! + */ + public boolean commit() + { + boolean ok = false; + try + { + saveSubSystems(); + saveFilterPools(); + ok = true; + } + catch (Exception exc) + { + } + return ok; + } + + /** + * Save all subsystems for all connections to disk. + * The default implementation for this iterates all subsystem instances, + * and calls saveSubSystem for each. + *

    + * If you handle your own save action versus using MOF, then override saveSubSystem(SubSystem) + * versus this method. + *

    + * Attempts to save all of them, swallowing exceptions, then at the end throws the last exception caught. + */ + public void saveSubSystems() throws Exception + { + saveSubSystems(null); + } + + /** + * Save all subsystems for a given connection to disk. + * The default implementation for this iterates all subsystem instances for that connection, + * and calls saveSubSystem for each. + *

    + * If you handle your own save action versus using MOF, then override saveSubSystem(SubSystem) + * versus this method. + *

    + * Attempts to save all of them, swallowing exceptions, then at the end throws the last exception caught. + */ + public void saveSubSystems(IHost conn) throws Exception + { + Exception lastException = null; + ISubSystem[] subsystems = null; + if (conn != null) + subsystems = getSubSystems(conn, ISubSystemConfiguration.LAZILY); + else + subsystems = getSubSystems(false); // false=> lazy get; don't restore from disk if not already + if (subsystems == null) + return; + for (int idx = 0; idx < subsystems.length; idx++) + { + try + { + saveSubSystem(subsystems[idx]); + } + catch (Exception exc) + { + lastException = exc; + } + } + if (lastException != null) + throw lastException; + } + + /** + * Attempt to save single subsystem to disk. + * Uses MOF to save the given subsystem object. + *

    + * Calls get saveFileName on the subsystem object to determine what file name to save to. + *

    + * You need only override if you do not use MOF! + */ + public void saveSubSystem(ISubSystem subsys) throws Exception + { + subsys.commit(); + } + + /** + * Saves all filter information to disk for all profiles. + *

    + * This method is handled for you. If you do override, please call super.saveFilterPools. + */ + public boolean saveFilterPools() throws Exception + { + boolean ok = true; + ISystemFilterPoolManager[] poolManagers = getFilterPoolManagers(); + Exception lastException = null; + if (poolManagers != null) + for (int idx = 0; idx < poolManagers.length; idx++) + { + try + { + saveFilterPools(poolManagers[idx]); + } + catch (Exception exc) + { + ok = false; + lastException = exc; + } + } + if (lastException != null) + throw lastException; + return ok; + } + /** + * Saves all filter information to disk for the given profile. + *

    + * This method is handled for you. If you do override, please call super.saveFilterPools. + */ + public void saveFilterPools(ISystemFilterPoolManager mgr) throws Exception + { + try + { + mgr.commit(); + } + catch (Exception exc) + { + handleException("Exception saving filter pools for manager " + mgr.getName(), exc); + throw exc; + } + } + + // used in the case where newsubsystems are added after a connection exists + public ISubSystem createSubsystemAfterTheFact(IHost conn) + { + ISubSystem subsys = createSubSystemInternal(conn); + if (subsys != null) + { + internalInitializeNewSubsystem(subsys, conn); + if (supportsFilters()) + { + // We create a filter pool reference manager object to manage the filter pool references + // that are stored with a subsystem. + //SystemFilterPoolManager[] relatedFilterPoolManagers = + // getReferencableFilterPoolManagers(conn.getSystemProfile()); + ISystemFilterPoolReferenceManager fprMgr = SystemFilterStartHere.createSystemFilterPoolReferenceManager(subsys, this, subsys.getName(), filterNamingPolicy); + subsys.setFilterPoolReferenceManager(fprMgr); + ISystemFilterPoolManager defaultFilterPoolManager = getFilterPoolManager(conn.getSystemProfile()); + fprMgr.setDefaultSystemFilterPoolManager(defaultFilterPoolManager); + } + initializeSubSystem(subsys, null); + try + { + saveSubSystem(subsys); + } + catch (Exception exc) + { + SystemBasePlugin.logError("Error saving new subsystem " + subsys.getName(), exc); + } + addSubSystem(subsys); // only add to list even if save was not successful. + //if (lastExc != null) + //throw lastExc; + + } + return subsys; + } + + /** + * Return true if the subsystems for a given connection have been restored yet or not + */ + protected boolean subSystemsHaveBeenRestored(IHost connection) + { + return (subSystemsRestoredFlags.get(connection) != null); + } + + /** + * Get all the filter pool managers for all the profiles, active or not. + * Why do this? Because we need to in order to allow cross references from + * one subsystem in one profile to filter pools in any other profile. + */ + public ISystemFilterPoolManager[] restoreAllFilterPoolManagersForAllProfiles() + { + ISystemProfile[] profiles = SystemStartHere.getSystemProfileManager().getSystemProfiles(); + ISystemFilterPoolManager[] allMgrs = new ISystemFilterPoolManager[profiles.length]; + for (int idx = 0; idx < profiles.length; idx++) + { + allMgrs[idx] = getFilterPoolManager(profiles[idx]); + } + return allMgrs; + } + + + + + /** + * Called by adapters prior to asking for actions, in case the connection of the currently selected + * object is required by the action. + */ + public void setConnection(IHost connection) + { + this.currentlySelectedConnection = connection; + } + /** + * Called by adapters prior to asking for actions. For cases when current selection is needed. + */ + public void setCurrentSelection(Object[] selection) + { + this.currentlySelected = selection; + } + + // --------------------------------- + // PRIVATE METHODS... + // --------------------------------- + protected void handleException(String msg, Exception exc) + { + SystemBasePlugin.logError(msg, exc); + } + + + // ------------------ + // UTILITY METHODS... + // ------------------ + /** + * Helper method to return the message "Connecting to &1..." + */ + public static String getConnectingMessage(String hostName, int port) + { + SystemMessage msg = null; + if (port > 0) + { + msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_CONNECTWITHPORT_PROGRESS); + msg.makeSubstitution(hostName, Integer.toString(port)); + } + else + { + msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_PROGRESS); + msg.makeSubstitution(hostName); + } + return msg.getLevelOneText(); + } + /** + * Helper method to return the message "Disconnecting from &1..." + */ + public static String getDisconnectingMessage(String hostName, int port) + { + SystemMessage msg = null; + if (port > 0) + { + msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_DISCONNECTWITHPORT_PROGRESS); + msg.makeSubstitution(hostName, Integer.toString(port)); + } + else + { + msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_DISCONNECT_PROGRESS); + msg.makeSubstitution(hostName); + } + return msg.getLevelOneText(); + } + + /** + * Return the translated name of a default filter pool for a given profile + */ + public static String getDefaultFilterPoolName(String profileName, String factoryId) + { + StringBuffer nameBuf = new StringBuffer(); + nameBuf.append(profileName); + nameBuf.append(":"); + nameBuf.append(factoryId); + /* + String name = SystemResources.RESID_DEFAULT_FILTERPOOL; + StringBuffer profileNameBuffer = new StringBuffer(profileName.toLowerCase()); + profileNameBuffer.setCharAt(0, Character.toUpperCase(profileNameBuffer.charAt(0))); + name = SystemMessage.sub(name, "%1", profileNameBuffer.toString()); + */ + return nameBuf.toString(); + } + + // ----------------- + // COMMON METHODS... + // ----------------- + + /** + * Return object as printable string. + * This is the id plus dot plus the name. + */ + public String toString() + { + return proxy.toString(); + } + + /** + * @generated This field/method will be replaced during code generation + */ + public java.util.List getSubSystemList() + { + if (subSystemList == null) + { + subSystemList = new ArrayList(); + //FIXME new EObjectResolvingeList(SubSystem.class, this, SubsystemsPackage.SUB_SYSTEM_FACTORY__SUB_SYSTEM_LIST); + } + return subSystemList; + } + + /** + * @generated This field/method will be replaced during code generation + */ + public java.util.List getFilterPoolManagerList() + { + if (filterPoolManagerList == null) + { + filterPoolManagerList = new ArrayList(); + //FIXMEnew EObjectContainmenteList(SystemFilterPoolManager.class, this, SubsystemsPackage.SUB_SYSTEM_FACTORY__FILTER_POOL_MANAGER_LIST); + } + return filterPoolManagerList; + } + + public Object getAdapter(Class adapterType) + { + return Platform.getAdapterManager().getAdapter(this, adapterType); + } + + public boolean isDirty() + { + return _isDirty; + } + + public void setDirty(boolean flag) + { + _isDirty = flag; + } + + + + public boolean wasRestored() + { + // factories are never restored from disk + return false; + } + + + + public void setWasRestored(boolean flag) + { + // dummy impl - not required for factories + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystemHelpers.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystemHelpers.java new file mode 100644 index 00000000000..166b1e896f0 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystemHelpers.java @@ -0,0 +1,113 @@ +/******************************************************************************** + * 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.core.subsystems; + +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterContainer; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.model.ISystemProfile; + +/** + * Static helper methods + */ +public class SubSystemHelpers +{ + + /** + * Give a filter pool reference, return parent subsystem + * Returns this:

    (SubSystem)poolReference.getProvider()
    . + */ + public static ISubSystem getParentSubSystem(ISystemFilterPoolReference poolReference) + { + return (ISubSystem)poolReference.getProvider(); + } + + + + + + /** + * Give a filter pool, return parent subsystem factory + */ + public static ISubSystemConfiguration getParentSubSystemFactory(ISystemFilterPool pool) + { + return (ISubSystemConfiguration)pool.getProvider(); + } + + /** + * Give a filter, return parent subsystem factory + */ + public static ISubSystemConfiguration getParentSubSystemFactory(ISystemFilter filter) + { + return (ISubSystemConfiguration)filter.getProvider(); + } + + /** + * Give a filter pool or filter, return parent subsystem factory + */ + public static ISubSystemConfiguration getParentSubSystemFactory(ISystemFilterContainer container) + { + if (container instanceof ISystemFilterPool) + return getParentSubSystemFactory((ISystemFilterPool)container); + else + return getParentSubSystemFactory((ISystemFilter)container); + } + + + /** + * Give a filter pool reference, return parent subsystem factory + */ + public static ISubSystemConfiguration getParentSubSystemFactory(ISystemFilterPoolReference poolRef) + { + ISystemFilterPool pool = poolRef.getReferencedFilterPool(); + if (pool != null) + return getParentSubSystemFactory(pool); + else + return null; + } + + /** + * Give a filter reference, return parent subsystem factory + */ + public static ISubSystemConfiguration getParentSubSystemFactory(ISystemFilterReference filterRef) + { + ISystemFilter filter = filterRef.getReferencedFilter(); + if (filter != null) + return getParentSubSystemFactory(filter); + else + return null; + } + + /** + * Give a filter pool, return its parent filter pool manager + */ + public static ISystemFilterPoolManager getParentSystemFilterPoolManager(ISystemFilterPool pool) + { + return pool.getSystemFilterPoolManager(); + } + /** + * Give a filter pool, return its parent profile + */ + public static ISystemProfile getParentSystemProfile(ISystemFilterPool pool) + { + return getParentSubSystemFactory(pool).getSystemProfile(pool); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/util/ISubsystemConfigurationAdapter.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/util/ISubsystemConfigurationAdapter.java new file mode 100644 index 00000000000..1a216382441 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/util/ISubsystemConfigurationAdapter.java @@ -0,0 +1,244 @@ +/******************************************************************************** + * 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.core.subsystems.util; + +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.filters.ISystemFilter; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolReference; +import org.eclipse.rse.filters.ISystemFilterReference; +import org.eclipse.rse.filters.ISystemFilterString; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.ui.SystemMenuManager; +import org.eclipse.rse.ui.filters.actions.SystemNewFilterAction; +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.widgets.IServerLauncherForm; +import org.eclipse.rse.ui.wizards.ISystemNewConnectionWizardPage; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Shell; + + +public interface ISubsystemConfigurationAdapter +{ + + /** + * 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. + *

    + * 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. + *

    + * This method is from the ISystemNewFilterActionConfigurator interface + */ + public void configureNewFilterAction(ISubSystemConfiguration factory, SystemNewFilterAction newFilterAction, Object callerData); + + + // ----------------------------------- + // WIZARD PAGE CONTRIBUTION METHODS... + // ----------------------------------- + /** + * Optionally return one or more wizard pages to append to the New Connection Wizard if + * the user selects a system type that this subsystem factory supports. + *

    + * Some details: + *

      + *
    • The wizard pages must implement ISystemNewConnectionWizardPage, so as to fit into the wizard's framework + *
    • When the user successfully presses Finish, the createConnection method in the SystemRegistry will call + * your {@link #createSubSystem(IHost,boolean, ISystemNewConnectionWizardPage[])} 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. + *
    + * Tip: consider extending {@link org.eclipse.rse.ui.wizards.AbstractSystemNewConnectionWizardPage} for your wizard page class. + */ + public ISystemNewConnectionWizardPage[] getNewConnectionWizardPages(ISubSystemConfiguration factory, IWizard wizard); + + /** + * 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 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. + * + * @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 factory, SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystem subsystem); + + + // --------------------------------- + // FILTER POOL METHODS... + // --------------------------------- + + /** + * Returns a list of actions for the popup menu when user right clicks on a + * filter pool object within a subsystem of this factory. + * Only supported by subsystems that support filters. + */ + public IAction[] getFilterPoolActions(ISubSystemConfiguration factory, ISystemFilterPool selectedPool, Shell shell); + + // --------------------------------- + // 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 factory. Note, + * these are added to the list returned by getFilterPoolActions(). + *

    + * Only supported by subsystems that support filters. + */ + public IAction[] getFilterPoolReferenceActions(ISubSystemConfiguration factory, ISystemFilterPoolReference selectedPoolReference, Shell shell); + + + // --------------------------------- + // FILTER METHODS + // --------------------------------- + /** + * Returns a list of actions for the popup menu when user right clicks on a + * filter object. + *

    + * Only supported and used by subsystems that support filters. + *

    + * Most actions are handled in this base, except if you have your own action for + * creating a new nested filter. In this case, override getNewFilterAction() + */ + public IAction[] getFilterActions(ISubSystemConfiguration factory, ISystemFilter selectedFilter, Shell shell); + + /** + * 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. + */ + public void customizeChangeFilterPropertyPage(ISubSystemConfiguration factory, SystemChangeFilterPropertyPage page, ISystemFilter selectedFilter, Shell shell); + /** + * 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. + */ + public void customizeFilterStringPropertyPage(ISubSystemConfiguration factory, SystemFilterStringPropertyPage page, ISystemFilterString selectedFilterString, Shell shell); + + + /** + * Prompt the user to create a new filter as a result of the user expanding a promptable + * filter. + * @return the filter created by the user or null if they cancelled the prompting + */ + public ISystemFilter createFilterByPrompting(ISubSystemConfiguration factory, ISystemFilterReference referenceToPromptableFilter, Shell shell) + throws Exception; + + + // --------------------------------- + // 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 factory. + * Only supported and used by subsystems that support filters. + *

    + * Most actions are handled in this base, except if you have your own action for + * creating a new filter. In this case, override getNewFilterAction() + * To add additional actions, override {@link #getFilterReferenceActions(ISystemFilterReference, Shell)}. + * + * @param selectedFilterRef the currently selected filter reference + * @param shell parent shell of viewer where the popup menu is being constructed + */ + public IAction[] getFilterReferenceActions(ISubSystemConfiguration factory, ISystemFilterReference selectedFilterRef, Shell shell); + + /** + * Returns a list of actions for the popup menu when user right clicks on a subsystem object from this factory. + */ + public IAction[] getSubSystemActions(ISubSystemConfiguration factory, ISubSystem selectedSubSystem, Shell shell); + + + + // -------------------------- + // SERVER LAUNCHER METHODS... + // -------------------------- + /** + * Return the form used in the property page, etc for this server launcher. + * Only called if {@link #supportsServerLaunchProperties()} returns true. + */ + public IServerLauncherForm getServerLauncherForm(ISubSystemConfiguration factory, Shell shell, ISystemMessageLine msgLine); + + // -------------------------- + // SUBSYSTEM PROPERTY PAGE METHOD... + // -------------------------- + /* + * Return the form used in the subsyste property page + */ + public ISystemSubSystemPropertyPageCoreForm getSubSystemPropertyPageCoreFrom(ISubSystemConfiguration factory, ISystemMessageLine msgLine, Object caller); + + /** + * Return image descriptor for subsystems created by this factory. Comes from icon attribute in extension point xml + */ + public ImageDescriptor getImage(ISubSystemConfiguration factory); + /** + * Return actual graphics Image of this factory. + * This is the same as calling getImage().createImage() but the resulting image is cached + */ + public Image getGraphicsImage(ISubSystemConfiguration factory); + /** + * Return image to use when this susystem is connection. Comes from icon attribute in extension point xml + */ + public ImageDescriptor getLiveImage(ISubSystemConfiguration factory); + /** + * Return actual graphics LiveImage of this factory. + * This is the same as calling getLiveImage().createImage() but the resulting image is cached + */ + public Image getGraphicsLiveImage(ISubSystemConfiguration factory); + + /** + * Supply the image to be used for filter pool managers, within actions. + * REQUIRED BY SYSTEMFILTERPOOLMANAGERPROVIDER INTERFACE + */ + public ImageDescriptor getSystemFilterPoolManagerImage(); + /** + * Supply the image to be used for filter pools, within actions. + * REQUIRED BY SYSTEMFILTERPOOLMANAGERPROVIDER INTERFACE + */ + public ImageDescriptor getSystemFilterPoolImage(ISystemFilterPool filterPool); + /** + * Supply the image to be used for filters, within actions. + * REQUIRED BY SYSTEMFILTERPOOLMANAGERPROVIDER INTERFACE + */ + public ImageDescriptor getSystemFilterImage(ISystemFilter filter); + /* + * Supply the image to be used for the given filter string, within actions. + * REQUIRED BY SYSTEMFILTERPOOLMANAGERPROVIDER INTERFACE + */ + public ImageDescriptor getSystemFilterStringImage(ISystemFilterString filterString); + + /* + * Supply the image to be used for the given filter string string, within actions. + * REQUIRED BY SYSTEMFILTERPOOLMANAGERPROVIDER INTERFACE + */ + public ImageDescriptor getSystemFilterStringImage(String filterStringString); + + public void renameSubSystemProfile(ISubSystemConfiguration factory, String oldProfileName, String newProfileName); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systemmessages.xml b/rse/plugins/org.eclipse.rse.ui/systemmessages.xml new file mode 100644 index 00000000000..c0d835e7bf0 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systemmessages.xml @@ -0,0 +1,1358 @@ + + + + + + + + + + Under construction + This function is not yet available. + + + This will reload the Remote System Explorer. Are you sure? + This action should only be used after receiving files from a team repository. It reloads the RSE from the workspace, incorporating the new files. + + + An unexpected exception has occurred + %1 + + + Enter name + You must enter a name in the field where the cursor is positioned. + + + Name in use + This name is already used by another resource. Enter a unique name. + + + Name not valid + The name entered does not have valid syntax + + + You must rename %1 + You have left the new name the same as the old name. Enter a new name that is different from the old name. + + + Name %1 is specified more than once + Two or more resources have been renamed to the same new name. Each resource must have a unique name. + + + Name %1 not valid + The name %1 does not have valid syntax + + + Enter new name + You have the new name entry field empty. You must enter a unique new name. + + + Expand failed or canceled. Try again. + When expanding a node in the tree, and retrieving the resources, either an error occurred or you cancelled the operation. The expand is cancelled. + + + Enter profile name + You must enter a name for the profile. Profiles contain all connections, filters and user defined actions. They are shared by the team, but each team member sees only those profiles which are active. Each profile can be private to you, or used by the whole team if all team members make the profile active. The name should reflect this. That is, if the profile is to be private to you, pick a name that is least likely to collide with a name chosen by other team members. + + + Profile of that name already exists + There is already a profile of that name. Choose a unique name for the profile. + + + Not a valid profile name + Profiles are stored as folders in the file system, so profile names must be valid folder names for the workbench. Furthermore, they must not contain pound signs (#) or exceed 100 characters in length. Profile names are not case sensitive, but are case tolerant. + + + Enter number + The value %1 you entered is not numeric. Enter only numeric input. + + + Name not valid as folder name + The name must be a valid folder name within the workbench and the underlying file system. + + + Name not valid as file name + The name must be a valid file name within the workbench and the underlying file system. + + + Enter system type + You must select a system type. The system type is the type of the operating system of the remote sytem. + + + Enter connection name + You must enter a connection name. This name is arbitrary, but must be unique to the selected profile. + + + Connection name is not unique for its profile + Connection names must be unique to the profile that contains the connection. Specify a name not already in use. + + + Not a valid connection name + The connection name is not syntactically valid. The name must be a valid folder name within the workbench and the underlying file system. + + + Enter host name or ip address + You must specify a host name or TCP/IP address for the remote system. + + + Enter user ID + You must specify a user ID to be used to connect to the system. + + + Not a valid user ID + The user ID entered is not syntactically valid. The only restriction for a user ID is that it not use the characters '=' or ';'. + + + Enter port number + You must specify a port number that is used to connect with the server-side communication layer. + + + Not a valid port number + The value you entered is not a valid port number. It must be a positive integer between 1 and 65536. + + + Enter value + You must enter a value in the field where the cursor is. + + + Entry is not unique + The value you entered is already in use. Specify a value that is not already in use. + + + Syntax is not valid + The syntax of the value at the cursor position is not valid. + + + Enter path + You must specify a file system path. + + + Path is not unique + The path you specified is already in use. + + + Path syntax is not valid + The syntax of the path you specified is not valid. Enter a file system path that is valid for the remote operating system. + + + Enter password + You must specify your password. + + + Password has expired + Your password has expired, and must be reset before continuing. + + + Enter filter pool name + You must specify a name for your filter pool. Filter pool names are arbitrary, but typically reflect the contents of the filters, such as "Release 1" or "Accounts Payable". + + + Filter pool name already exists in this profile + A filter pool with this name already exists in the profile. + + + Filter pool name not valid + The filter pool name you specified is not a valid name. The name must be a valid folder name in the workbench, and must not contain the pound sign '#'. It must also not exceed 50 characters in length. + + + Profile name %1 is reserved + The given profile name is reserved by IBM. Specify another name for the profile. + + + Connection of name %1 already exists in profile %2. Continue? + A connection of this name exists in another profile. While this allowed, it is discouraged as it may lead to confusion. Press Yes to create the connection, or No to cancel the creation. + + + Enter filter name + You must specify a name for your filter. You can specify any name you like. Choose a name that tells others the contents of this filter. For example, "Source Files for Release 1". + + + Filter name already exists in this filter pool + The filter name you specified is in use. You must specify a name unique for the parent filter pool. + + + Filter name not valid + The filter name you specified is not a valid name. The name must be a valid file name in the workbench, and must not contain the pound sign '#'. It must also not exceed 100 characters in length. + + + Enter filtering information + You must specify filtering information + + + Filter string already exists + You specified a filter string which already exists in this filter. Having duplicate filter strings will result in duplicate resources in the expanded filter. Specify unique filter strings, preferably which result in unique resources. For example, don't specify both ABC* and A*. + + + Filter string not valid + The filter string you specified is not syntactically correct. + + + Duplicate filter string '%1'. + You have defined the same filter string twice or more. This will result in multiple copies of the same resource, when this filter is expanded. Delete the redundant filter strings. + + + Filter string '%1' already exists in filter %2 + This filter string cannot be copied or moved to the target filter. The same filter string already exists there + + + Save to disk failed with an unexpected exception + %1 + + + Restore of data failed with unexpected exception + %1 + + + Delete selected resources? + This is a permanent deletion of the selected resources and cannot be undone + + + Delete profile '%1'? + Do you want to delete this profile, including all of its connections, filters and user actions? Select Yes to delete, or No to cancel the delete request + + + Connecting to %1 + + + + Connecting to %1 at port %2 + + + + Connect to %1 failed with an unexpected exception + %2 + + + Connect failed. Host %1 not found or not responding + + + + Connect to %1 was cancelled + + + + Disconnecting from %1 + + + + Disconnecting from %1 at port %2 + + + + Disconnect from %1 failed with exception + %2 + + + Disconnect from %1 was cancelled + + + + Unexpected error deleting %1 + %2 + + + Unexpected error renaming %1 + %2 + + + Unexpected error moving %1 + + + + Operation failed with exception '%1' + + + + Operation cancelled. + + + + Warning. Profile '%1' should be made active. Active connection '%2' contains a reference to it. + + + + Warning. Profile '%1' should be active. Active connection '%2' contains a reference to it. + + + + Resolving %1 + + + + Running %1 + + + + Copying '%1' to '%2' + + + + Copying connection %1 + + + + Copying connections + + + + Copying filter pools + + + + Copying filter pool %1 + + + + Copying filters + + + + Copying filter %1 + + + + Copying filter strings + + + + Copying filter string %1 + + + + Copying subsystems + + + + Filter pool(s) successfully copied to '%1'. You must create a new filter pool reference to see it (them). + + + + Moving '%1' to '%2' + + + + Moving connection %1 + + + + Moving connections + + + + Moving filter pools + + + + Moving filter pool %1 + + + + Moving filters + + + + Moving filter %1 + + + + Moving filter strings + + + + Moving filter string %1 + + + + Filter pool(s) successfully moved to '%1'. You must create a new filter pool reference to see it (them). + + + + Setting %1 + + + + Setting properties + + + + Querying %1 + + + + Querying properties + + + + Running %1 + + + + Expand failed. Try again + + + + Expand cancelled. Try again + + + + Empty list + + + + List cancelled + + + + Filter created successfully. Expand this again to create another + + + + Connection %1 not found + No connection named %1 currently exists + + + Profile %1 not found + No profile named %1 currently exists + + + Folder %1 not found on host %2 + + + + File %1 not found on host %2 + + + + File or folder %1 not found on host %2 + + + + Connection created successfully. Expand this again to create another + + + + Connection busy + + + + Command interrupted + + + + Unable to run command + Possible causes: connection has been deleted, connection has been renamed, or connection has been disconnected + + + Command cancelled + + + + Copying... + + + + Moving... + + + + Copying %1... + + + + Moving %1... + + + + Saving %1... + + + + %1 is not a valid archive name. + You must give a filename with an extension that is recognized as a valid archive type extension. + + + Combining to a virtual destination is not supported at this time. Please choose a non-virtual destination. + + + + The archive is corrupted or unreadable. + The archive cannot be opened because its format is unrecognized, or its contents are damaged in some way. + + + Cannot create archive. + There was an error creating the empty archive. The archive was not created. + + + Creation of the virtual file or folder %1 failed. + There was an error creating the virtual file or folder. The virtual file or folder was not created. + + + Deletion of the virtual file or folder %1 failed. + There was an error deleting the virtual file or folder. The virtual file or folder was not deleted. + + + Could not move the virtual file or folder %1. + There was an error moving the virtual file or folder. The virtual file or folder was not moved. + + + Converting to a virtual destination is not supported at this time. Please choose a non-virtual destination. + + + + Adding to a virtual destination is not supported. Please choose a non-virtual destination. + + + + Destination archive cannot be the same as, or contained in, any of the source files or folders. + You have selected a destination for the archive that is either one of the sources, or contained in one of the sources. This is not permitted. + + + Permanently delete selected remote resource(s)? + This is a permanent deletion of the selected remote resources from disk. This action cannot be undone + + + Error occurred while loading the user-defined action information from file: %1 + %2 + + + The xml file '%1' appears to be corrupted. It has been replaced + Expected root tag to be named '%2'. The corrupted file has been renamed to '%3' and a new file created for you + + + Unable to perform action as the underlying file system folder is in use + The file system folder %1 is in use by another task and cannot be removed or modified + + + Unable to perform action as the underlying file system file is in use + The file system file %1 is in use by another task and cannot be removed or modified + + + Filter pool %1 created. Create a reference to it in the selected subsystem? + New filter pools are not accessible until a reference is added to them in a subsystem. Select Yes to add a reference to the new filter pool in selected subsystem %2 + + + Filter update failed: %1 + %2 + + + Filter rename failed: %1 + %2 + + + Enter numeric value + You must enter a numeric value + + + Value %1 not numeric + The value specified is not a valid number + + + Value %1 not in range + The value specified is not within the valid range of %2 to %3 + + + Enter action name + You must enter a name for this action + + + Action name is not unique + There is already an action with the given name in the selected profile. Specify a name that is not already in use + + + Action name is not valid + The given name is not a valid action name + + + Enter comment + You must enter a comment for this action + + + Action comment is not valid + The given comment has syntactical errors + + + Enter command + You must enter a command for this action + + + Action command is not valid + The given command has syntactical errors + + + Enter type name + You must enter a name for this collection of resource types + + + Type name %1 in use + There is already a named type with the given name. Specify a name that is not already in use + + + Type name %1 is not valid + The given name is not valid for a named type. It must not contain blanks + + + Specify one or more resource types + You must specify one or more simple or generic resource types to constitute this named type + + + Types not valid + Syntactical errors were found in the list of resource types + + + Enter source type + You must enter a source type + + + Source type "%1" not valid + The source type you entered is not valid. + + + Source type "%1" already exists + The source type you entered has already been specified. Specify a unique source type. + + + Enter a label for this compile command + You must enter a label for this compile command, that will be shown in menus and lists + + + Compile command label "%1" is in use + There is already a compile command with the given label. Specify a label that is not already in use + + + Compile command label "%1" is not valid + The given label is not a valid compile label + + + Enter command string for this compile command + You must enter a command string for this compile command. This is what is run when this compile command is selected. + + + Compile command string "%1" is not valid + The given string is not a valid command. + + + Changes pending. Save changes? + You have changes pending. Select Yes to save those changes. Select No to discard those changes + + + Changes pending. Continue? + You have changes pending. Select Yes to discard those changes. Select No to cancel the operation so you can first save your changes + + + Host name '%1' not found or valid + A remote system of host name '%1' was found. If you are working disconnected, de-select the checkbox to verify the host name + + + Verifying host name... + + + + Delete selected user actions? + This is a permanent deletion of the selected actions and cannot be undone.Select Yes to delete and No to cancel the delete action + + + Delete selected types? + This is a permanent deletion of the selected types and cannot be undone.Select Yes to delete and No to cancel the delete action + + + There is an error on another page + Another page of the wizard has an error that must be corrected before the wizard can be finished + + + Daemon failed to launch server on %1 using port %2 + %3 + + + Failed to connect to the daemon on %1 using port %2 with an unexpected exception + %3 + + + + + The pattern may not be blank + + + + Invalid regular expression + The value %1 you entered is not a valid regular expression + + + + + %1 - Running + + + + %1 - Finished + + + + %1 - Cancelled + + + + %1 - Disconnected + + + + + + + The invocation may not be blank + + + + + + Invalid transfer operation + The source %1 cannot be transferred into the target %2 + + + Downloading %1 + + + + Uploading %1 + + + + Synchronizing Resources... + + + + Extracting %1 + + + + %1 of %2 complete (%3) + + + + Downloading resources... + + + + Uploading resources... + + + + + + The FTP service is unavailable on the remote system. + The RSE server needs to be installed manually. + + + The Telnet service is unavailable on the remote system. + The RSE server needs to be started manually or a system administrator needs to install the RSE daemon. + + + Unable to start the RSE server. + + + + Unable to install the RSE server. + + + + Archive Management is not supported by the current File subsystem's configuration. + In the properties for the File subsystem, choose a configuration that supports Archive Management. + + + + + This action will take a few minutes. Proceed? + This action uncompresses a large number of HTML files from a zip file. It will take awhile, and require sufficient disk space. Press Yes to continue, No to cancel. + + + Classic help already enabled. + The HTML files for the CODE and VisualAge RPG help have already been uncompressed. + + + + + Remote Error List: %1 + + + + + + Folder path must not be empty. + Select a folder from the dropdown list or click the Browse... button and select a folder from the dialog. + + + Regular expression is not valid. + The value %1 you entered is not a valid regular expression. + + + + + + + + + %1 + %2 + + + %1 + %2 + + + %1 + %2 + + + %1 + %2 + + + %1 + %2 + + + %1: %2 + %3 + + + %1: %2 + %3 + + + %1: %2 + %3 + + + %1: %2 + %3 + + + %1: %2 + %3 + + + %1 + + + + %1 + + + + %1 + + + + %1 + + + + %1 + + + + + + + + + Operation failed. Security violation + Message reported from file system: %1 + + + Operation failed. File system input or output error + Message reported from file system: %1 + + + Folder is not empty. Cannot delete + The operation failed. One possible reason is that the folder is not empty + + + Folder '%1' not found + + + + Folder '%1' not found. Would you like to create it? + The folder you specified does not exist. Select Yes to create it, No to cancel the operation + + + File '%1' not found + + + + + Enter file name pattern + + + + Filter string '%1' already exists in this filter + + + + Filter string name pattern not valid + + + + You must include files or folders or both + + + + No file types specified + Either specify one or more file types, or select to subset by file name + + + + Create a new File + + + + Create a new Folder + + + + Enter folder name + + + + Names cannot begin or end with whitespace. + + + + %1 is an invalid character in a name. + + + + Enter file name + + + + Deletion of the object %1 failed + Either the object does not exist or you do not have enough authority to delete the object. If this is a folder, the folder may not be empty + + + Renaming of the object %1 failed + Rename operation failed because, the object to rename does not exist, or the object with new object name already exists, or the user does not have enough authority to rename the object + + + No authority or file name not valid + The file could not be created because of one of the following reasons: + - the user does not have enough authority to create the file + - the file name is not valid + + + File already exists + The new file %1 already exists + + + Creation of the folder failed + The folder %1 could not be created because of one of the following reasons: + - the user does not have enough authority to create the folder + - the folder name is not valid + + + The operation did not complete successfully. See additional messages in the Commands view + The operation requested failed. Look in the Commands view to see additional messages indicating the cause of the failure + + + Copy of the file or folder %1 failed + The file system reported the copy operation failed. You may not have authority to the target folder, or it may be in use + + + Move of the file or folder %1 failed + The file system reported the move operation failed. You may not have authority to the source folder or file, or you may not have authority to the target folder, or it may be in use + + + Target folder cannot equal source folder + Attempting to move a file or folder to the same folder as it exists in is equivalent to a rename operation. Use the rename action for this + + + Folder already exists + The new folder %1 already exists + + + New resource will not be visible due to subsetting. Create it anyway? + The name of the resource you are creating does not match the current filter criteria. If you select Yes to create the resource, it will not be visible within the current filter. + + + Resource will not be visible due to subsetting. Rename it anyway? + The new name of the resource does not match the current filter criteria. If you select Yes to rename the resource, it will not be visible within the current filter. + + + Target folder cannot descend from source folder + It is impossible to move a folder to one of its subfolders. + + + Target folder cannot be written to. Please select another destination folder. + The target folder is an unsuitable destination because it is read-only or you do not have write permission on it. + + + Deleting %1... + + + + + File %1 on %2 can not be opened. You do not have read access to the file. + Change file permissions to ensure you have read access to the file. + + + You do not have write access to file %1 on %2. Do you want to open the file in browse mode? + You do not have write permission to the file %1 on %2. You can open the file in browse (read-only) mode. If you want to edit the file, change file permissions to allow write access to the file. + + + File %1 can not be saved on %2. You do not have read access to the file. + Change file permissions to ensure you have read access to the file. + + + File %1 can not be saved on %2. You do not have write access to the file. + Change file permissions to ensure you have write access to the file. + + + File %1 on %2 was modified since you opened this file or saved the file on the server. Do you want to replace the current contents of the file on the server? + The file %1 was changed on the server after it was retrieved from %2 or since the last time the file was saved on the server. Choose Yes to replace the contents of the file. Choose No to leave the file on the server with its current contents. + + + File %1 was not completely saved on %2. The file was saved in the local file system. + An error occurred while saving the file on the server. A possible cause is the connection to the server was terminated. The file may only have been saved partially on the server. However, it was saved locally to help you recover. You will be asked to save the local copy to the server the next time you connect. + + + File %1 on %2 may not have been saved completely during an earlier edit session. The file was saved on the local file system. Do you want to replace the file with the local copy now? + An error occurred during an earlier attempt to save the file. But a local copy of the file was saved for recovery. Choose Yes to save the local copy on the server. Choose No if recovery is not required. + + + File %1 does not exist on %2. Do you want to create the file? + Choose Yes to create the file on the server and save the contents to the file. Choose No if you do not want the file to be created. + + + You are currently editing file %1 on %2. Do you want to open the file in browse mode? + You are allowed to edit a file in one editor only. You can, however, open the file in another editor for browsing. Browsing lets you view the file but does not allow you to edit its contents. + + + Profile named %1 does not exist. + Profile may have been renamed or deleted. + + + Connection named %1 does not exist. + Connection may have been renamed or deleted. + + + + + + File %1 already exists. Do you want to replace it? + + + + Parent folder %1 does not exist. Do you want to create it? + The parent folder must be created for the file to be created. + + + Parent folder %1 does not exist. Verify that the correct path was entered. + + + + + + Unable to use connection. + Please correct, or select alternate connection. + + + Unexpected exception received: %1. + Please see error log for details. + + + The file '%1' already exists on %2. Do you want to overwrite it? + Click Yes to overwrite the existing file, or click No to cancel the export. + + + + + File type extension can not be empty. + + + + File type extension must not contain '*' or '.' + + + + The encoding is not supported. + + + + + + + One or more cached files have changes that have not been saved on the host. + + + + Unable to synchronize cache changes to host. Operation cancelled. + + + + + + The IP address or host name can not be empty. + + + + The IP address is not valid. + + + + The host name is not valid. + + + + + + + Enter CCSID + + + + CCSID must be a number between 0 and 65535 + + + + + + An unknown error occurred. + %1 + + + An unexpected error occurred. + %1 + + + Value is not valid + %1 + + + Input %1 is not valid + %1 + + + + + Can not copy root file system + The root is not something that can be copied + + + Could not close import stream for %1 + + + + Unable to import %1: %2 + %3 + + + Creating folder %1 + + + + Problems were encountered during import + %1 + + + Error opening input stream for %1 + %2 + + + Unable to import %1 + The file cannot be copied onto itself + + + Error occurred while exporting %1: %2 + %3 + + + Problems were encountered during export + %1 + + + Cannot overwrite file %1 + The file does not have its write attribute set, so it cannot be written to + + + Target folder does not exist. Would you like to create it? + Press Yes to create the folder %1, No to cancel + + + Target folder already exists, as a file + The remote resource %1 already exists, but as a file, not a folder + + + Destination folder conflicts with location of %1 + You are attempting to export to the local file system, to a location that overlaps the resources being exported. + + + Source is a file, not a folder + The remote resource %1 is a file, but a folder is required + + + There are no resources currently selected for import + + + + Select the source directory + + + + Enter or select a source folder + You have left the source folder empty, but it must be set to continue. + + + Export problems + %1 + + + There are no resources currently selected for export + Select resources to be exported and try again + + + Please enter a destination folder + The destination folder is empty. You must select a destination folder. + + + Import problems + %1 + + + There are no resources currently selected for import + Select resources to be imported and try again + + + Filtering selection... + + + + + + + + Connection to %1 could not be established. + A socket connection to %1 could not be established. If you are connecting via the communications daemon make sure the daemon is running on the remote system. If you are connecting directly to the communications server make sure the server is started on the remote system. If you are connecting using REXEC, make sure that the server is installed on the remote system and that the REXEC service is running on that system. + + + Invalid password or user ID + Authentication with %1 failed because the password or user ID is not correct. + + + The user ID %1 is not valid + The user ID %1 on host %2 is not valid. Change the user ID and try again. + + + The saved password is not correct. + The saved password for user ID %1 on host %2 is not correct. Please enter the password and try again. + + + + Environment variable %1 is already defined + An environment variable %1 has already been defined. Change the new environment variable's name and press the Add button. + + + Environment variable must have a name. + An attempt was made to define an environment variable with a blank name. Type a value for the environment variable name. + + + Environment variable must have a name. + An attempt was made to clear the name of an environment variable. To remove an environment variable, select the variable in the list add press the Remove button. + + + Environment variable name contains an invalid character. + The environment variable name cannot contain a space or the '=' character. + + + Saved password for %1 on %2 already exists. + The password for user ID %1 on host %2 is already saved. Enter a different user ID or host name or change the existing saved password. + + + New and verify passwords do not match. + The new and verify passwords must match (case sensitive) in order to save the new password. Retype the new and verify passwords and try again. + + + Entry field cannot be blank. + The hostname, user ID, system type and password entry fields cannot be blank. Type a value and press the Enter key to save the changes. + + + There are no tools installed which support saving password information. + The password information preference page is a centralized place for Workbench tools to save password information. Each tool registers and provides its own encryption algorithm. There are no tools installed that have registered with the password information preference page. + + + The RSE communications daemon could not be started. + The RSE communications daemon could not be started on port %1. Check that the port is free and restart the daemon or change the port used by the daemon using the Remote Systems -> Communications Workbench preference page. + + + + Unable to launch server on host %1. + Message from host: %2 + + + Invalid password or user ID for %1. + Message from host: %2 + + + Incompatible host server running on remote system %1. + The host server is not a Remote System Explorer server. + + + Incompatible Remote System Explorer host server running on remote system %1. + The host server needs to be updated to work with the current client. + + + Unable to connect to REXEC host service on port %1 of host %2 + Message from host: %3 + + + Port %1 is normally used for the %2 service. + + + + Unable to establish a secure connection with the Remote System Explorer host server. + Make sure both the client and server are configured to use SSL. The SSL handshake between client and server failed with the following exception: %1 + + + The host server running on remote system %1 is an older version than the RSE client. + It is recommended that the client and server versions match. + + + The host server running on remote system %1 is a newer version than the RSE client. + It is recommended that the client and server versions match. + + + Starting Remote Systems Explorer host server using REXEC + + + + Starting Remote Systems Explorer host server using daemon + + + + Connecting to Remote Systems Explorer host server on port %1 + + + + Initializing Remote Systems Explorer host server + + + + The connection %1 is currently offline and cannot be connected. + You have performed an action which requires a live connection to the remote system. Switch the connection to online and perform the action again. To switch the connection online, right click on the connection %1 and select the Work Offline action. + + + + + \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/IRemoteSystemsProject.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/IRemoteSystemsProject.java new file mode 100644 index 00000000000..c9ae33f12c3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/IRemoteSystemsProject.java @@ -0,0 +1,33 @@ +/******************************************************************************** + * 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.core; + +import org.eclipse.core.resources.IProject; + +/** + * Therei is exactly one remote systems project. It is created by the plugin if it does + * not exist already. It is never created by the user. + *

    + */ +public interface IRemoteSystemsProject +{ + /** + * Returns the IProject on which this IJavaProject + * was created. This is handle-only method. + */ + IProject getProject(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/ISystemTypes.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/ISystemTypes.java new file mode 100644 index 00000000000..6ba796721c8 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/ISystemTypes.java @@ -0,0 +1,74 @@ +/******************************************************************************** + * 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.core; +/** + * Constants for system types. + * These are kept in synch with the definitions from plugin.xml in org.eclipse.rse.core. + */ +public interface ISystemTypes +{ + + /** + * Linux system type, "Linux". + */ + public static final String SYSTEMTYPE_LINUX = "Linux"; + + /** + * Power Linux type, "Power Linux". + */ + public static final String SYSTEMTYPE_POWER_LINUX = "Power Linux"; + + /** + * Power Linux type, "zSeries Linux". + */ + public static final String SYSTEMTYPE_ZSERIES_LINUX = "zSeries Linux"; + + /** + * Unix system type, "Unix". + */ + public static final String SYSTEMTYPE_UNIX = "Unix"; + + /** + * AIX system type, "AIX". + */ + public static final String SYSTEMTYPE_AIX = "AIX"; + + /** + * PASE system type, "PASE". + */ + public static final String SYSTEMTYPE_PASE = "PASE"; + + /** + * iSeries system type, "iSeries". + */ + public static final String SYSTEMTYPE_ISERIES = "iSeries"; + + /** + * Local system type, "Local". + */ + public static final String SYSTEMTYPE_LOCAL = "Local"; + + /** + * z/OS system type, "z/OS". + */ + public static final String SYSTEMTYPE_ZSERIES = "z/OS"; + + /** + * Windows system type, "Windows". + */ + public static final String SYSTEMTYPE_WINDOWS = "Windows"; +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/ISystemUserIdConstants.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/ISystemUserIdConstants.java new file mode 100644 index 00000000000..b1ad9f72699 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/ISystemUserIdConstants.java @@ -0,0 +1,29 @@ +/******************************************************************************** + * 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.core; +/** + * Constants for user Id management + */ +public interface ISystemUserIdConstants +{ + + public static final int USERID_LOCATION_NOTSET = 0; + public static final int USERID_LOCATION_SUBSYSTEM = 1; + public static final int USERID_LOCATION_CONNECTION = 2; + public static final int USERID_LOCATION_DEFAULT_SYSTEMTYPE = 3; + public static final int USERID_LOCATION_DEFAULT_OVERALL= 4; +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/ISystemViewSupplier.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/ISystemViewSupplier.java new file mode 100644 index 00000000000..c07de0b57c3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/ISystemViewSupplier.java @@ -0,0 +1,38 @@ +/******************************************************************************** + * 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.core; + +/** + * You own views launchable from the Remote Systems Explorer. You must register yourself + * with SystemPlugin 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/systems/org/eclipse/rse/core/PasswordPersistenceManager.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/PasswordPersistenceManager.java new file mode 100644 index 00000000000..9a69402e7ad --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/PasswordPersistenceManager.java @@ -0,0 +1,693 @@ +/******************************************************************************** + * 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.core; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.rse.model.SystemSignonInformation; +import org.eclipse.rse.ui.ISystemPreferencesConstants; + + +/** + * PasswordPersistenceManager manages the saving and retreiving of user ID / passwords + * to the Eclipse keyring for registered system types. Registration is done via the + * org.eclipse.rse.core.passwordPersistence extension point. + * + * @author yantzi + */ +public class PasswordPersistenceManager { + + + // Keys used for using the Platform authorization methods + // The server url is generic so we can lookup all registered user IDs / passwords + // to display to the user in the password information preference page + private static final String SERVER_URL = "file://rse"; + + private static final String AUTH_SCHEME = ""; // no authorization scheme specified for apis + + // Add return codes + public static final int RC_OK = 0; + public static final int RC_ALREADY_EXISTS = 1; + public static final int RC_ERROR = -1; + + // Default System Type, on a lookup if the specified system type and hostname is not found + // then the call will automatically lookup the default system type and hostname + public static final String DEFAULT_SYSTEM_TYPE = "DEFAULT"; + + // Default user name + public static final String DEFAULT_USER_NAME = "DEFAULT_USER"; + + // New URL to store password map + private String newURL = null; + + /* + * Singleton instance + */ + private static PasswordPersistenceManager _instance; + + /* + * Instance variables + */ + private RegisteredSystemType[] systemTypes; + + /** + * Inner class used for storing registered system types + */ + protected class RegisteredSystemType + { + private String _systemType; + private boolean _userIDCaseSensitive; + + protected RegisteredSystemType(String systemType, boolean caseSensitive) + { + _systemType = systemType; + _userIDCaseSensitive = caseSensitive; + } + + /** + * @return + */ + public String getSystemType() { + return _systemType; + } + + /** + * @return + */ + public boolean isUserIDCaseSensitive() { + return _userIDCaseSensitive; + } + } + + /** + * Singleton so private constructor + */ + private PasswordPersistenceManager(){ + String userName = System.getProperty("user.name"); + + if (userName == null) { + userName = DEFAULT_USER_NAME; + } + + newURL = SERVER_URL + userName; + } + + /** + * Retrieve the singleton isntance of the PasswordPersistenceManger + */ + public static final synchronized PasswordPersistenceManager getInstance() + { + if (_instance == null) + { + _instance = new PasswordPersistenceManager(); + _instance.initExtensions(); + } + return _instance; + } + + /* + * initialization + * - read password file + * - load IPasswordEncryptionProvider instances + */ + private void initExtensions() + { + IExtensionRegistry registry = Platform.getExtensionRegistry(); + + IExtensionPoint point = registry.getExtensionPoint("org.eclipse.rse.ui.passwordPersistence"); + + if (point != null) + { + IExtension[] extensions = point.getExtensions(); + systemTypes = new RegisteredSystemType[extensions.length]; + + int count = 0; + String systemType, caseSensitiveAsString; + boolean caseSensitive; + + for (int i = 0; i < extensions.length; i++) + { + IConfigurationElement[] elements = extensions[i].getConfigurationElements(); + if (elements != null && elements.length > 0) + { + if ("provider".equals(elements[0].getName())) + { + // Make sure that all attributes are available + systemType = elements[0].getAttribute("systemType"); + caseSensitiveAsString = elements[0].getAttribute("caseSensitive"); + if (caseSensitiveAsString != null && caseSensitiveAsString.equals("false")) + { + caseSensitive = false; + } + else + { + caseSensitive = true; + } + + systemTypes[count] = new RegisteredSystemType(systemType, caseSensitive); + count++; + } + } + else + { + SystemBasePlugin.logError("PasswordPersistenceManager.init: Invalid extension point", null); + } + } + + // Resize array if one or more of the extension points was invalid + if (count != extensions.length) + { + RegisteredSystemType[] temp = new RegisteredSystemType[count]; + for (int i = 0; i < count; i++) + { + temp[i] = systemTypes[i]; + } + systemTypes = temp; + } + } + else + { + SystemBasePlugin.logError("PasswordPersistenceManager.init: extension point not found", null); + } + } + + /** + * Remove the entry from the keyring that matches the systemtype, hostname and + * user ID from the SystemSignonInfo parameter. + */ + public void remove(SystemSignonInformation info) + { + remove(info.getSystemType(), info.getHostname(), info.getUserid()); + } + + /** + * Remove the entry from the keyring that matches the hostname, userid and + * system type parameters. + */ + public void remove(String systemtype, String hname, String userid) + { + String hostname = hname;//SystemPlugin.getQualifiedHostName(hname); + // Convert userid to upper case if required + if (!isUserIDCaseSensitive(systemtype)) + { + userid = userid.toUpperCase(); + } + + Map passwords = getPasswordMap(systemtype); + + if (passwords != null) + { + if (removePassword(passwords, hostname, userid)) + { + savePasswordMap(systemtype, passwords); + } + } + else + { + // yantzi: RSE6.2 check for default system type entry with this hostname and user ID + if (!DEFAULT_SYSTEM_TYPE.equals(systemtype)) + { + remove(DEFAULT_SYSTEM_TYPE, hostname, userid); + } + } + } + + /** + * Check if a password entry exists for the specified system type, hostname + * and userid. + */ + public boolean passwordExists(String systemtype, String hostname, String userid) + { + + return passwordExists(systemtype, hostname, userid, true); + } + + /** + * Check if a password entry exists for the specified system type, hostname + * and userid. + * + * @param systemtype The system type to check for. + * @param hotname The hostname to check for. + * @param userid The user ID to check for. + * @param checkDefault Whether or not to check for a default system type if the specified system type is not found. + * + * @since RSE 6.2 + */ + public boolean passwordExists(String systemtype, String hname, String userid, boolean checkDefault) + { + String hostname = hname;//SystemPlugin.getQualifiedHostName(hname); + return (find(systemtype, hostname, userid) != null); + } + + /** + * Add a new persisted password to the password database. This method assumes + * the encrypted password is already stored in the SystemSignonInformation + * parameter. + * + * @param info The signon information to store + * @param overwrite Whether to overwrite any existing entry + * + * @return + * RC_OK if the password was successfully stored + * RC_ALREADY_EXISTS if the password already exists and overwrite was false + */ + public int add(SystemSignonInformation info, boolean overwrite) + { + return add(info, overwrite, false); + } + + /** + * Add a new persisted password to the password database. This method assumes + * the encrypted password is already stored in the SystemSignonInformation + * parameter. + * + * @param info The signon information to store + * @param overwrite Whether to overwrite any existing entry + * @param updateDefault Whether or not to update the default entry for the specified hostname / user ID if one exists. + * + * @return + * RC_OK if the password was successfully stored + * RC_ALREADY_EXISTS if the password already exists and overwrite was false + */ + public int add(SystemSignonInformation info, boolean overwrite, boolean updateDefault) + { + String systemtype = info.getSystemType(); + + // Convert userid to upper case if required + if (!isUserIDCaseSensitive(systemtype)) + { + info.setUserid(info.getUserid().toUpperCase()); + } + + String hostname = info.getHostname(); + String userid = info.getUserid(); + Map passwords = getPasswordMap(systemtype); + String passwordKey = getPasswordKey(hostname, userid); + + if (passwords != null) + { + String password = getPassword(passwords, hostname, userid); + + if (password != null) + { + if (!overwrite) + { + return RC_ALREADY_EXISTS; + } + else + { + removePassword(passwords, hostname, userid); + } + } + else if (updateDefault) + { + // yantzi: 6.2, check if default exists for the specified hostname / user ID + Map defaultPasswords = getPasswordMap(DEFAULT_SYSTEM_TYPE); + if (defaultPasswords != null) + { + String defaultPassword = (String) defaultPasswords.get(passwordKey); + if (defaultPassword != null) + { + if (!overwrite) + { + return RC_ALREADY_EXISTS; + } + else + { + defaultPasswords.remove(passwordKey); + passwords = defaultPasswords; + systemtype = DEFAULT_SYSTEM_TYPE; + } + } + } + } + } + else + { + // password map did not exists yet so create a new one + passwords = new HashMap(5); + } + + passwords.put(passwordKey, info.getPassword()); + + savePasswordMap(systemtype, passwords); + + return RC_OK; + } + + + /* + * Retrieve the password map from the keyring for the specified system type + */ + private Map getPasswordMap(String systemType) + { + Map passwords = null; + + try + { + URL serverURL = new URL(newURL); + passwords = Platform.getAuthorizationInfo(serverURL, systemType, AUTH_SCHEME); + + // if no passwords found with new URL, check old URL + if (passwords == null) { + + URL oldServerURL1 = new URL(SERVER_URL + SystemBasePlugin.getWorkspace().getRoot().getLocation().toOSString()); + passwords = Platform.getAuthorizationInfo(oldServerURL1, systemType, AUTH_SCHEME); + + // passwords found, so migrate to using new URL + if (passwords != null) { + savePasswordMap(systemType, passwords); + } + // if still no passwords found, check with even older URL + else { + URL oldServerURL2 = new URL(SERVER_URL); + passwords = Platform.getAuthorizationInfo(oldServerURL2, systemType, AUTH_SCHEME); + + // passwords found, so migrate to using new URL + if (passwords != null) { + savePasswordMap(systemType, passwords); + } + } + } + } + catch (MalformedURLException e) { + SystemBasePlugin.logError("PasswordPersistenceManager.getPasswordMap", e); + } + + return passwords; + } + + /* + * Retrieve the password map from the keyring for the specified system type + */ + private void savePasswordMap(String systemType, Map passwords) + { + try + { + URL serverURL = new URL(newURL); + Platform.flushAuthorizationInfo(serverURL, systemType, AUTH_SCHEME); + Platform.addAuthorizationInfo(serverURL, systemType, AUTH_SCHEME, passwords); + } + catch (MalformedURLException e) { + SystemBasePlugin.logError("PasswordPersistenceManager.savePasswordMap", e); + } + catch (CoreException e) { + SystemBasePlugin.logError("PasswordPersistenceManager.savePasswordMap", e); + } + } + + /** + * Find the persisted password for the specified systemtype, hostname and userid. + */ + public SystemSignonInformation find(String systemtype, String hostname, String userid) + { + if (userid == null) + { + return null; + } + return find(systemtype, hostname, userid, true); + } + + + private boolean removePassword(Map passwords, String hostname, String userid) + { + boolean removed = false; + String password = null; + + String passwordKey = getPasswordKey(hostname, userid); + password =(String) passwords.get(passwordKey); + if (password != null) + { + passwords.remove(passwordKey); + removed = true; + } + else + { + String phostname = hostname.toUpperCase(); + + // DKM - fallback for different case uids, hostnames or qualified/unqualified hostnames + Iterator keys = passwords.keySet().iterator(); + while (keys.hasNext() && password == null) + { + String key = (String)keys.next(); + if (key.equalsIgnoreCase(passwordKey)) + { + password = (String) passwords.get(key); + } + else + { + String khostname = getHostnameFromPasswordKey(key).toUpperCase(); + String kuid = getUserIdFromPasswordKey(key); + if (kuid.equalsIgnoreCase(userid)) + { + // uid matches, check if hosts are the same + if (khostname.startsWith(phostname) || phostname.startsWith(khostname)) + { + String qkhost = SystemPlugin.getQualifiedHostName(khostname); + String qphost = SystemPlugin.getQualifiedHostName(phostname); + if (qkhost.equals(qphost)) + { + password = (String)passwords.get(key); + } + } + } + } + if (password != null) + { + passwords.remove(key); + removed = true; + + } + } + } + return removed; + + } + + private String getPassword(Map passwords, String hostname, String userid) + { + String password = null; + + String passwordKey = getPasswordKey(hostname, userid); + password =(String) passwords.get(passwordKey); + if (password != null) + return password; + + String phostname = hostname.toUpperCase(); + + // DKM - fallback for different case uids, hostnames or qualified/unqualified hostnames + Iterator keys = passwords.keySet().iterator(); + while (keys.hasNext() && password == null) + { + String key = (String)keys.next(); + if (key.equalsIgnoreCase(passwordKey)) + { + password = (String) passwords.get(key); + } + else + { + String khostname = getHostnameFromPasswordKey(key).toUpperCase(); + String kuid = getUserIdFromPasswordKey(key); + if (kuid.equalsIgnoreCase(userid)) + { + // uid matches, check if hosts are the same + if (khostname.startsWith(phostname) || phostname.startsWith(khostname)) + { + String qkhost = SystemPlugin.getQualifiedHostName(khostname); + String qphost = SystemPlugin.getQualifiedHostName(phostname); + if (qkhost.equals(qphost)) + { + password = (String)passwords.get(key); + } + } + } + } + } + + return password; + + } + + /** + * Find the persisted password for the specified systemtype, hostname and userid. + * + * @param systemtype The system type to check for. + * @param hotname The hostname to check for. + * @param userid The user ID to check for. + * @param checkDefault Whether or not to check for a default system type if the specified system type is not found. + * + * @since RSE 6.2 + */ + public SystemSignonInformation find(String systemtype, String hname, String userid, boolean checkDefault) + { + String hostname = hname;//SystemPlugin.getQualifiedHostName(hname); + // Convert userid to upper case if required + if (!isUserIDCaseSensitive(systemtype)) + { + userid = userid.toUpperCase(); + } + + Map passwords = getPasswordMap(systemtype); + + if (passwords != null) + { + String password = getPassword(passwords, hostname, userid); + + if (password != null) + { + return new SystemSignonInformation(hostname, userid, password, systemtype); + } + } + + // yantzi: RSE6.2 check for default system type entry with this hostname and user ID + if (checkDefault && !DEFAULT_SYSTEM_TYPE.equals(systemtype)) + { + return find(DEFAULT_SYSTEM_TYPE, hostname, userid, false); + } + + return null; + } + + /** + * Helper class for building the key to lookup the password for a specific + * userid and hostname in the Map + */ + private String getPasswordKey(String hname, String userid) + { + String hostname = hname;//SystemPlugin.getQualifiedHostName(hname); + StringBuffer buffer = new StringBuffer(hostname); + buffer.append("//"); + buffer.append(userid); + return buffer.toString(); + } + + private static String getHostnameFromPasswordKey(String passwordKey) + { + int sepIndex = passwordKey.indexOf("//"); + return passwordKey.substring(0,sepIndex); + } + + private static String getUserIdFromPasswordKey(String passwordKey) + { + int sepIndex = passwordKey.indexOf("//"); + return passwordKey.substring(sepIndex + 2, passwordKey.length()); + } + + /** + * Helper method for determining if system type uses case sensitive user IDs + */ + public boolean isUserIDCaseSensitive(String systemType) + { + if (DEFAULT_SYSTEM_TYPE.equals(systemType)) + { + IPreferenceStore store = SystemPlugin.getDefault().getPreferenceStore(); + systemType = store.getString(ISystemPreferencesConstants.SYSTEMTYPE); + } + + // First find the correct provider + for (int i = 0; i < systemTypes.length; i++) + { + + if (systemTypes[i].getSystemType().equals(systemType)) + { + return systemTypes[i].isUserIDCaseSensitive(); + } + } + + return true; + } + + /** + * Retrieve the list of registered system types + */ + public String[] getRegisteredSystemTypes() + { + // yantzi: artemis 6.2, added default system type to list + String[] types = new String[systemTypes.length + 1]; + + types[0] = DEFAULT_SYSTEM_TYPE; + + for (int i = 0; i < systemTypes.length; i++) + { + types[i + 1] = systemTypes[i].getSystemType(); + } + + return types; + } + + /** + * Retrieve a list of the stored user IDs. + * + * @return List A list of the stored user IDs as SystemSignonInformation instances + * without the saved passwords. + */ + public List getSavedUserIDs() + { + List savedUserIDs = new ArrayList(); + Map passwords; + String key; + int separator; + + for (int i = 0; i < systemTypes.length; i++) + { + passwords = getPasswordMap(systemTypes[i].getSystemType()); + if (passwords != null) + { + Iterator keys = passwords.keySet().iterator(); + while (keys.hasNext()) + { + key = (String) keys.next(); + separator = key.indexOf("//"); + savedUserIDs.add(new SystemSignonInformation(key.substring(0, separator), // hostname + key.substring(separator + 2), // userid + systemTypes[i].getSystemType())); // system type + } + } + } + + // yantzi: RSE 6.2 Get DEFAULT system types too + passwords = getPasswordMap(DEFAULT_SYSTEM_TYPE); + if (passwords != null) + { + Iterator keys = passwords.keySet().iterator(); + while (keys.hasNext()) + { + key = (String) keys.next(); + separator = key.indexOf("//"); + savedUserIDs.add(new SystemSignonInformation(key.substring(0, separator), // hostname + key.substring(separator + 2), // userid + DEFAULT_SYSTEM_TYPE)); // system type + } + } + + return savedUserIDs; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/RemoteSystemsProject.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/RemoteSystemsProject.java new file mode 100644 index 00000000000..33078edc03f --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/RemoteSystemsProject.java @@ -0,0 +1,97 @@ +/******************************************************************************** + * 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.core; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectNature; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.PlatformObject; + + +/** + * Handle for a Remote Systems Project + * + *

    A Remote Systems Project is a singleton created initially by the + * remote systems plugin. It is a container for all the connections and + * subsystems defined for working with remote systems. + * + * @see IRemoteSystemsProject + */ +public class RemoteSystemsProject extends PlatformObject + implements IRemoteSystemsProject, IProjectNature +{ + + /** + * ID of the nature for the remote system explorer project: "org.eclipse.rse.ui.remotesystemsnature" + */ + public static final String ID = "org.eclipse.rse.ui.remotesystemsnature"; + /** + * Name of the nature for the remote system explorer project: "Remote Systems Nature" + */ + public static final String NAME = "Remote Systems Nature"; + /** + * An empty array of strings indicating that a project doesn't have any prerequesite projects. + */ + protected static final String[] NO_PREREQUISITES= new String[0]; + + /** + * The platform project this IRemoteProject is based on + */ + protected IProject fProject; + + /** + * Constructor needed for IProject.getNature() and IProject.addNature(). + * + * @see #setProject + */ + public RemoteSystemsProject() + { + super(); + } + public RemoteSystemsProject(IProject project) + { + super(); + fProject= project; + } + + public void setProject(IProject project) + { + SystemBasePlugin.logInfo("Inside setProject"); + fProject= project; + } + /** + * Configure the project with Java nature. + */ + public void configure() throws CoreException + { + SystemBasePlugin.logInfo("Inside configure"); + } + /** + * Removes the Java nature from the project. + */ + public void deconfigure() throws CoreException + { + } + public IProject getProject() + { + return fProject; + } + public int hashCode() + { + return fProject.hashCode(); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/RemoteSystemsTempProjectNature.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/RemoteSystemsTempProjectNature.java new file mode 100644 index 00000000000..3a8f6e3c8d5 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/RemoteSystemsTempProjectNature.java @@ -0,0 +1,55 @@ +/******************************************************************************** + * 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.core; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectNature; +import org.eclipse.core.runtime.CoreException; + +/** + * A nature for the temporary project where we store files. + */ +public class RemoteSystemsTempProjectNature implements IProjectNature { + + + + /** + * @see org.eclipse.core.resources.IProjectNature#configure() + */ + public void configure() throws CoreException { + } + + /** + * @see org.eclipse.core.resources.IProjectNature#deconfigure() + */ + public void deconfigure() throws CoreException { + } + + /** + * @see org.eclipse.core.resources.IProjectNature#getProject() + */ + public IProject getProject() { + return null; + } + + /** + * @see org.eclipse.core.resources.IProjectNature#setProject(IProject) + */ + public void setProject(IProject project) { + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemAdapterHelpers.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemAdapterHelpers.java new file mode 100644 index 00000000000..50b0c269f1a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemAdapterHelpers.java @@ -0,0 +1,113 @@ +/******************************************************************************** + * 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.core; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; +import org.eclipse.rse.ui.view.ISystemViewElementAdapter; +import org.eclipse.rse.ui.view.ISystemViewInputProvider; +import org.eclipse.rse.ui.view.SystemViewAdapterFactory; + + +/** + * 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 getAdapter(Object o) + { + ISystemViewElementAdapter adapter = null; + if (!(o instanceof IAdaptable)) + adapter = (ISystemViewElementAdapter)Platform.getAdapterManager().getAdapter(o,ISystemViewElementAdapter.class); + else + adapter = (ISystemViewElementAdapter)((IAdaptable)o).getAdapter(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 getAdapter(Object o, Viewer viewer) + { + ISystemViewElementAdapter adapter = getAdapter(o); + if (adapter != null) + 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 getAdapter(Object o, Viewer viewer, ISystemViewInputProvider inputProvider) + { + ISystemViewElementAdapter adapter = getAdapter(o, viewer); + + if (adapter != null) { + 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; + if (!(o instanceof IAdaptable)) + adapter = (ISystemRemoteElementAdapter)Platform.getAdapterManager().getAdapter(o,ISystemRemoteElementAdapter.class); + else + adapter = (ISystemRemoteElementAdapter)((IAdaptable)o).getAdapter(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; + } + + /** + * For pathpath access to our adapters for non-local objects in our model. Exploits the knowledge we use singleton adapters. + */ + public SystemViewAdapterFactory getSystemViewAdapterFactory() + { + return SystemPlugin.getDefault().getSystemViewAdapterFactory(); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemBasePlugin.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemBasePlugin.java new file mode 100644 index 00000000000..93e59cb1c55 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemBasePlugin.java @@ -0,0 +1,984 @@ +/******************************************************************************** + * 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.core; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Hashtable; +import java.util.MissingResourceException; +import java.util.PropertyResourceBundle; +import java.util.ResourceBundle; + +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.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.Shell; +import org.eclipse.ui.IWorkbench; +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 +{ + + // instance variables + private Hashtable imageDescriptorRegistry = new Hashtable(); + private ImageRegistry imageRegistry = null; + private boolean headless; + private boolean headlessSet; + + // static variables + private static SystemBasePlugin baseInst = null; + + /** + * Default folder for icons, relative to this plugin's install folder: "icons\". + */ + protected static final String ICON_PATH = "icons" + File.separatorChar; + + /** + * Logger object for logging messages for servicing purposes. + */ + protected static Logger log = null; + + /** + * Constructor. + */ + public SystemBasePlugin() { + super(); + + if (baseInst == null) { + baseInst = this; + } + + headless = false; + headlessSet = false; + } + + // ------------------------ + // STATIC HELPER METHODS... + // ------------------------ + + /** + * Returns the singleton object representing the base plugin. + * @return the singleton object. + */ + public static SystemBasePlugin getBaseDefault() { + return baseInst; + } + + /** + * Returns the symbolic name of the bundle. + * @return the symbolic name of the bundle. + */ + public String getSymbolicName() { + return getBundle().getSymbolicName(); + } + + /** + * Returns the active workbench shell. + * @return the active workbench shell. + */ + public static Shell getActiveWorkbenchShell() { + + IWorkbenchWindow window = getActiveWorkbenchWindow(); + + if (window != null) { + return window.getShell(); + } + + 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 simply return the first one + // KM: why do we need this?? + else { + IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows(); + + if (windows != null && windows.length > 0) { + return windows[0]; + } + } + + return null; + } + else { + return null; + } + } + + /** + * 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(); + } + + // ---------------------------- + // NON-STATIC HELPER METHODS... + // ---------------------------- + + /** + * 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.getInst(this); + log.logInfo("Loading " + this.getClass()); + } + } + + /** + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + logDebugMessage(this.getClass().getName(), "SHUTDOWN"); + LoggerFactory.freeInst(this); + super.stop(context); + } + + /** + * Returns the Platform UI workbench. + *

    + * This method exists as a convenience for plugin implementors. The + * workbench can also be accessed by invoking PlatformUI.getWorkbench(). + *

    + *

    + * 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. + *

    + */ + public IWorkbench getWorkbench() + { + IWorkbench wb = null; + if (headlessSet && headless) // already been here? + return wb; + try { + wb = super.getWorkbench(); + headless = false; + } catch (Exception exc) + { + headless = true; + } + headlessSet = true; + return wb; + } + + // ---------------------------------- + // ICON METHODS... + // ---------------------------------- + + /** + * 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 icon with its + * relative path. + */ + protected abstract void initializeImageRegistry(); + + /** + * Parse the given message file that is in the plugin into memory, into a SystemMessageFile object. + * @param fileName - unqualified name of the .xml message file, inluding the .xml extension. + * @return SystemMessageFile (null if unable to load the file) + */ + public final SystemMessageFile loadMessageFile(String fileName) + { + SystemMessageFile mf = null; + try + { + IPath path = new Path("$nl$/"+fileName); + URL url = Platform.find(getBundle(), path); + + if (url != null) { + url = Platform.resolve(url); + mf = new SystemUIMessageFile(/*url.toString()*/url.getPath(), getBundle().getEntry("/").getPath()); + } + } catch (Exception exc) + { + logError("Error loading message file " + fileName ,exc); + } + return mf; + } + + /** + * Helper to get the typical icons path ... usually just "icons\". + */ + public static String getIconPath() + { + return ICON_PATH; + } + + /** + * Helper method to put an image into the registry + * @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. + */ + protected ImageDescriptor putImageInRegistry(String id, String fileName) + { + ImageDescriptor fid = getPluginImage(fileName); + imageRegistry.put(id, fid); + + // Because ImageRegistry only allows you to get an image, and not an ImageDescriptor, + // we have to redundantly save the image descriptors for cases when they are needed, + // such as in WizardPage.... + imageDescriptorRegistry.put(id, fid); + + if (imageRegistry.get(id) == null) + logError("Error loading image: " + fileName); + + return fid; + } + + /** + * Retrieve image in this plugin's directory tree, given its file name. + * The file name should be qualified relative to this plugin's folder. Eg "icons\myicon.gif" + */ + public ImageDescriptor getPluginImage(String fileName) + { + return getPluginImage(getBundle(), fileName); + } + + /** + * Retrieve image in any plugin's directory tree, given its file name. + * The file name should be qualified relative to this plugin's folder. Eg "icons\myicon.gif" + */ + public static ImageDescriptor getPluginImage(Bundle bundle, String fileName) + { + URL path = bundle.getEntry("/"); + URL fullPathString = null; + try { + fullPathString = new URL(path,fileName); + return ImageDescriptor.createFromURL(fullPathString); + } catch (MalformedURLException e) {} + return null; + } + + /** + * Easy retrieval of image by id + */ + public Image getImage(String key) + { + if (imageRegistry == null) { + imageRegistry = new ImageRegistry(); + initializeImageRegistry(); + } + + Image image = null; + + try + { + image = imageRegistry.get(key); + } + catch (Throwable t) + { + logError("...error retrieving image for key: " + key); + } + return image; + } + + /** + * Easy retrieval of image descriptor by id + */ + public ImageDescriptor getImageDescriptor(String key) + { + if (imageRegistry == null) + { + imageRegistry = new ImageRegistry(); + initializeImageRegistry(); + } + + ImageDescriptor image = (ImageDescriptor)imageDescriptorRegistry.get(key); + + return image; + } + + /** + * Returns an image descriptor from the base IDE. + * @see org.eclipse.ui.views.navigator.ResourceNavigatorActionGroup#getImageDescriptor(java.lang.String) + */ + public ImageDescriptor getImageDescriptorFromIDE(String relativePath) + { + String iconPath = "icons/full/"; //$NON-NLS-1$ + String key = iconPath + relativePath; + ImageDescriptor image = (ImageDescriptor)imageDescriptorRegistry.get(key); + + if (image != null) + return image; + + try { + Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID); + URL installURL = bundle.getEntry("/"); + URL url = new URL(installURL, key); + image = ImageDescriptor.createFromURL(url); + imageDescriptorRegistry.put(key, image); + return image; + } catch (MalformedURLException e) { + // should not happen + return ImageDescriptor.getMissingImageDescriptor(); + } + } + + // ---------------------------------------- + // TRANSLATABLE RESOURCE-RELATED METHODS... + // ---------------------------------------- + + /** + * Sets the resource bundle. Called by child class in their + * constructor, say, to load in their resource bundle. Handles + * rare case when not found by telling user, then dying. + * Note: This is NOT to be used for plugin.properties since Eclipse handles that file differently. + * @param descriptor for the plugin where the file is + * @param name of .properties file, without the '.properties' specified + * @return ResourceBundle if loaded successfully, null if not. + */ + public static final ResourceBundle loadResourceBundle(Bundle bundle, String fileName) + { + ResourceBundle rb = null; + boolean ok = false; + try + { + IPath path = new Path("$nl$/"+fileName+".properties"); + URL url = Platform.find(bundle, path); + logDebugMessage("SystemBasePlugin", "Trying this now: " + url.toString()); + rb = new PropertyResourceBundle(url.openStream()); + ok = true; + } + catch (Exception exc) + { + logError("SystemBasePlugin - try for resource bundle " + fileName + " not successful!",exc); + } + + 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) { + org.eclipse.swt.widgets.MessageBox mb = new org.eclipse.swt.widgets.MessageBox(s); + mb.setText("Unexcepted Error"); + mb.setMessage("Unable to load resource file " + fileName + ".properties"); + mb.open(); + } + } + + return rb; + } + + + /** + * Returns the plugin.properties resource bundle associated with the specified plugin descriptor + * + * @param descriptor for the plugin where the file is + * @return ResourceBundle if loaded successfully, null if not. + */ + public static final ResourceBundle loadPluginResourceBundle(Bundle bundle) + { + ResourceBundle rb = null; + try + { + rb = Platform.getResourceBundle(bundle); + } + catch (Exception exc) + { + logInfo("try for resource bundle plugin.properties not successful!"); + } + + return rb; + } + + + + /** + * Sets the default resource bundle for handling cases where strings aren't translated. Called by child class in their + * constructor, say, to load in their resource bundle. Handles + * rare case when not found by telling user, then dying. + * Note: This is NOT to be used for plugin.properties since Eclipse handles that file differently. + * @param descriptor for the plugin where the file is + * @param name of .properties file, without the '.properties' specified + * @return ResourceBundle if loaded successfully, null if not. + */ + public static final ResourceBundle loadDefaultResourceBundle(Bundle bundle, + String fileName) + { + ResourceBundle rb = null; + boolean ok = false; + try + { + IPath path = new Path(fileName+".properties"); + URL url = Platform.find(bundle, path); + logDebugMessage("SystemBasePlugin", "Trying this now: " + url.toString()); + rb = new PropertyResourceBundle(url.openStream()); + ok = true; + } + catch (Exception exc) + { + logError("SystemBasePlugin - try for resource bundle " + fileName + " not successful!",exc); + } + + 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) { + org.eclipse.swt.widgets.MessageBox mb = new org.eclipse.swt.widgets.MessageBox(s); + mb.setText("Unexcepted Error"); + mb.setMessage("Unable to load resource file " + fileName + ".properties"); + mb.open(); + } + } + + return rb; + } + + /** + * Sets the resource bundle. Called by child class in their + * constructor, say, to load in their resource bundle. Handles + * rare case when not found by telling user, then dying. + * Note: This is NOT to be used for plugin.properties since Eclipse handles that file differently. + * @param name of .properties file, without the '.properties' specified + * @return ResourceBundle if loaded successfully, null if not. + */ + public final ResourceBundle loadResourceBundle(String fileName) + { + ResourceBundle rb = null; + try { + IPath path = new Path("$nl$/"+fileName+".properties"); + URL url = Platform.find(getBundle(), path); + if ( url != null ) + { + InputStream in = url.openStream(); + rb = new PropertyResourceBundle(in); + in.close(); + } + else + logError("SystemBasePlugin - try for resource bundle " + fileName + " not successful!",null); + } catch (IOException e) { + logError("SystemBasePlugin - try for resource bundle " + fileName + " not successful!",e); + } + return rb; + } + + /** + * Sets the default resource bundle (so that untranslated strings can be obtained). Called by child class in their + * constructor, say, to load in their resource bundle. Handles + * rare case when not found by telling user, then dying. + * Note: This is NOT to be used for plugin.properties since Eclipse handles that file differently. + * @param name of .properties file, without the '.properties' specified + * @return ResourceBundle if loaded successfully, null if not. + */ + public final ResourceBundle loadDefaultResourceBundle(String fileName) + { + ResourceBundle rb = null; + try { + + IPath path = new Path(fileName+".properties"); + URL url = Platform.find(getBundle(), path); + if ( url != null ) + { + InputStream in = url.openStream(); + rb = new PropertyResourceBundle(in); + in.close(); + } + else + logError("SystemBasePlugin - try for resource bundle " + fileName + " not successful!",null); + } catch (IOException e) { + logError("SystemBasePlugin - try for resource bundle " + fileName + " not successful!",e); + } + return rb; + } + + + /** + * Get a string from a given resource bundle. + * If not found, stack trace info is placed in the + * plugin's log file to help pinpoint the offending code. + */ + public static String getString(ResourceBundle resourceBundle, String key) + { + try + { + return resourceBundle.getString(key); + } + catch (MissingResourceException exc) + { + SystemBasePlugin.logError("Missing resource: " + key, exc); + } + return null; + } + /** + * Get a string from a given resource bundle, with an english string to + * use a default if the given key is not found. + *

    + * If not found, stack trace info is placed in the + * plugin's log file to help pinpoint the offending code. + */ + public static String getString(ResourceBundle resourceBundle, String key, String defaultString) + { + String s = defaultString; + try + { + s = resourceBundle.getString(key); + } + catch (MissingResourceException exc) + { + SystemBasePlugin.logError("Missing resource: " + key, exc); + } + return s; + } + + // ------------------ + // MESSAGE METHODS... + // ------------------ + + /** + * Parse the given message file into memory, into a SystemMessageFile object. + * @param descriptor - 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 + { + IPath path = new Path("$nl$/"+fileName); + URL url = Platform.find(bundle, path); + + if (url!=null) { + url = Platform.resolve(url); + URL temp = Platform.getBundle(SystemPlugin.PLUGIN_ID).getEntry("/"); + temp = Platform.resolve(temp); + url = Platform.resolve(url); + mf = new SystemUIMessageFile(url.getPath(), temp.getFile()); + ok = true; + } + } catch (Throwable t) + { + logError("Error loading message file " + fileName + " in " + bundle.getHeaders().get(org.osgi.framework.Constants.BUNDLE_NAME), t); + ok = false; // DY + } + if (!ok) + { + org.eclipse.swt.widgets.MessageBox mb = new org.eclipse.swt.widgets.MessageBox(getActiveWorkbenchShell()); + mb.setText("Unexpected Error"); + mb.setMessage("Unable to load message file " + fileName + " in " + 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 descriptor - 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 + { + IPath path = new Path(fileName); + URL url = Platform.find(bundle, path); + //URL url = new URL(descriptor.getInstallURL(), fileName); + if (url!=null) { + url = Platform.resolve(url); + mf = new SystemUIMessageFile(/*url.toString()*/url.getPath(), bundle.getEntry("/").getPath()); + ok = true; + } + } catch (Throwable t) + { + logError("Error loading message file " + fileName + " in " + 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) { + org.eclipse.swt.widgets.MessageBox mb = new org.eclipse.swt.widgets.MessageBox(s); + mb.setText("Unexpected Error"); + mb.setMessage("Unable to load message file " + fileName + " in " + bundle.getHeaders().get(org.osgi.framework.Constants.BUNDLE_NAME)); + mb.open(); + } + } + + return mf; + } + + /** + * Parse the given message file that is in the plugin into memory, into a SystemMessageFile object. + * @param fileName - unqualified name of the .xml message file, inluding the .xml extension. + * @return SystemMessageFile (null if unable to load the file) + */ + public final SystemMessageFile loadDefaultMessageFile(String fileName) + { + SystemMessageFile mf = null; + try + { + IPath path = new Path(fileName); + URL url = Platform.find(getBundle(), path); + + if (url != null) { + url = Platform.resolve(url); + mf = new SystemUIMessageFile(/*url.toString()*/url.getPath(), getBundle().getEntry("/").getPath()); + } + } catch (Exception exc) + { + logError("Error loading message file " + fileName ,exc); + } + 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."); + + if ( msg == null ) + logWarning("Unable to find message ID: " + msgId); + return msg; + } + + /** + * Scan this plugin's message file for duplicates. This just calls the {@link org.eclipse.rse.ui.messages.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 org.eclipse.rse.ui.messages.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); + } + + /** + * Put up an error message when a programming error is detected. + * Please note this should never happen in production so we don't translate! + */ + public void showProgrammerErrorMessage(String msg) + { + org.eclipse.swt.widgets.MessageBox mb = new org.eclipse.swt.widgets.MessageBox(null); + //mb.setTitle("Remote Systems Programming Error"); + String errmsg = "Programming Error: " + msg; + mb.setMessage(errmsg); + mb.open(); + logError(errmsg); + } + + + // ----------------- + // 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. + *

    + * 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); + } + + /** + * Helper method for logging warnings to the RSE-style logging file. + * This file is located in the .metadata subfolder for this plugin. + *

    + * 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. + *

    + * 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. + *

    + * 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. + *

    + * Debug messages are only logged when running this plugin in the workbench, + * and when Logger.DEBUG has been set to true. + * + * @param classname - 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) + { + if (Logger.DEBUG) + { + log.logDebugMessage(prefix, message); + } + } + + /** + * 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. + */ + public boolean isHeadless() + { + if (!headlessSet) + getWorkbench(); + return headless; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemElapsedTimer.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemElapsedTimer.java new file mode 100644 index 00000000000..d7049501633 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemElapsedTimer.java @@ -0,0 +1,94 @@ +/******************************************************************************** + * 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.core; +import java.io.PrintWriter; + +/** + * A utility helper class to help when making timings of potentially + * long operations, such as remote system calls. + */ +public class SystemElapsedTimer +{ + + + + private long startTime; + private long endTime; + + public SystemElapsedTimer() + { + setStartTime(); + } + public void setStartTime() + { + startTime = System.currentTimeMillis(); + } + public SystemElapsedTimer setEndTime() + { + endTime = System.currentTimeMillis(); + return this; + } + public long getElapsedTime() + { + return (endTime - startTime); + } + public String toString() + { + long deltaMillis = getElapsedTime(); + // deltaMillis = n + s*1000 + m*60*1000 + h*60*60*1000; + long millis = (deltaMillis) %1000; + long deltaSeconds = (deltaMillis) /1000; + long deltaMinutes = deltaSeconds / 60; + long hours = (int)(deltaMillis / (60 * 60 * 1000)); + long minutes= (int)(deltaMinutes - (hours*60) ); + long seconds= (int)(deltaSeconds - (hours*60*60) - (minutes*60)); + String result = "Elapsed time: " + hours + " hours, " + + minutes + " minutes, " + + seconds + " seconds, " + + millis + " milliseconds"; + return result; + } + public void writeElapsedTime(PrintWriter writer, String header) + { + writer.println(header); + writer.println(toString()); + writer.flush(); + } + // the following methods are for testing purposes only + public static void main(String args[]) + { + SystemElapsedTimer me = new SystemElapsedTimer(); + me.setET(5, 4, 3, 100); + System.out.println(me); + me.setET(25, 14, 53, 999); + System.out.println(me); + me.setET(25, 0, 53, 0); + System.out.println(me); + me.setET(0, 0, 13, 0); + System.out.println(me); + } + public void setET(long h, long m, long s, long n) + { + long et = n + s*1000 + m*60*1000 + h*60*60*1000; + setET(et); + } + public void setET(long givenET) + { + startTime = 0L; + endTime = givenET; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPerspectiveHelpers.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPerspectiveHelpers.java new file mode 100644 index 00000000000..a2681932062 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPerspectiveHelpers.java @@ -0,0 +1,190 @@ +/******************************************************************************** + * 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.core; +import org.eclipse.rse.ui.view.SystemPerspectiveLayout; +import org.eclipse.rse.ui.view.SystemView; +import org.eclipse.rse.ui.view.SystemViewPart; +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); + } + 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); + } + } //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/systems/org/eclipse/rse/core/SystemPlugin.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPlugin.java new file mode 100644 index 00000000000..b1fbed8f0ec --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPlugin.java @@ -0,0 +1,1632 @@ +/******************************************************************************** + * 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.core; + +import java.net.InetAddress; +import java.util.ArrayList; +import java.util.List; +import java.util.StringTokenizer; +import java.util.Vector; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IAdapterManager; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.IProduct; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.rse.core.comm.ISystemKeystoreProvider; +import org.eclipse.rse.core.comm.SystemCommunicationsDaemon; +import org.eclipse.rse.core.comm.SystemKeystoreProviderManager; +import org.eclipse.rse.core.internal.subsystems.SubSystemConfigurationProxy; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy; +import org.eclipse.rse.internal.model.SystemProfileManager; +import org.eclipse.rse.internal.model.SystemRegistry; +import org.eclipse.rse.internal.persistence.RSEPersistenceManager; +import org.eclipse.rse.model.ISystemProfileManager; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.SystemResourceChangeEvent; +import org.eclipse.rse.model.SystemStartHere; +import org.eclipse.rse.persistence.IRSEPersistenceManager; +import org.eclipse.rse.persistence.IRSEPersistenceProvider; +import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.services.clientserver.messages.SystemMessageFile; +import org.eclipse.rse.ui.ISystemIconConstants; +import org.eclipse.rse.ui.ISystemPreferencesConstants; +import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.actions.ISystemDynamicPopupMenuExtension; +import org.eclipse.rse.ui.actions.SystemDynamicPopupMenuExtensionManager; +import org.eclipse.rse.ui.actions.SystemShowPreferencesPageAction; +import org.eclipse.rse.ui.propertypages.RemoteSystemsPreferencePage; +import org.eclipse.rse.ui.propertypages.SystemCommunicationsPreferencePage; +import org.eclipse.rse.ui.propertypages.SystemTypeFieldEditor; +import org.eclipse.rse.ui.view.SubsystemFactoryAdapterFactory; +import org.eclipse.rse.ui.view.SystemViewAdapterFactory; +import org.eclipse.rse.ui.view.team.SystemTeamViewResourceAdapterFactory; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; + + +/** + * Plugin for the core remote systems support. + */ +public class SystemPlugin extends SystemBasePlugin +{ + public static final String PLUGIN_ID = "org.eclipse.rse.ui"; + public static final String HELPPREFIX = "org.eclipse.rse.ui."; + + public static final boolean INCLUDE_LOCAL_YES = true; + public static final boolean INCLUDE_LOCAL_NO = false; + private static SystemPlugin inst = null; + + private static SystemMessageFile messageFile = null; + private static SystemMessageFile defaultMessageFile = null; + + private SystemType[] allSystemTypes = null; + private String enabledSystemTypes; + private ISystemRegistry _systemRegistry = null; + + + private IRSEPersistenceManager _persistenceManager = null; + + private ISubSystemConfigurationProxy[] subsystemFactories = null; + + + private static String machineName = null; + private static String machineIP = null; + private Vector viewSuppliers = new Vector(); + private SystemViewAdapterFactory svaf; // for fastpath access + private SystemTeamViewResourceAdapterFactory svraf; // for fastpath + private SystemShowPreferencesPageAction[] showPrefPageActions = null; + private boolean dontShowLocalConnection, dontShowProfilePageInitially; + + /** + * Constructor for SystemsPlugin + */ + public SystemPlugin() + { + super(); + + if (inst == null) + { + inst = this; + } + } + + /** + * Return singleton. Same as inherited getBaseDefault but returned object + * is typed as SystemPlugin versus SystemBasePlugin. + */ + public static SystemPlugin getDefault() + { + return inst; + } + + /** + * Initializes default preferences. + */ + public void initializeDefaultPreferences() { + + String productId = null; + + // get product + IProduct product = Platform.getProduct(); + + // get product ID if there is a product + if (product != null) { + productId = product.getId(); + } + else { + // DKM - why would we return just because there's no product id? + // letting this continue + //return; + } + + // Get reference to the plug-in registry + IExtensionRegistry registry = Platform.getExtensionRegistry(); + + // Get configured extenders + IConfigurationElement[] extensions = registry.getConfigurationElementsFor("org.eclipse.rse.ui", "rseConfigDefaults"); + + boolean showNewConnPromptPref = ISystemPreferencesConstants.DEFAULT_SHOWNEWCONNECTIONPROMPT; + dontShowLocalConnection = false; + dontShowProfilePageInitially = false; + + if ( (extensions != null) && (extensions.length > 0)) + { + String showNewConn; + String showProfileInitially; + + for (int idx = 0; idx < extensions.length; idx++) + { + IConfigurationElement extension = extensions[idx]; + + String configProductId = extension.getAttribute("productId"); + + if (productId.equals(configProductId)) { + + showNewConn = extension.getAttribute("showNewConnectionPrompt"); + + if (showNewConn != null) + showNewConnPromptPref = showNewConn.equals("true"); + + showNewConn = extension.getAttribute("showLocalConnection"); + + if (showNewConn != null) + dontShowLocalConnection = showNewConn.equals("false"); + + enabledSystemTypes = extension.getAttribute("enableSystemTypes"); + + if ((enabledSystemTypes != null) && (enabledSystemTypes.length() == 0)) + enabledSystemTypes = null; + + showProfileInitially = extension.getAttribute("showProfilePage"); + + if (showProfileInitially != null) + dontShowProfilePageInitially = showProfileInitially.equals("false"); + } + } + } + + RemoteSystemsPreferencePage.initDefaults(getPreferenceStore(), showNewConnPromptPref); + SystemCommunicationsPreferencePage.initDefaults(getPreferenceStore()); + } + + /** + * Returns whether to show profile page initially, i.e. during the first new connection creation. + * @return true to show profile page initially, false otherwise. + */ + public boolean getShowProfilePageInitially() { + return !dontShowProfilePageInitially; + } + + /** + * Initialize the image registry by declaring all of the required + * graphics. + */ + 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_USERACTION_NEW_ID, + path+ISystemIconConstants.ICON_SYSTEM_USERACTION_NEW); + putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_USERACTION_USR_ID, + path+ISystemIconConstants.ICON_SYSTEM_USERACTION_USR); + putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_USERACTION_IBM_ID, + path+ISystemIconConstants.ICON_SYSTEM_USERACTION_IBM); + putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_USERACTION_IBMUSR_ID, + path+ISystemIconConstants.ICON_SYSTEM_USERACTION_IBMUSR); + + putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_USERTYPE_NEW_ID, + path+ISystemIconConstants.ICON_SYSTEM_USERTYPE_NEW); + putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_USERTYPE_USR_ID, + path+ISystemIconConstants.ICON_SYSTEM_USERTYPE_USR); + putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_USERTYPE_IBM_ID, + path+ISystemIconConstants.ICON_SYSTEM_USERTYPE_IBM); + putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_USERTYPE_IBMUSR_ID, + path+ISystemIconConstants.ICON_SYSTEM_USERTYPE_IBMUSR); + + putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_COMPILE_NEW_ID, + path+ISystemIconConstants.ICON_SYSTEM_COMPILE_NEW); + putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_COMPILE_USR_ID, + path+ISystemIconConstants.ICON_SYSTEM_COMPILE_USR); + putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_COMPILE_IBM_ID, + path+ISystemIconConstants.ICON_SYSTEM_COMPILE_IBM); + putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_COMPILE_IBMUSR_ID, + path+ISystemIconConstants.ICON_SYSTEM_COMPILE_IBMUSR); + + 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_ENVVAR_ID, + path+ISystemIconConstants.ICON_SYSTEM_ENVVAR); + putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_ENVVAR_LIBPATH_ID, + path+ISystemIconConstants.ICON_SYSTEM_ENVVAR_LIBPATH); + putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_ENVVAR_PATH_ID, + path+ISystemIconConstants.ICON_SYSTEM_ENVVAR_PATH); + 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(ISystemConstants.ICON_SYSTEM_REFRESH_ID, + // path+ISystemConstants.ICON_SYSTEM_REFRESH); D54577 + + 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 + + putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_EXTRACT_ID, + path+ISystemIconConstants.ICON_SYSTEM_EXTRACT); + putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_EXTRACTTO_ID, + path+ISystemIconConstants.ICON_SYSTEM_EXTRACTTO); + putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_COMBINE_ID, + path+ISystemIconConstants.ICON_SYSTEM_COMBINE); + putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_CONVERT_ID, + path+ISystemIconConstants.ICON_SYSTEM_CONVERT); + + + + + + + // 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_SHELL_ID, + path+ISystemIconConstants.ICON_SYSTEM_SHELL); + putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_SHELLLIVE_ID, + path+ISystemIconConstants.ICON_SYSTEM_SHELLLIVE); + putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_REMOVE_SHELL_ID, + path+ISystemIconConstants.ICON_SYSTEM_REMOVE_SHELL); + + putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_EXPORT_SHELL_OUTPUT_ID, + path+ISystemIconConstants.ICON_SYSTEM_EXPORT_SHELL_OUTPUT); + putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_EXPORT_SHELL_HISTORY_ID, + path+ISystemIconConstants.ICON_SYSTEM_EXPORT_SHELL_HISTORY); + + 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 + { + + // call super first + super.start(context); + + messageFile = getMessageFile("systemmessages.xml"); + defaultMessageFile = getDefaultMessageFile("systemmessages.xml"); + + SystemResourceManager.getRemoteSystemsProject(); // create core folder tree + try + { + SystemStartHere.getSystemProfileManager(); // create folders per profile + } + catch (Exception e) + { + e.printStackTrace(); + } + + IAdapterManager manager = Platform.getAdapterManager(); + + // DKM + // for subsystem factories + SubsystemFactoryAdapterFactory ssfaf = new SubsystemFactoryAdapterFactory(); + ssfaf.registerWithManager(manager); + + svaf = new SystemViewAdapterFactory(); + svaf.registerWithManager(manager); + + svraf = new SystemTeamViewResourceAdapterFactory(); + svraf.registerWithManager(manager); + + + getInstallLocation(); + + //org.eclipse.rse.core.ui.uda.UserDefinedActionAdapterFactory udaaf = new org.eclipse.rse.core.ui.uda.UserDefinedActionAdapterFactory(); + //udaaf.registerWithManager(manager); + + // DKM - 49648 - need to make sure that this is first called on the main thread so + // we don't hit an SWT invalid thread exception later when getting the shell + ISystemRegistry registry = getSystemRegistry(); + + + + // add workspace listener for our project + SystemResourceManager.startResourceEventListening(); + + // DKM - moved to files.ui plugin + // refresh the remote edit project at plugin startup, to ensure + // it's never closed + // SystemRemoteEditManager.getDefault().refreshRemoteEditProject(); + + // Auto-start RSE communications daemon if required + SystemCommunicationsDaemon daemon = SystemCommunicationsDaemon.getInstance(); + + if (SystemCommunicationsDaemon.isAutoStart()) { + daemon.startDaemon(false); + } + + registerArchiveHandlers(); + registerDynamicPopupMenuExtensions(); + registerKeystoreProviders(); + registerPersistenceProviders(); + + // if first time creating the remote systems project, add some default connections... + if (SystemResourceManager.isFirstTime() + && !dontShowLocalConnection) // new support to allow products to not pre-create a local connection + { + //try + //{ + registry.createLocalHost(null, SystemResources.TERM_LOCAL, getLocalMachineName()); // profile, name, userId + /* replaced with re-usable method by Phil, in v5.1.2 + SystemConnection localConn = registry.createConnection( + //SystemResourceConstants.RESOURCE_TEAMPROFILE_NAME, ISystemTypes.SYSTEMTYPE_LOCAL, + SystemResourceConstants.RESOURCE_PRIVATEPROFILE_NAME, ISystemTypes.SYSTEMTYPE_LOCAL, + getString(ISystemConstants.TERM_LOCAL, "Local"), // connection name + "localhost", // hostname + "", // description + // DY: defect 42101, description cannot be null + // null, // description + getLocalMachineName(), // userId + ISystemUserIdConstants.USERID_LOCATION_DEFAULT_SYSTEMTYPE, null); + */ + //} + //catch (Exception exc) + //{ + //logError("Error creating default Local connection", exc); + //} + } + } + + /** + * For pathpath access to our adapters for non-local objects in our model. Exploits the knowledge we use singleton adapters. + */ + public SystemViewAdapterFactory getSystemViewAdapterFactory() + { + return svaf; + } + + + /** + * Restart the whole thing after a team synchronization + */ + public void restart() + { + if (_systemRegistry != null) + { + // disconnect all active connections + disconnectAll(false); // don't save ? + // collapse and flush all nodes in all views + _systemRegistry.fireEvent(new SystemResourceChangeEvent("dummy", ISystemResourceChangeEvents.EVENT_COLLAPSE_ALL, null)); + + // allow child classes to override + closeViews(); + + // clear in-memory settings for all filter pools and subsystems + ISubSystemConfigurationProxy[] proxies = getSystemRegistry().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 + SystemStartHere.getSystemProfileManager(); // create folders per profile + // clear in-memory settings for all connections, then restore from disk + ((SystemRegistry)_systemRegistry).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 + _systemRegistry.fireEvent(new SystemResourceChangeEvent(_systemRegistry, 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 + * This may return null if there are no extenders. + */ + public SystemShowPreferencesPageAction[] getShowPreferencePageActions() + { + if (showPrefPageActions == null) + { + IConfigurationElement[] showPrefPagePlugins = getPreferencePageActionPlugins(); + if (showPrefPagePlugins != null) + { + Vector v = new Vector(); + for (int idx=0; idx0)) + { + action.setPreferencePageID(prefPageId); + } + String prefPageCategory = showPrefPagePlugins[idx].getAttribute("preferencePageCategory"); + if ((prefPageCategory!=null)&&(prefPageCategory.length()>0)) + { + action.setPreferencePageCategory(prefPageCategory); + } + String iconFile = showPrefPagePlugins[idx].getAttribute("icon"); + + if ((iconFile!=null)&&(iconFile.length()>0)) + { + // get namespace of extension (i.e. the id of the declaring plugin) + String nameSpace = showPrefPagePlugins[idx].getDeclaringExtension().getNamespace(); + + // now get the associated bundle + Bundle bundle = Platform.getBundle(nameSpace); + + ImageDescriptor id = getPluginImage(bundle, iconFile); + + if (id != null) { + action.setImageDescriptor(id); + } + } + String label = showPrefPagePlugins[idx].getAttribute("label"); + if ((label!=null)&&(label.length()>0)) + { + action.setText(label); + } + String tooltip = showPrefPagePlugins[idx].getAttribute("tooltip"); + if ((tooltip!=null)&&(tooltip.length()>0)) + { + action.setToolTipText(tooltip); + } + String heldId = showPrefPagePlugins[idx].getAttribute("helpContextId"); + if ((heldId!=null)&&(heldId.length()>0)) + { + action.setHelp(heldId); + } + v.addElement(action); + } // end for all plugins loop + showPrefPageActions = new SystemShowPreferencesPageAction[v.size()]; + for (int idx=0; idx0) && (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 subsVars - an array of objects to substitute in for %1, %2, etc + */ + 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; + } + + /** + * Return the local user's machine name + */ + public static String getLocalMachineName() + { + if (machineName == null) + { + try + { + //InetAddress ip = InetAddress.getByName("localhost"); + machineName = InetAddress.getLocalHost().getHostName(); + }catch(Exception exc) + { + machineName = ""; // ? what else ? no point in trying again. + logWarning("Exception getting local hostname: " + exc.getClass().getName() + ": " + exc.getMessage()); + } + } + return machineName; + } + /** + * Return the local user's IP address + */ + public static String getLocalMachineIPAddress() + { + if (machineIP == null) + { + try + { + //InetAddress ip = InetAddress.getByName("localhost"); + machineIP = InetAddress.getLocalHost().getHostAddress(); + }catch(Exception exc) + { + machineIP = ""; // ? what else ? no point in trying again. + logWarning("Exception getting local hostname: " + exc.getClass().getName() + ": " + exc.getMessage()); + } + } + return machineIP; + } + + /** + * 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); + } + + /** + * Initializes the Archive Handler Manager, by registering archive \ + * file types with their handlers. + * @author mjberger + */ + protected void registerArchiveHandlers() + { + // Get reference to the plug-in registry + IExtensionRegistry registry = Platform.getExtensionRegistry(); + + // Get configured extenders + IConfigurationElement[] systemTypeExtensions = registry.getConfigurationElementsFor("org.eclipse.rse.ui", "archivehandlers"); + + for (int i = 0; i < systemTypeExtensions.length; i++) { + String ext = systemTypeExtensions[i].getAttribute("fileNameExtension"); + if (ext.startsWith(".")) ext = ext.substring(1); + String handlerType = systemTypeExtensions[i].getAttribute("class"); + try + { + // get the name space of the declaring extension + String nameSpace = systemTypeExtensions[i].getDeclaringExtension().getNamespace(); + + // use the name space to get the bundle + Bundle bundle = Platform.getBundle(nameSpace); + + // if the bundle has not been uninstalled, then load the handler referred to in the + // extension, and load it using the bundle + // then register the handler + if (bundle.getState() != Bundle.UNINSTALLED) { + Class handler = bundle.loadClass(handlerType); + ArchiveHandlerManager.getInstance().setRegisteredHandler(ext, handler); + } + } + catch (ClassNotFoundException e) + { + logError("Cound not find archive handler class", e); + } + } + } + + + /** + * Initializes the System View Adapter Menu Extension Manager, by registering menu extensions + */ + protected void registerDynamicPopupMenuExtensions() + { + // Get reference to the plug-in registry + IExtensionRegistry registry = Platform.getExtensionRegistry(); + + // Get configured extenders + IConfigurationElement[] systemTypeExtensions = registry.getConfigurationElementsFor("org.eclipse.rse.ui", "dynamicPopupMenuExtensions"); + + for (int i = 0; i < systemTypeExtensions.length; i++) + { + try + { + // get the name space of the declaring extension + String nameSpace = systemTypeExtensions[i].getDeclaringExtension().getNamespace(); + + String menuExtensionType = systemTypeExtensions[i].getAttribute("class"); + + // use the name space to get the bundle + Bundle bundle = Platform.getBundle(nameSpace); + + // if the bundle has not been uninstalled, then load the handler referred to in the + // extension, and load it using the bundle + // then register the handler + if (bundle.getState() != Bundle.UNINSTALLED) + { + Class menuExtension = bundle.loadClass(menuExtensionType); + + ISystemDynamicPopupMenuExtension extension = (ISystemDynamicPopupMenuExtension)menuExtension.getConstructors()[0].newInstance(null); + SystemDynamicPopupMenuExtensionManager.getInstance().registerMenuExtension(extension); + } + } + catch (Exception e) + { + e.printStackTrace(); + } + } + } + + protected void registerPersistenceProviders() + { + // Get reference to the plug-in registry + IExtensionRegistry registry = Platform.getExtensionRegistry(); + + // Get configured extenders + IConfigurationElement[] systemTypeExtensions = registry.getConfigurationElementsFor("org.eclipse.rse.ui", "persistanceProviders"); + + for (int i = 0; i < systemTypeExtensions.length; i++) + { + try + { + // get the name space of the declaring extension + String nameSpace = systemTypeExtensions[i].getDeclaringExtension().getNamespace(); + + String persistanceProviderType = systemTypeExtensions[i].getAttribute("class"); + + // use the name space to get the bundle + Bundle bundle = Platform.getBundle(nameSpace); + + + if (bundle.getState() != Bundle.UNINSTALLED) + { + Class persistanceProvider = bundle.loadClass(persistanceProviderType); + + IRSEPersistenceProvider extension = (IRSEPersistenceProvider)persistanceProvider.getConstructors()[0].newInstance(null); + getPersistenceManager().registerRSEPersistenceProvider(extension); + } + } + catch (Exception e) + { + e.printStackTrace(); + } + } + } + + protected void registerKeystoreProviders() + { + // Get reference to the plug-in registry + IExtensionRegistry registry = Platform.getExtensionRegistry(); + + // Get configured extenders + IConfigurationElement[] systemTypeExtensions = registry.getConfigurationElementsFor("org.eclipse.rse.ui", "keystoreProviders"); + + for (int i = 0; i < systemTypeExtensions.length; i++) + { + try + { + // get the name space of the declaring extension + String nameSpace = systemTypeExtensions[i].getDeclaringExtension().getNamespace(); + + String keystoreProviderType = systemTypeExtensions[i].getAttribute("class"); + + // use the name space to get the bundle + Bundle bundle = Platform.getBundle(nameSpace); + + + if (bundle.getState() != Bundle.UNINSTALLED) + { + Class keystoreProvider = bundle.loadClass(keystoreProviderType); + + ISystemKeystoreProvider extension = (ISystemKeystoreProvider)keystoreProvider.getConstructors()[0].newInstance(null); + SystemKeystoreProviderManager.getInstance().registerKeystoreProvider(extension); + } + } + catch (Exception e) + { + e.printStackTrace(); + } + } + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPopupMenuActionContributor.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPopupMenuActionContributor.java new file mode 100644 index 00000000000..3c74f83ac35 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPopupMenuActionContributor.java @@ -0,0 +1,594 @@ +/******************************************************************************** + * 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.core; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IAdapterManager; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.action.AbstractGroupMarker; +import org.eclipse.jface.action.GroupMarker; +import org.eclipse.jface.action.IContributionItem; +import org.eclipse.jface.action.IContributionManager; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.ui.SystemMenuManager; +import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.internal.ActionDescriptor; +import org.eclipse.ui.internal.ActionExpression; +import org.eclipse.ui.internal.IObjectActionContributor; +import org.eclipse.ui.internal.ObjectFilterTest; +import org.eclipse.ui.internal.ObjectPluginAction; +import org.eclipse.ui.internal.PluginAction; +import org.eclipse.ui.internal.PluginActionBuilder; +import org.eclipse.ui.internal.PluginActionContributionItem; + +/** + * This class parses the tag from our + * org.eclipse.rse.core.PopupMenus extension point. + *

    + * We modelled our org.eclipse.rse.core.popupMenus extension point + * after the org.eclipse.ui.popupMenus extension point, so it makes sense to model + * the code to support it after the Eclipse code to support theirs. + * To that end, we have to replace the class that parses the tag, + * because that class does not support subclassing, and change it to: + *

      + *
    • Ignore all processing of the objectClass attribute, because we don't have one. + *
    • Add processing for the filter attributes we added: subsystemconfigurationid, + * namefilter, typecategoryfilter, + * typefilter, subtypefilter, subsubtypefilter + *
    + * + * TODO use overrides list + * + * @see SystemPopupMenuActionContributorManager + */ +public class SystemPopupMenuActionContributor extends PluginActionBuilder implements IObjectActionContributor { + + private static final String ATT_TYPE_CATEGORY_FILTER = "typecategoryfilter"; //$NON-NLS-1$ + private static final String ATT_NAME_FILTER = "namefilter"; //$NON-NLS-1$ + private static final String ATT_TYPE_FILTER = "typefilter"; //$NON-NLS-1$ + private static final String ATT_SUBTYPE_FILTER = "subtypefilter"; //$NON-NLS-1$ + private static final String ATT_SUBSUBTYPE_FILTER = "subsubtypefilter"; //$NON-NLS-1$ + private static final String ATT_SUBSYSTEM_FACTORY_ID = "subsystemconfigurationid"; //$NON-NLS-1$ + private static final String ATT_SUBSYSTEM_FACTORY_CATEGORY = "subsystemconfigurationCategory"; //$NON-NLS-1$ + private static final String ATT_SYSTEM_TYPES = "systemtypes"; //$NON-NLS-1$ + private static final String ATT_ID = "id"; //$NON-NLS-1$ + private static final String ATT_NAME = "name"; //$NON-NLS-1$ + private static final String ATT_LABEL = "label"; //$NON-NLS-1$ + private static final String ATT_PATH = "path"; //$NON-NLS-1$ + private static final String TAG_OBJECT_CONTRIBUTION = "objectContribution";//$NON-NLS-1$ + private static final String TAG_MENU = "menu"; //$NON-NLS-1$ + private static final String TAG_ACTION = "action"; //$NON-NLS-1$ + private static final String TAG_SEPARATOR = "separator"; //$NON-NLS-1$ + private static final String TAG_FILTER = "filter"; //$NON-NLS-1$ + private static final String TAG_VISIBILITY = "visibility"; //$NON-NLS-1$ + private static final String TAG_GROUP_MARKER = "groupMarker"; //$NON-NLS-1$ + private IConfigurationElement config; + private List cachedMenus; + private List cachedActions; + private boolean configRead = false; + private ObjectFilterTest filterTest; + private ActionExpression visibilityTest; + private SystemRemoteObjectMatcher matcher = null; + + /** + * Constructor for SystemPopupMenuActionContributor + */ + public SystemPopupMenuActionContributor(IConfigurationElement element) { + super(); + config = element; + cachedMenus = new ArrayList(); + cachedActions = new ArrayList(); + String categoryfilter = element.getAttribute(ATT_TYPE_CATEGORY_FILTER); + String namefilter = element.getAttribute(ATT_NAME_FILTER); + String typefilter = element.getAttribute(ATT_TYPE_FILTER); + String subtypefilter = element.getAttribute(ATT_SUBTYPE_FILTER); + String subsubtypefilter = element.getAttribute(ATT_SUBSUBTYPE_FILTER); + String subsystemfilter = element.getAttribute(ATT_SUBSYSTEM_FACTORY_ID); + String subsystemCategoryFilter = element.getAttribute(ATT_SUBSYSTEM_FACTORY_CATEGORY); + String systypes = element.getAttribute(ATT_SYSTEM_TYPES); + matcher = new SystemRemoteObjectMatcher(subsystemfilter, subsystemCategoryFilter, categoryfilter, systypes, namefilter, typefilter, subtypefilter, subsubtypefilter); + } + + /** + * Return what was specified for the typecategoryfilter xml attribute. + */ + public String getCategoryFilter() { + return matcher.getCategoryFilter(); + } + + /** + * Return what was specified for the namefilter xml attribute. + */ + public String getNameFilter() { + return matcher.getNameFilter(); + } + + /** + * Return what was specified for the typefilter xml attribute. + */ + public String getTypeFilter() { + return matcher.getTypeFilter(); + } + + /** + * Return what was specified for the subtypefilter xml attribute. + */ + public String getSubTypeFilter() { + return matcher.getSubTypeFilter(); + } + + /** + * Return what was specified for the subsubtypefilter xml attribute. + */ + public String getSubSubTypeFilter() { + return matcher.getSubSubTypeFilter(); + } + + /** + * Return what was specified for the subsystemconfigurationid xml attribute. + */ + public String getSubSystemFactoryId() { + return matcher.getSubSystemFactoryId(); + } + + /** + * Return what was specified for the subsystemconfigurationCategory xml attribute. + */ + public String getSubSystemFactoryCategoryFilter() { + return matcher.getSubSystemFactoryCategoryFilter(); + } + + /** + * Return what was specified for the systemtypes xml attribute. + */ + public String getSystemTypesFilter() { + return matcher.getSystemTypesFilter(); + } + + /** + * Returns the implementation of ISystemRemoteElement for the given + * object. Returns null if this object is not adaptable to this. + */ + private ISystemRemoteElementAdapter getRemoteAdapter(Object object) { + Object adapter = null; + if (object instanceof IAdaptable) { + IAdaptable adaptable = (IAdaptable) object; + adapter = adaptable.getAdapter(ISystemRemoteElementAdapter.class); + } else { + IAdapterManager adapterManager = Platform.getAdapterManager(); + adapter = adapterManager.getAdapter(object, ISystemRemoteElementAdapter.class); + } + return (ISystemRemoteElementAdapter) adapter; + } + + /** + * Contributes actions applicable for the current selection. + */ + public boolean contributeObjectActions(IWorkbenchPart part, SystemMenuManager menu, ISelectionProvider selProv, List actionIdOverrides) { + return contributeObjectActions(part, (IMenuManager) menu.getMenuManager(), selProv, actionIdOverrides); + } + + /** + * Contributes actions applicable for the current selection. + */ + public boolean contributeObjectActions(IWorkbenchPart part, IMenuManager menu, ISelectionProvider selProv, List actionIdOverrides) { + // Parse configuration + readConfigElement(); + if (cache == null) { + return false; + } + if (cachedActions.size() == 0) { + return false; + } + // Get a structured selection. + ISelection sel = selProv.getSelection(); + if ((sel == null) || !(sel instanceof IStructuredSelection)) { + return false; + } + IStructuredSelection selection = (IStructuredSelection) sel; + // Generate actions. + boolean actualContributions = false; + for (int i = 0; i < cachedActions.size(); i++) { + Object obj = cachedActions.get(i); + if (obj instanceof ActionDescriptor) { + ActionDescriptor ad = (ActionDescriptor) obj; + contributeMenuAction(ad, menu, true); + // Update action for the current selection and part. + if (ad.getAction() instanceof ObjectPluginAction) { + ObjectPluginAction action = (ObjectPluginAction) ad.getAction(); + //String actionText = action.getText(); // for debugging + action.selectionChanged(selection); + //System.out.println("action " + actionText + " enabled? " + action.isEnabled()); + action.setActivePart(part); + } + actualContributions = true; + } + } + return actualContributions; + } + + /** + * Contribute to the list the action identifiers from other contributions that + * this contribution wants to override. Actions of these identifiers will + * not be contributed. + * @see IObjectActionContributor + */ + public void contributeObjectActionIdOverrides(List actionIdOverrides) { + readConfigElement(); + // TODO: need to implement at some point + } + + /** + * Contributes menus applicable for the current selection. + */ + public boolean contributeObjectMenus(SystemMenuManager menu, ISelectionProvider selProv) { + return contributeObjectMenus((IMenuManager) menu.getMenuManager(), selProv); + } + + /** + * Contributes menus applicable for the current selection. + * @see IObjectActionContributor + */ + public boolean contributeObjectMenus(IMenuManager menu, ISelectionProvider selProv) { + // Parse config element. + readConfigElement(); + if (cache == null) { + return false; + } + if (cachedMenus.size() == 0) { + return false; + } + // Get a structured selection. + ISelection sel = selProv.getSelection(); + if ((sel == null) || !(sel instanceof IStructuredSelection)) { + return false; + } + // Generate menus. + boolean actualContributions = false; + for (int i = 0; i < cachedMenus.size(); i++) { + Object obj = cachedMenus.get(i); + if (obj instanceof IConfigurationElement) { + IConfigurationElement menuElement = (IConfigurationElement) obj; + contributeMenu(menuElement, menu, true); + actualContributions = true; + } + } + return actualContributions; + } + + /** + * This factory method returns a new ActionDescriptor for the + * configuration element. + */ + protected ActionDescriptor createActionDescriptor(IConfigurationElement element) { + return new ActionDescriptor(element, ActionDescriptor.T_POPUP); + } + + /** + * Returns true if the current selection matches all the given filtering criteria. + */ + public boolean isApplicableTo(Object object) { + readConfigElement(); + ISystemRemoteElementAdapter adapter = getRemoteAdapter(object); + boolean matches = (adapter != null); + matches = matches && (visibilityTest == null || visibilityTest.isEnabledFor(object)); + matches = matches && (filterTest == null || filterTest.matches(object, true)); + matches = matches && matcher.appliesTo(adapter, object); + return matches; + } + + /** + * Reads the configuration element and all the children. + * This creates an action descriptor for every action in the extension. + */ + private void readConfigElement() { + if (!configRead) { + currentContribution = createContribution(); + readElementChildren(config); + if (cache == null) cache = new ArrayList(4); + cache.add(currentContribution); + currentContribution = null; + configRead = true; + } + } + + protected void readContributions(String id, String tag, String extensionPoint) { + cachedMenus.clear(); + cachedActions.clear(); + super.readContributions(id, tag, extensionPoint); + } + + /** + * Implements abstract method to handle the provided XML element + * in the registry. + */ + protected boolean readElement(IConfigurationElement element) { + String tag = element.getName(); + if (tag.equals(TAG_VISIBILITY)) { + visibilityTest = new ActionExpression(element); + return true; + } + if (tag.equals(TAG_FILTER)) { + if (filterTest == null) filterTest = new ObjectFilterTest(); + filterTest.addFilterElement(element); + return true; + } + // Ignore all object contributions element as these + // are handled by the ObjectActionContributorReader. + if (tag.equals(TAG_OBJECT_CONTRIBUTION)) { + return true; + } + // Found top level contribution element + if (tag.equals(targetContributionTag)) { + if (targetID != null) { + // Ignore contributions not matching target id + String id = getTargetID(element); + if (id == null || !id.equals(targetID)) return true; + } + // Read it's sub-elements + currentContribution = createContribution(); + readElementChildren(element); + if (cache == null) cache = new ArrayList(4); + cache.add(currentContribution); + currentContribution = null; + return true; + } + // Found menu contribution sub-element + if (tag.equals(TAG_MENU)) { + currentContribution.addMenu(element); + cachedMenus.add(element); + return true; + } + // Found action contribution sub-element + if (tag.equals(TAG_ACTION)) { + ActionDescriptor ades = createActionDescriptor(element); + currentContribution.addAction(ades); + cachedActions.add(ades); + return true; + } + return false; + } + +// /** +// * get the root part of the path +// */ +// protected String getPathRoot(String path) { +// int loc = path.indexOf('/'); +// if (loc != -1) { +// if (loc > 0) +// return path.substring(0, loc); +// else +// return ""; // should never happen! +// } else { +// return path; +// } +// } + + /* + * @see IObjectContributor#canAdapt() + */ + public boolean canAdapt() { + return false; + } + + /**** EVERYTHING BELOW IS HACK ***/ + /** + * Creates a menu from the information in the menu configuration element and + * adds it into the provided menu manager. If 'appendIfMissing' is true, and + * menu path slot is not found, it will be created and menu will be added + * into it. Otherwise, add operation will fail. + */ + protected void contributeMenu(IConfigurationElement menuElement, IMenuManager mng, boolean appendIfMissing) { + // Get config data. + String id = menuElement.getAttribute(ATT_ID); + String label = menuElement.getAttribute(ATT_LABEL); + String path = menuElement.getAttribute(ATT_PATH); + if (label == null) { + SystemBasePlugin.logInfo("Invalid Menu Extension (label == null): " + id); //$NON-NLS-1$ + return; + } + // Calculate menu path and group. + String group = null; + if (path != null) { + int loc = path.lastIndexOf('/'); + if (loc != -1) { + group = path.substring(loc + 1); + path = path.substring(0, loc); + } else { + // assume that path represents a slot + // so actual path portion should be null + group = path; + path = null; + } + } + // Find parent menu. + IMenuManager parent = mng; + if (path != null) { + parent = mng.findMenuUsingPath(path); + if (parent == null) { + SystemBasePlugin.logInfo("Invalid Menu Extension (Path is invalid): " + id); //$NON-NLS-1$ + return; + } + } + // Find reference group. + if (group == null) group = IWorkbenchActionConstants.MB_ADDITIONS; + IContributionItem sep = parent.find(group); + if (sep == null) { + if (appendIfMissing) + addGroup(parent, group); + else { + SystemBasePlugin.logInfo("Invalid Menu Extension (Group is invalid): " + id); //$NON-NLS-1$ + return; + } + } + // If the menu does not exist create it. + IMenuManager newMenu = parent.findMenuUsingPath(id); + if (newMenu == null) newMenu = new MenuManager(label, id); + // Add the menu + try { + insertAfter(parent, group, newMenu); + } catch (IllegalArgumentException e) { + SystemBasePlugin.logInfo("Invalid Menu Extension (Group is missing): " + id); //$NON-NLS-1$ + } + // Get the menu again as it may be wrapped, otherwise adding + // the separators and group markers below will not be wrapped + // properly if the menu was just created. + newMenu = parent.findMenuUsingPath(id); + if (newMenu == null) SystemBasePlugin.logInfo("Could not find new menu: " + id); //$NON-NLS-1$ + // Create separators. + IConfigurationElement[] children = menuElement.getChildren(); + for (int i = 0; i < children.length; i++) { + String childName = children[i].getName(); + if (childName.equals(TAG_SEPARATOR)) { + contributeSeparator(newMenu, children[i]); + } else if (childName.equals(TAG_GROUP_MARKER)) { + contributeGroupMarker(newMenu, children[i]); + } + } + } + + /** + * Contributes action from action descriptor into the provided menu manager. + */ + protected void contributeMenuAction(ActionDescriptor ad, IMenuManager menu, boolean appendIfMissing) { + // Get config data. + String mpath = ad.getMenuPath(); + String mgroup = ad.getMenuGroup(); + if (mpath == null && mgroup == null) return; + // Find parent menu. + IMenuManager parent = menu; + if (mpath != null) { + parent = parent.findMenuUsingPath(mpath); + if (parent == null) { + SystemBasePlugin.logInfo("Invalid Menu Extension (Path is invalid): " + ad.getId()); //$NON-NLS-1$ + return; + } + } + // Find reference group. + if (mgroup == null) mgroup = IWorkbenchActionConstants.MB_ADDITIONS; + IContributionItem sep = parent.find(mgroup); + if (sep == null) { + if (appendIfMissing) + addGroup(parent, mgroup); + else { + SystemBasePlugin.logInfo("Invalid Menu Extension (Group is invalid): " + ad.getId()); //$NON-NLS-1$ + return; + } + } + // Add action. + try { + insertAfter(parent, mgroup, ad.getAction()); + } catch (IllegalArgumentException e) { + SystemBasePlugin.logInfo("Invalid Menu Extension (Group is missing): " + ad.getId()); //$NON-NLS-1$ + } + } + + /** + * Creates a named menu separator from the information in the configuration element. + * If the separator already exists do not create a second. + */ + protected void contributeSeparator(IMenuManager menu, IConfigurationElement element) { + String id = element.getAttribute(ATT_NAME); + if (id == null || id.length() <= 0) return; + IContributionItem sep = menu.find(id); + if (sep != null) return; + insertMenuGroup(menu, new Separator(id)); + } + + /** + * Creates a named menu group marker from the information in the configuration element. + * If the marker already exists do not create a second. + */ + protected void contributeGroupMarker(IMenuManager menu, IConfigurationElement element) { + String id = element.getAttribute(ATT_NAME); + if (id == null || id.length() <= 0) return; + IContributionItem marker = menu.find(id); + if (marker != null) return; + insertMenuGroup(menu, new GroupMarker(id)); + } + + /** + * Contributes action from the action descriptor into the provided tool bar manager. + */ + protected void contributeToolbarAction(ActionDescriptor ad, IToolBarManager toolbar, boolean appendIfMissing) { + // Get config data. + String tId = ad.getToolbarId(); + String tgroup = ad.getToolbarGroupId(); + if (tId == null && tgroup == null) return; + // Find reference group. + if (tgroup == null) tgroup = IWorkbenchActionConstants.MB_ADDITIONS; + IContributionItem sep = null; + sep = toolbar.find(tgroup); + if (sep == null) { + if (appendIfMissing) { + addGroup(toolbar, tgroup); + } else { + SystemBasePlugin.logInfo("Invalid Toolbar Extension (Group is invalid): " + ad.getId()); //$NON-NLS-1$ + return; + } + } + // Add action to tool bar. + try { + insertAfter(toolbar, tgroup, ad.getAction()); + } catch (IllegalArgumentException e) { + SystemBasePlugin.logInfo("Invalid Toolbar Extension (Group is missing): " + ad.getId()); //$NON-NLS-1$ + } + } + + /** + * Inserts the separator or group marker into the menu. Subclasses may override. + */ + protected void insertMenuGroup(IMenuManager menu, AbstractGroupMarker marker) { + menu.add(marker); + } + + /** + * Inserts an action after another named contribution item. + * Subclasses may override. + */ + protected void insertAfter(IContributionManager mgr, String refId, PluginAction action) { + insertAfter(mgr, refId, new PluginActionContributionItem(action)); + } + + /** + * Inserts a contribution item after another named contribution item. + * Subclasses may override. + */ + protected void insertAfter(IContributionManager mgr, String refId, IContributionItem item) { + mgr.insertAfter(refId, item); + } + + /** + * Adds a group to a contribution manager. + * Subclasses may override. + */ + protected void addGroup(IContributionManager mgr, String name) { + mgr.add(new Separator(name)); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPopupMenuActionContributorManager.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPopupMenuActionContributorManager.java new file mode 100644 index 00000000000..710c83b80ac --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPopupMenuActionContributorManager.java @@ -0,0 +1,161 @@ +/******************************************************************************** + * 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.core; + +import java.util.Iterator; +import java.util.List; +import java.util.Vector; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.ui.SystemMenuManager; +import org.eclipse.ui.IWorkbenchPart; + + +/** + * This class provides for the management of all popup menus provided by the + * org.eclipse.rse.core.popupMenus extension point. + * To that end, we must + *
      + *
    • Process the additional filtering attributes we added to the tag + *
    • Forgot all the code to do matching by object class type. + * We can't do that because all remote objects + * might be of the same type. Instead we replace that code with code + * to do matching via those additional + * filter attributes we described. + *
    + * @see SystemPopupMenuActionContributor + */ +public class SystemPopupMenuActionContributorManager { + + private static final String T_OBJECT_CONTRIBUTION = "objectContribution"; //$NON-NLS-1$ + private static final String POPUP_MENU_EXTENSION_POINT_ID = "org.eclipse.rse.ui.popupMenus"; //$NON-NLS-1$ + private static SystemPopupMenuActionContributorManager singleton; + private Vector contributors = new Vector(); + + /** + * Returns the singleton instance of this manager. + */ + public static SystemPopupMenuActionContributorManager getManager() { + if (singleton == null) { + singleton = new SystemPopupMenuActionContributorManager(); + } + return singleton; + } + + /** + * Constructor for SystemPopupMenuActionContributorManager + */ + public SystemPopupMenuActionContributorManager() { + super(); + loadContributors(); + } + + /** + * Reads the registry, constructs contributors from the "objectContribution" + * elements found, and registers them in the RSE popup menu registry. + */ + private void loadContributors() { + IExtensionRegistry registry = Platform.getExtensionRegistry(); + IConfigurationElement[] popupMenus = registry.getConfigurationElementsFor(POPUP_MENU_EXTENSION_POINT_ID); + for (int i = 0; i < popupMenus.length; i++) { + IConfigurationElement popupMenu = popupMenus[i]; + if (popupMenu.getName().equals(T_OBJECT_CONTRIBUTION)) + { + SystemPopupMenuActionContributor contributor = new SystemPopupMenuActionContributor(popupMenu); + contributors.add(contributor); + } + else + { + IConfigurationElement[] popupMenuChildren = popupMenu.getChildren(); + for (int j = 0; j < popupMenuChildren.length; j++) { + IConfigurationElement popupMenuChild = popupMenuChildren[j]; + if (popupMenuChild.getName().equals(T_OBJECT_CONTRIBUTION)) + { + SystemPopupMenuActionContributor contributor = new SystemPopupMenuActionContributor(popupMenuChild); + contributors.add(contributor); + } + else + { + //TODO: add a warning message for this + SystemBasePlugin.logWarning("Invalid Tag found: " + popupMenuChild.getName()); + } + } + } + } + } + + /** + * Contributes submenus and/or actions applicable to the selection in the + * provided viewer into the provided popup menu. + * It is called from the SystemView class when filling the context menu. + * TODO: use actionIdOverrides list + * @param part the IWorkbenchPart in which the selection lives and the menu will appear + * @param popupMenu the SystemMenuManager (menu) in which the menu items are to be placed + * @param selectionProvider the ISelectionProvider that will give us access to the selected items in the view + * @param actionIdOverrides the List of overrides for the actions (currently ignored) + * @return true if anything was added to the menu + */ + public boolean contributeObjectActions(IWorkbenchPart part, SystemMenuManager popupMenu, ISelectionProvider selectionProvider, List actionIdOverrides) { + /* get the selection */ + ISelection selection = selectionProvider.getSelection(); + if ((selection == null) || !(selection instanceof IStructuredSelection)) return false; + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + + /* Convert the selection to an array. This is an optimization since they must each be scanned several times. */ + Object[] selections = structuredSelection.toArray(); + + /* Finds those contributors that match every selection. Those that match only some are discarded. */ + Vector matchingContributors = new Vector(10); // 10 is arbitrary but reasonable bound + for (Iterator z = contributors.iterator(); z.hasNext();) { + boolean matches = true; + SystemPopupMenuActionContributor contributor = (SystemPopupMenuActionContributor) z.next(); + for (int i = 0; i < selections.length && matches; i++) { + Object object = selections[i]; + if (!contributor.isApplicableTo(object)) { + matches = false; + } + } + if (matches) { + matchingContributors.add(contributor); + } + } + + /* Process the menu contributions. */ + int actualContributions = 0; + for (Iterator z = matchingContributors.iterator(); z.hasNext();) { + SystemPopupMenuActionContributor contributor = (SystemPopupMenuActionContributor) z.next(); + boolean contributed = contributor.contributeObjectMenus(popupMenu, selectionProvider); + if (contributed) actualContributions++; + } + + /* Process the object action contributions. */ + for (Iterator z = matchingContributors.iterator(); z.hasNext();) { + SystemPopupMenuActionContributor contributor = (SystemPopupMenuActionContributor) z.next(); + boolean contributed = contributor.contributeObjectActions(part, popupMenu, selectionProvider, actionIdOverrides); + if (contributed) actualContributions++; + } + + /* return true if there were any contributions made */ + return (actualContributions > 0); + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPreferencesManager.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPreferencesManager.java new file mode 100644 index 00000000000..644e3b57f0c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPreferencesManager.java @@ -0,0 +1,471 @@ +/******************************************************************************** + * 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.core; +import java.util.Hashtable; +import java.util.Vector; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemRegistry; +import org.eclipse.rse.ui.ISystemPreferencesConstants; +import org.eclipse.rse.ui.propertypages.RemoteSystemsPreferencePage; + + +/** + * A class that encapsulates all global preferences for the remote system framework + *

    + * These include: + *

      + *
    • The list of profile names that are active + *
    • The global default user Id + *
    • The default user Id per system type + *
    • The global setting about whether to show filter pools + *
    • The global setting about whether to show filter strings + *
    • + *
    + */ +public class SystemPreferencesManager + implements ISystemPreferencesConstants +{ + + private static SystemPreferencesManager inst; + private Hashtable userIdsPerKey = null; + /** + * + */ + protected SystemPreferencesManager() + { + } + + /** + * Get singleton of this class + */ + public static SystemPreferencesManager getPreferencesManager() + { + if (inst == null) + inst = new SystemPreferencesManager(); + return inst; + } + + // ------------------------- + // ACTIVE PROFILE METHODS... + // ------------------------- + + /** + * Return active profile names + */ + public String[] getActiveProfileNames() + { + return RemoteSystemsPreferencePage.getActiveProfiles(); + } + + /** + * Rename one of the active profile names in the list of names stored in the registry. + */ + public void renameActiveProfile(String oldName, String newName) + { + // update active profile name list + String[] names = getActiveProfileNames(); + int matchPos = -1; + for (int idx=0; (matchPos==-1) && (idx= 0) + RemoteSystemsPreferencePage.setActiveProfiles(names); + } + /** + * Delete one of the active profile names in the list of names stored in the registry. + */ + public void deleteActiveProfile(String oldName) + { + String[] names = getActiveProfileNames(); + int matchPos = -1; + for (int idx=0; (matchPos==-1) && (idx= 0) + RemoteSystemsPreferencePage.setActiveProfiles(names); + } + /** + * Add a name to the active profile list + */ + public void addActiveProfile(String newName) + { + String[] names = getActiveProfileNames(); + String[] newNames = new String[names.length+1]; + for (int idx=0; idx + * This class encapsulates all the information supplied by the extension xml. + *
      + *
    1. id. Unique identifier + *
    2. name. Displayable property page name + *
    3. class. The class which implements IWorkbenchPropertyPage + *
    4. subsystemconfigurationid. For scoping to remote objects for a given subsystem factory + *
    5. subsystemconfigurationCategory. For scoping to remote objects for a given subsystem factory category + *
    6. systemtypes. For scoping to remote objects from systems of a given type, or comma-separated types. + *
    7. namefilter. For scoping to remote objects of a given name + *
    8. typecategoryfilter. For scoping to remote objects for a given remote object type category + *
    9. typefilter. For scoping to remote objects of a given type + *
    10. subtypefilter. For scoping to remote objects of a given subtype + *
    11. subsubtypefilter. For scoping to remote objects of a given sub-subtype + *
    + * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter + */ +public class SystemPropertyPageExtension implements IPropertyPageContributor +{ + + private String name,id; + private ImageDescriptor image = null; + private SystemRemoteObjectMatcher matcher = null; + private IConfigurationElement element = null; + private IWorkbenchPropertyPage object = null; + private boolean atTop = false; + private HashMap filterProperties; + private static final String TAG_FILTER="filter";//$NON-NLS-1$ + + /** + * Constructor + */ + public SystemPropertyPageExtension(IConfigurationElement element) + { + this.element = element; + this.id = element.getAttribute("id"); + this.name = element.getAttribute("name"); + this.image = getPluginImage(element, element.getAttribute("icon")); + String sAtTop = element.getAttribute("first"); + if ((sAtTop != null) && sAtTop.equals("1")) + atTop = true; + + String subsystemfilter,subsystemCategoryFilter,systypes,categoryfilter,namefilter,typefilter,subtypefilter,subsubtypefilter; + + categoryfilter = element.getAttribute("typecategoryfilter"); + namefilter = element.getAttribute("namefilter"); + typefilter = element.getAttribute("typefilter"); + subtypefilter = element.getAttribute("subtypefilter"); + subsubtypefilter = element.getAttribute("subsubtypefilter"); + subsystemfilter = element.getAttribute("subsystemconfigurationid"); + subsystemCategoryFilter = element.getAttribute("subsystemconfigurationCategory"); + systypes = element.getAttribute("systemtypes"); + + filterProperties = null; + IConfigurationElement[] children = element.getChildren(); + for (int i=0; iname xml attribute. + */ + public String getName() + { + return name; + } + /** + * Getter method. + * Return what was specified for the id xml attribute. + */ + public String getId() + { + return id; + } + /** + * Getter method. + * Return what was specified for the icon xml attribute. + */ + public ImageDescriptor getImage() + { + return image; + } + /** + * Getter method. + * Return what was last set via call to setAtTop(boolean) + */ + public boolean isAtTop() + { + return atTop; + } + /** + * Set the at top attribute + */ + public void setAtTop(boolean atTop) + { + this.atTop = atTop; + } + /** + * Getter method. + * Return what was specified for the typecategoryfilter xml attribute. + */ + public String getCategoryFilter() + { + return matcher.getCategoryFilter(); + } + /** + * Getter method. + * Return what was specified for the namefilter xml attribute. + */ + public String getNameFilter() + { + return matcher.getNameFilter(); + } + /** + * Getter method. + * Return what was specified for the typefilter xml attribute. + */ + public String getTypeFilter() + { + return matcher.getTypeFilter(); + } + /** + * Getter method. + * Return what was specified for the subtypefilter xml attribute. + */ + public String getSubTypeFilter() + { + return matcher.getSubTypeFilter(); + } + /** + * Getter method. + * Return what was specified for the subsubtypefilter xml attribute. + */ + public String getSubSubTypeFilter() + { + return matcher.getSubSubTypeFilter(); + } + /** + * Getter method. + * Return what was specified for the subsystemconfigurationid xml attribute. + */ + public String getSubSystemFactoryId() + { + return matcher.getSubSystemFactoryId(); + } + /** + * Getter method. + * Return what was specified for the subsystemconfigurationCategory xml attribute. + */ + public String getSubSystemFactoryCategoryFilter() + { + return matcher.getSubSystemFactoryCategoryFilter(); + } + /** + * Getter method. + * Return what was specified for the systemtypes xml attribute. + */ + public String getSystemTypesFilter() + { + return matcher.getSystemTypesFilter(); + } + + /** + * Retrieve image in given plugin's directory tree, given its file name. + * The file name should be relatively qualified with the subdir containing it. + */ + protected ImageDescriptor getPluginImage(IConfigurationElement element, String fileName) + { + URL path = getBundle(element).getEntry("/"); + URL fullPathString = null; + try { + fullPathString = new URL(path,fileName); + return ImageDescriptor.createFromURL(fullPathString); + } catch (MalformedURLException e) {} + return null; + } + + protected Bundle getBundle(IConfigurationElement element) + { + String nameSpace = element.getDeclaringExtension().getNamespace(); + return Platform.getBundle(nameSpace); + } + + /** + * Given an ISystemRemoteElement, return true if that element + * should show this property page. Looks at the filter criteria. + */ + public boolean appliesTo(ISystemRemoteElementAdapter adapter, Object element) + { + boolean matches = matcher.appliesTo(adapter, element); + if (!matches) + return false; + // Test custom filter + if (filterProperties == null) + return true; + IActionFilter filter = null; + // If this is a resource contributor and the object is not a resource but + // is an adaptable then get the object's resource via the adaptable mechanism. + Object testObject = element; + /* + if (isResourceContributor + && !(object instanceof IResource) + && (object instanceof IAdaptable)) + { + Object result = ((IAdaptable)object).getAdapter(IResource.class); + if (result != null) + testObject = result; + }*/ + if (testObject instanceof IActionFilter) + filter = (IActionFilter)testObject; + else if (testObject instanceof IAdaptable) + filter = (IActionFilter)((IAdaptable)testObject).getAdapter(IActionFilter.class); + if (filter != null) + return testCustom(testObject, filter); + else + return true; + } + /** + * Returns whether the object passes a custom key value filter + * implemented by a matcher. + */ + private boolean testCustom(Object object, IActionFilter filter) + { + if (filterProperties == null) + return false; + Iterator iter = filterProperties.keySet().iterator(); + while (iter.hasNext()) + { + String key = (String)iter.next(); + String value = (String)filterProperties.get(key); + if (!filter.testAttribute(object, key, value)) + return false; + } + return true; + } + + + /** + * Instantiate and return the class that implements IWorkbenchPropertyPage + */ + public IWorkbenchPropertyPage getPropertyPage() + { + //if (object == null) + //{ + try + { + object = (IWorkbenchPropertyPage)element.createExecutableExtension("class"); + } catch (Exception exc) + { + SystemBasePlugin.logError("Unable to start remote property page extension "+id,exc); + } + //} + return object; + } + + public String toString() + { + return id; + } + + + // ----------------------------------- + // IPropertyPageContributor methods... + // ----------------------------------- + + /** + * Implement this method to add instances of PropertyPage class to the + * property page manager. + * @return true if pages were added, false if not. + */ + public boolean contributePropertyPages(PropertyPageManager manager, IAdaptable object) + { + boolean added = false; + SystemRemotePropertyPageNode node = new SystemRemotePropertyPageNode(this, object); + manager.addToRoot(node); + return added; + } + /** + * Returns true if this contributor should be considered + * for the given object. + */ + public boolean isApplicableTo(Object object) + { + return true; + } + /** + * Creates the page based on the information in the configuration element. + */ + public IWorkbenchPropertyPage createPage(IAdaptable element) // throws CoreException + { + IWorkbenchPropertyPage ppage = getPropertyPage(); + if (ppage != null) + { + ppage.setElement(element); + ppage.setTitle(name); + } + return ppage; + } + /** + * see IObjectContributor#canAdapt() + */ + public boolean canAdapt() + { + return false; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPropertyPageExtensionManager.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPropertyPageExtensionManager.java new file mode 100644 index 00000000000..5f0130a216f --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPropertyPageExtensionManager.java @@ -0,0 +1,106 @@ +/******************************************************************************** + * 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.core; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; +import org.eclipse.ui.internal.dialogs.PropertyPageManager; + + +/** + * Manages remote system property page extenders. + * @see org.eclipse.rse.core.SystemPropertyPageExtension + */ +public class SystemPropertyPageExtensionManager +{ + private SystemPropertyPageExtension[] propertyPageSuppliers = null; + private static SystemPropertyPageExtensionManager inst = null; + //private PropertyPageContributorManager test = null; + /** + * Constructor. Don't call directly. + */ + protected SystemPropertyPageExtensionManager() + { + } + /** + * Get the singleton of this manager + */ + public static SystemPropertyPageExtensionManager getManager() + { + if (inst == null) + inst = new SystemPropertyPageExtensionManager(); + return inst; + } + + /** + * Get all the extenders of the remote properties page extension point + */ + public SystemPropertyPageExtension[] getPropertyPageSuppliers() + { + if (propertyPageSuppliers == null) + { + propertyPageSuppliers = SystemPlugin.getDefault().getPropertyPageExtensions(); + } + return propertyPageSuppliers; + } + + /** + * Return true if there are any remote property page contributions for the + * given selected object + */ + public boolean hasContributorsFor(ISystemRemoteElementAdapter adapter, Object element) + { + boolean hasContributors = false; + if (adapter != null) + { + getPropertyPageSuppliers(); + + if (propertyPageSuppliers != null) + { + for (int idx=0; !hasContributors && (idx + *
  • subsystemconfigurationid. For scoping to remote objects for a given subsystem factory + *
  • subsystemconfigurationCategory. For scoping to remote objects for a given subsystem factory category. + *
  • systemtypes. For scoping to remote objects from systems of a given type, or comma-separated types. + *
  • category. For scoping to remote objects of a given type category + *
  • namefilter. For scoping to remote objects of a given name + *
  • typefilter. For scoping to remote objects of a given type + *
  • subtypefilter. For scoping to remote objects of a given subtype + *
  • subsubtypefilter. For scoping to remote objects of a given sub-subtype + * + *

    + * The names given can be scalar or very simple generic (begin or end with an asterisk). + * Occasionally, as with iSeries objects types, an asterisk is a valid part of the + * name, as in *PGM. If "*PGM" is specified for the type filter, then it would match + * on other types too, like *SRVPGM. To solve this special case, users can specify + * the following to tell us that the asterisk is to be taken literally, versus as a + * leading or trailing wild card: + *

    
    + *  "%%ast.PGM" or "%%ast;PGM"
    + * 
    + *

    + * The special symbol "%%ast." is resolved into an asterisk as part of the literal name. + * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter + */ +public class SystemRemoteObjectMatcher +{ + public static final String STAR_SYMBOL = "%ast."; + public static final String STAR_SYMBOL2 = "%ast;"; // really should have been this I think. + public static final int STAR_SYMBOL_LEN = 5; + private String categoryfilter, subsystemfilter,subsystemCategoryFilter, systypesfilter, namefilter,typefilter,subtypefilter,subsubtypefilter; + private String categoryfilterpart, subsystemfilterpart,subsystemCategoryFilterpart,namefilterpart,typefilterpart,subtypefilterpart,subsubtypefilterpart; + private boolean allSSFCategories = false; + private boolean allCategories = false; + private boolean allNames = false; + private boolean allTypes = false; + private boolean allSubTypes = false; + private boolean allSubSubTypes = false; + private boolean allSubSystems = false; + private boolean allSystemTypes = false; + + private boolean genericSSFCategoriesStart = false; + private boolean genericCategoriesStart = false; + private boolean genericNamesStart = false; + private boolean genericTypesStart = false; + private boolean genericSubTypesStart = false; + private boolean genericSubSubTypesStart = false; + private boolean genericSubSystemStart = false; + + private boolean genericSSFCategoriesEnd = false; + private boolean genericCategoriesEnd = false; + private boolean genericNamesEnd = false; + private boolean genericTypesEnd = false; + private boolean genericSubTypesEnd = false; + private boolean genericSubSubTypesEnd = false; + private boolean genericSubSystemEnd = false; + + /** + * Historical constructor that doesn't support "subsystemFactoryCategory" or "systemtypes". + */ + public SystemRemoteObjectMatcher(String subsystemFactoryId, String categoryFilter, + String nameFilter, String typeFilter, + String subtypeFilter, String subsubtypeFilter) + { + this(subsystemFactoryId, null, categoryFilter, null, nameFilter, typeFilter, subtypeFilter, subsubtypeFilter); + } + /** + * Constructor that supports "subsystemFactoryCategory" and "systemtypes". + */ + public SystemRemoteObjectMatcher(String subsystemFactoryId, String subsystemFactoryCategoryFilter, String categoryFilter, + String systemTypes, String nameFilter, String typeFilter, + String subtypeFilter, String subsubtypeFilter) + { + this.subsystemCategoryFilter = subsystemFactoryCategoryFilter; + this.subsystemfilter = subsystemFactoryId; + this.systypesfilter = systemTypes; + this.categoryfilter = categoryFilter; + this.namefilter = nameFilter; + this.typefilter = typeFilter; + this.subtypefilter = subtypeFilter; + this.subsubtypefilter = subsubtypeFilter; + + if ((systypesfilter == null) || (systypesfilter.length()==0)) + systypesfilter = "*"; + if ((subsystemCategoryFilter == null) || (subsystemCategoryFilter.length()==0)) + subsystemCategoryFilter = "*"; + if (categoryfilter == null) + categoryfilter = "*"; + if (namefilter == null) + namefilter = "*"; + if (typefilter == null) + typefilter = "*"; + if (subtypefilter == null) + subtypefilter = "*"; + if (subsubtypefilter == null) + subsubtypefilter = "*"; + if (subsystemfilter == null) + subsystemfilter = "*"; + + this.allSSFCategories = subsystemCategoryFilter.equals("*"); + this.allCategories = categoryfilter.equals("*"); + this.allSystemTypes = systypesfilter.equals("*"); + this.allNames = namefilter.equals("*"); + this.allTypes = typefilter.equals("*"); + this.allSubTypes = subtypefilter.equals("*"); + this.allSubSubTypes = subsubtypefilter.equals("*"); + this.allSubSystems = subsystemfilter.equals("*"); + + // -------------------------------------------------- + // determine if the name starts or ends with asterisk + // -------------------------------------------------- + this.genericSSFCategoriesStart = !allSSFCategories && startsWithAsterisk(subsystemCategoryFilter); + this.genericCategoriesStart = !allCategories && startsWithAsterisk(categoryfilter); + this.genericNamesStart = !allNames && startsWithAsterisk(namefilter); + this.genericTypesStart = !allTypes && startsWithAsterisk(typefilter); + this.genericSubTypesStart = !allSubTypes && startsWithAsterisk(subtypefilter); + this.genericSubSubTypesStart = !allSubSubTypes && startsWithAsterisk(subsubtypefilter); + this.genericSubSystemStart = !allSubSystems && startsWithAsterisk(subsystemfilter); + + this.genericSSFCategoriesEnd = !allSSFCategories && endsWithAsterisk(subsystemCategoryFilter); + this.genericCategoriesEnd = !allCategories && endsWithAsterisk(categoryfilter); + this.genericNamesEnd = !allNames && endsWithAsterisk(namefilter); + this.genericTypesEnd = !allTypes && endsWithAsterisk(typefilter); + this.genericSubTypesEnd = !allSubTypes && endsWithAsterisk(subtypefilter); + this.genericSubSubTypesEnd = !allSubSubTypes && endsWithAsterisk(subsubtypefilter); + this.genericSubSystemEnd = !allSubSystems && endsWithAsterisk(subsystemfilter); + + if (genericSSFCategoriesStart) + subsystemCategoryFilterpart = stripLeadingAsterisk(subsystemCategoryFilter); // strip off asterisk + if (genericCategoriesStart) + categoryfilterpart = stripLeadingAsterisk(categoryfilter); // strip off asterisk + if (genericNamesStart) + namefilterpart = stripLeadingAsterisk(namefilter); // strip off asterisk + if (genericTypesStart) + typefilterpart = stripLeadingAsterisk(typefilter); // strip off asterisk + if (genericSubTypesStart) + subtypefilterpart = stripLeadingAsterisk(subtypefilter); // strip off asterisk + if (genericSubSubTypesStart) + subsubtypefilterpart = stripLeadingAsterisk(subsubtypefilter); // strip off asterisk + if (genericSubSystemStart) + subsystemfilterpart = stripLeadingAsterisk(subsystemfilter); // strip off asterisk + + if (genericSSFCategoriesEnd) + subsystemCategoryFilterpart = stripTrailingAsterisk(subsystemCategoryFilter); // strip off asterisk + if (genericCategoriesEnd) + categoryfilterpart = stripTrailingAsterisk(categoryfilter); // strip off asterisk + if (genericNamesEnd) + namefilterpart = stripTrailingAsterisk(namefilter); // strip off asterisk + if (genericTypesEnd) + typefilterpart = stripTrailingAsterisk(typefilter); // strip off asterisk + if (genericSubTypesEnd) + subtypefilterpart = stripTrailingAsterisk(subtypefilter); // strip off asterisk + if (genericSubSubTypesEnd) + subsubtypefilterpart = stripTrailingAsterisk(subsubtypefilter);// strip off asterisk + if (genericSubSystemEnd) + subsystemfilterpart = stripTrailingAsterisk(subsystemfilter); // strip off asterisk + + // -------------------------------------------------- + // resolve '\*' escape characters + // -------------------------------------------------- + subsystemCategoryFilter = resolveSymbols(subsystemCategoryFilter); + categoryfilter = resolveSymbols(categoryfilter); + namefilter = resolveSymbols(namefilter); + typefilter = resolveSymbols(typefilter); + subtypefilter = resolveSymbols(subtypefilter); + subsubtypefilter = resolveSymbols(subsubtypefilter); + subsystemfilter = resolveSymbols(subsystemfilter); + } + + /** + * Helper method. + * Returns true if given name starts with an asterisk. + */ + protected boolean startsWithAsterisk(String name) + { + return name.startsWith("*"); + } + /** + * Helper method. + * Returns true if given name ends with an asterisk. + */ + protected boolean endsWithAsterisk(String name) + { + return name.endsWith("*"); + } + /** + * Helper method. + * Strips off the leading asterisk. + */ + protected String stripLeadingAsterisk(String name) + { + return resolveSymbols(name.substring(1)); + } + /** + * Helper method. + * Strips off the trailing asterisk. + */ + protected String stripTrailingAsterisk(String name) + { + return resolveSymbols(name.substring(0, name.length()-1)); + } + /** + * Occasionally, as with iSeries objects types, an asterisk is a valid part of the + * name, as in *PGM. If "*PGM" is specified for the type filter, then it would match + * on other types too, like *SRVPGM. To solve this special case, users can specify + * the following to tell us that the asterisk is to be taken literally, versus as a + * leading or trailing wild card:
    + *

    
    +     *  "%%ast.PGM" or "%%ast;PGM"
    +     * 
    + *

    + * The special symbol "%%ast." is resolved into an asterisk as part of the literal name. + */ + protected String resolveSymbols(String name) + { + // yantzi:5.1.2 workaround for eclipse bug 49312 + if (name.startsWith("%%ast.") || name.startsWith("%%ast;")) + { + // eclipse should have stripped the leading % off but doesn't because of this bug + name = name.substring(1); + } + + int symbolLength = STAR_SYMBOL_LEN; + int symbolIndex = name.indexOf(STAR_SYMBOL); + if (symbolIndex == -1) + symbolIndex = name.indexOf(STAR_SYMBOL2); + boolean hasSymbols = (symbolIndex != -1); + boolean hadSymbols = hasSymbols; + boolean debug = false; + if (hasSymbols && debug) + System.out.println("Before: " + name); + while (hasSymbols) + { + if (symbolIndex == 0) + { + // "&.abc" + if (name.length() > symbolLength) + name = "*" + name.substring(symbolLength); + // "&." + else + name = "*"; + } + else if ((symbolIndex+symbolLength) < name.length()) + { + // "abc&.def" + // "01234567890" + String part1 = name.substring(0,symbolIndex); // up to symbol + String part2 = name.substring(symbolIndex+symbolLength); // after symbol + name = part1 + "*" + part2; + } + else + { + // "abc&." + // "01234567" + String part1 = name.substring(0,symbolIndex); // up to symbol + name = part1 + "*"; + } + symbolIndex = name.indexOf(STAR_SYMBOL); + if (symbolIndex == -1) + symbolIndex = name.indexOf(STAR_SYMBOL2); + hasSymbols = (symbolIndex != -1); + } + if (hadSymbols && debug) + System.out.println("After: " + name); + return name; + } + + /** + * Getter method. + * Return what was specified for the subsystemconfigurationCategory xml attribute. + */ + public String getSubSystemFactoryCategoryFilter() + { + return subsystemCategoryFilter; + } + /** + * Getter method. + * Return what was specified for the systemtypes xml attribute. + */ + public String getSystemTypesFilter() + { + return systypesfilter; + } + + /** + * Getter method. + * Return what was specified for the typecategoryfilter xml attribute. + */ + public String getCategoryFilter() + { + return categoryfilter; + } + /** + * Getter method. + * Return what was specified for the namefilter xml attribute. + */ + public String getNameFilter() + { + return namefilter; + } + /** + * Getter method. + * Return what was specified for the typefilter xml attribute. + */ + public String getTypeFilter() + { + return typefilter; + } + /** + * Getter method. + * Return what was specified for the subtypefilter xml attribute. + */ + public String getSubTypeFilter() + { + return subtypefilter; + } + /** + * Getter method. + * Return what was specified for the subsubtypefilter xml attribute. + */ + public String getSubSubTypeFilter() + { + return subsubtypefilter; + } + /** + * Getter method. + * Return what was specified for the subsystemconfigurationid xml attribute. + */ + public String getSubSystemFactoryId() + { + return subsystemfilter; + } + + /** + * Given an ISystemRemoteElement, return true if that element + * meets this criteria. + */ + public boolean appliesTo(ISystemRemoteElementAdapter adapter, Object element) + { + boolean applies = true; + // must match on all attributes to apply + + // ----------------------------------- + // check for match on subsystem filter + // ----------------------------------- + boolean subsystemMatch = true; + if (!allSubSystems) + { + String subsystem = adapter.getSubSystemFactoryId(element); + if (subsystem == null) + subsystemMatch = false; + else if (!genericSubSystemStart && !genericSubSystemEnd) + subsystemMatch = subsystem.equals(subsystemfilter); + else if (genericSubSystemStart) + subsystemMatch = subsystem.endsWith(subsystemfilterpart); + else if (genericSubSystemEnd) + subsystemMatch = subsystem.startsWith(subsystemfilterpart); + } + if (!subsystemMatch) + return false; + + // ---------------------------------------------------- + // check for match on subsystem factory category filter + // ---------------------------------------------------- + boolean ssfCategoryMatch = true; + if (!allSSFCategories) + { + ISubSystem subsystem = adapter.getSubSystem(element); + if (subsystem == null) + ssfCategoryMatch = true; // should be false, but this was added late and I don't to regress anyting. + else + { + String ssfCategory = subsystem.getSubSystemConfiguration().getCategory(); + if (ssfCategory == null) + ssfCategory = ""; + if (!genericSSFCategoriesStart && !genericSSFCategoriesEnd) + ssfCategoryMatch = ssfCategory.equals(subsystemCategoryFilter); + else if (genericSSFCategoriesStart) + ssfCategoryMatch = ssfCategory.endsWith(subsystemCategoryFilterpart); + else if (genericSSFCategoriesEnd) + ssfCategoryMatch = ssfCategory.startsWith(subsystemCategoryFilterpart); + } + } + if (!ssfCategoryMatch) + return false; + + // ---------------------------------------------------- + // check for match on system types filter + // ---------------------------------------------------- + boolean systemTypesMatch = true; + if (!allSystemTypes) + { + ISubSystem subsystem = adapter.getSubSystem(element); + String[] values = tokenize(systypesfilter); + if (subsystem == null) + { + if (!(element instanceof IHost)) // should never happen for remote objects! + systemTypesMatch = false; + else + { + String connSysType = ((IHost)element).getSystemType(); + systemTypesMatch = false; + for (int idx=0; !systemTypesMatch && (idx + * 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); + } + + /** + * 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); + } + + } + + /** + * Ensure event listening is on. Called at start of team synch action to be safe. + */ + public void ensureOnResourceEventListening() + { + SystemBasePlugin.logInfo("INSIDE ENSUREONRESOURCEEVENTLISTENING"); + if (ignoreEvents) + { + SystemBasePlugin.logWarning("RESOURCE LISTENER WAS TURNED OFF. IT WAS FORCED ON"); + 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()); + } + 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"); + return; + } + } + else if (resource.getType() == IResource.PROJECT) + { + if (!resource.getName().equals(remoteSystemsProject.getName())) + { + if (fullDebug) + SystemBasePlugin.logInfo("EVENT FILTERED OUT BY PROJECT NAME"); + return; + } + try + { + if (!(((IProject) resource).hasNature(RemoteSystemsProject.ID))) + { + if (fullDebug) + SystemBasePlugin.logInfo("EVENT FILTERED OUT BY PROJECT NATURE"); + return; + } + } + catch (Exception exc) + { + } + } + //else + // SystemPlugin.logWarning("IN RESOURCeListener, RESOURCE AND PROJECT ARE NULL, UNABLE TO FILTER THE EVENT"); + } + else + { + //if (resource == null) + // SystemPlugin.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"); + return; + } + } + + if (fullDebug) + { + SystemBasePlugin.logInfo("*** RESOURCE CHANGE EVENT ALLOWED IN ***"); + //(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); + //SystemPlugin.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())); + if (resource == null) + SystemBasePlugin.logInfo("......resource is null"); + else + SystemBasePlugin.logInfo("......resource is: "+resource.getName() + ", type is: " + getResourceTypeString(resType)); + if (flags == IResourceDelta.SYNC) + SystemBasePlugin.logInfo("......flags == SYNC"); + else + SystemBasePlugin.logInfo("......flags == "+flags); + } + + 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; + try + { + if (!(((IProject) resource).hasNature(RemoteSystemsProject.ID))) + return true; + } + catch (Exception exc) + { + System.out.println("Exception trying to test the natures of the project that fired a resource change event"); + } + } + } + return false; + } + + private String getResourceTypeString(int type) + { + switch (type) + { + case IResource.ROOT : return "root"; + case IResource.PROJECT : return "project"; + case IResource.FOLDER : return "folder"; + case IResource.FILE : return "file"; + } + return "unknown: "+Integer.toString(type); + } + + /** + * 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; + SystemBasePlugin.logInfo(pre + delta + ": flags: " + getKindString(flags)); + } + 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); + if (resourceType == IResource.PROJECT) + { + try + { + if (!(((IProject) resource).hasNature(RemoteSystemsProject.ID))) + { + if (debug) + SystemBasePlugin.logInfo("EVENT DELTA FILTERED OUT BY PROJECT NATURE"); + 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"); + } + boolean stop = false; + if (processKids) + { + IResourceDelta[] subdeltas = delta.getAffectedChildren(); + for (int i = 0; !stop && (i < subdeltas.length); i++) + stop = !processDelta(indent + " ", subdeltas[i]); + } + return !stop; + } + + public static String getKindString(int kind) + { + String kindString = "Unknown: " + Integer.toString(kind); + switch (kind) + { + case IResourceDelta.ADDED : + kindString = "ADDED"; + break; + case IResourceDelta.ADDED_PHANTOM : + kindString = "ADDED_PHANTOM"; + break; + case IResourceDelta.ALL_WITH_PHANTOMS : + kindString = "ALL_WITH_PHANTOMS"; + break; + case IResourceDelta.CHANGED : + kindString = "CHANGED"; + break; + case IResourceDelta.CONTENT : + kindString = "CONTENT"; + break; + case IResourceDelta.DESCRIPTION : + kindString = "DESCRIPTION"; + break; + case IResourceDelta.MARKERS : + kindString = "ADDED"; + break; + case IResourceDelta.MOVED_FROM : + kindString = "MOVED_FROM"; + break; + case IResourceDelta.MOVED_TO : + kindString = "MOVED_TO"; + break; + case IResourceDelta.NO_CHANGE : + kindString = "NO_CHANGE"; + break; + case IResourceDelta.OPEN : + kindString = "OPEN"; + break; + case IResourceDelta.REMOVED : + kindString = "REMOVED"; + break; + case IResourceDelta.REMOVED_PHANTOM : + kindString = "REMOVED_PHANTOM"; + break; + case IResourceDelta.REPLACED : + kindString = "REPLACED"; + break; + case IResourceDelta.SYNC : + kindString = "SYNC"; + break; + case IResourceDelta.TYPE : + kindString = "TYPE"; + break; + } + return kindString; + } + + public static String getTypeString(int type) + { + String typeString = "Unknown: " + Integer.toString(type); + switch (type) + { + case IResourceChangeEvent.POST_CHANGE : + typeString = "POST_CHANGE"; + break; + case IResourceChangeEvent.POST_BUILD: + typeString = "POST_BUILD"; + break; + case IResourceChangeEvent.PRE_DELETE : + typeString = "PRE_DELETE"; + break; + case IResourceChangeEvent.PRE_CLOSE : + typeString = "PRE_CLOSE"; + break; + case IResourceChangeEvent.PRE_BUILD : + typeString = "PRE_BUILD"; + 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!!"); + else + { + IWorkbenchWindow wbw = wb.getActiveWorkbenchWindow(); + if (wbw == null) + SystemBasePlugin.logInfo("Active workbench window is null"); + 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 = SystemPlugin.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 = SystemPlugin.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) + { + SystemPlugin.getDefault().restart(); + } + else if (runAction == OPEN_VIEWS) + { + openViews(); + } + else if (runAction == FIRE_EVENT) + { + SystemPlugin.getTheSystemRegistry().fireEvent( + new SystemModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_ALL_RELOADED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_ALL, "dummy")); + } + + } + + /** + * 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()); + else + us = inst; + + return us.changesPending; + } + + /** + * Re-load the whole RSE from the workspace. This is to be called after a team-sync, say + */ + public static void reloadRSE() + { + SystemResourceListener us = null; + if (inst == null) + us = getListener(SystemResourceManager.getRemoteSystemsProject()); + else + us = inst; + + Display d = Display.getCurrent(); + if (d == null) + d = Display.getDefault(); + if (d == null) + { + SystemBasePlugin.logInfo("Hmm, can't get the display"); + SystemView sv = us.getRSEView(); + if (sv != null) + d = sv.getShell().getDisplay(); + else + SystemBasePlugin.logInfo("Hmm, really can't get the display"); + } + + // 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 world! + // 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/systems/org/eclipse/rse/core/SystemResourceManager.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemResourceManager.java new file mode 100644 index 00000000000..c4e7e1a593f --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemResourceManager.java @@ -0,0 +1,581 @@ +/******************************************************************************** + * 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.core; + +import java.io.File; +import java.util.Vector; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceChangeEvent; +import org.eclipse.core.resources.IResourceChangeListener; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.filters.ISystemFilterPool; +import org.eclipse.rse.filters.ISystemFilterPoolManager; +import org.eclipse.rse.internal.model.SystemProfileManager; +import org.eclipse.rse.model.IHost; +import org.eclipse.rse.model.ISystemHostPool; +import org.eclipse.rse.model.ISystemProfile; + + +/** + * Static methods that manage the workbench resource tree for the remote systems project. + * All code in the framework uses this to access the file system for save/restore purposes. + * By limiting all access to one place, we simply changes should we decide to change the + * underlying file system map. + *

    + * Assumptions + *

      + *
    • Each SystemConnectionPool object manages the connections for a given system profile + *
    • Each SystemFilterPoolManager object manages the filter pools for a given subsystem factory, + * for a given system profile! + *
    • Each SystemFilterPool object is an arbitrary named collection of filters all stored + * in one folder on disk with the same name as the pool. + *
    + *

    + */ +public class SystemResourceManager implements SystemResourceConstants +{ + + private static IProject remoteSystemsProject = null; + private static IProject remoteSystemsTempFilesProject = null; + private static boolean initDone = false; + private static boolean firstTime = false; + private static SystemResourceHelpers helpers = null; + + private static SystemResourceListener listener = null; + + /** + * Turn off event listening. Please call this before do anything that modifies resources and + * turn it on again after. + */ + public static void turnOffResourceEventListening() + { + if (listener != null) + listener.turnOffResourceEventListening(); + } + + /** + * Turn off event listening. Please call this after modifying resources. + */ + public static void turnOnResourceEventListening() + { + if (listener != null) + listener.turnOnResourceEventListening(); + } + /** + * Ensure event listening is on. Called at start of team synch action to be safe. + */ + public static void ensureOnResourceEventListening() + { + if (listener != null) + listener.ensureOnResourceEventListening(); + } + + /** + * Start event listening. Requests to turn on and off are ignored until this is called, + * which is at the appropriate point in the startup sequence. + */ + public static void startResourceEventListening() + { + listener = SystemResourceListener.getListener(remoteSystemsProject); + listener.turnOnResourceEventListening(); + + + IWorkspace ws = remoteSystemsProject.getWorkspace(); + int eventMask = IResourceChangeEvent.POST_CHANGE; + + // add listener for global events ; + ws.addResourceChangeListener(listener, eventMask); + } + /** + * End event listening. Requests to turn on and off are ignored after this is called, + * which is at the appropriate point in the shutdown sequence. + */ + public static void endResourceEventListening() + { + if (listener != null) + { + IWorkspace ws = remoteSystemsProject.getWorkspace(); + ws.removeResourceChangeListener(listener); + listener = null; + } + } + + /** + * 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. + *

    + * 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 static void addResourceChangeListener(IResourceChangeListener l) + { + if (listener != null) + listener.addResourceChangeListener(l); + } + /** + * Remove a listener for resource change events on an object in our remote system project. + */ + public static void removeResourceChangeListener(IResourceChangeListener l) + { + if (listener != null) + listener.removeResourceChangeListener(l); + } + + /** + * Get the default remote systems project. + * @return IProject handle of the project. Use exists() to test existence. + */ + public static IProject getRemoteSystemsProject() + { + if (remoteSystemsProject == null) + { + remoteSystemsProject = SystemBasePlugin.getWorkspaceRoot().getProject(RESOURCE_PROJECT_NAME); + if (!initDone) + remoteSystemsProject = createRemoteSystemsProjectInternal(remoteSystemsProject); + } + return remoteSystemsProject; + } + + /** + * Get the default remote systems temp files project. + * @return IProject handle of the project. Use exists() to test existence. + */ + public static IProject getRemoteSystemsTempFilesProject() + { + if (remoteSystemsTempFilesProject == null) + { + remoteSystemsTempFilesProject = SystemBasePlugin.getWorkspaceRoot().getProject(RESOURCE_TEMPFILES_PROJECT_NAME); + } + return remoteSystemsTempFilesProject; + } + /** + * Create a remote systems project, plus the core subfolders required. + * @return IProject handle of the project. + */ + protected static IProject createRemoteSystemsProjectInternal(IProject proj) + //throws Exception + { + if (!proj.exists()) + { + try { + proj.create(null); + proj.open(null); + IProjectDescription description = proj.getDescription(); + String newNatures[] = {RemoteSystemsProject.ID}; + description.setNatureIds(newNatures); + proj.setDescription(description, null); + firstTime = true; + } catch (Exception e) + { + SystemBasePlugin.logError("error creating remote systems project",e); + //throw e; + } + } + else if (!proj.isOpen()) + { + try { + proj.open(null); + } catch (Exception e) + { + SystemBasePlugin.logError("error opening remote systems project",e); + //throw e; + } + } + try{ + // create types folder... + IFolder folder = getResourceHelpers().getOrCreateFolder(proj,RESOURCE_TYPE_FILTERS_FOLDER_NAME); + } catch (Exception e) + { + SystemBasePlugin.logError("error opening/creating types folder",e); + } + initDone = true; + return proj; + } + /** + * Return true if we just created the remote systems project for the first time. + * This call has the side effect of resetting the flag to false so it doesn't return + * true more than once, ever. + */ + public static boolean isFirstTime() + { + boolean firsttime = firstTime; + firstTime = false; + return firsttime; + } + // -------------------------------------------- + // GET ALL EXISTING PROFILE NAMES OR FOLDERS... + // -------------------------------------------- + /** + * Each root folder of the project is assumed to be a profile, if it has a file named profile.xmi + */ + public static IFolder[] getProfileFolders() + { + IProject proj = getRemoteSystemsProject(); + IFolder[] allFolders = getResourceHelpers().listFolders(proj); + //System.out.println("Inside getProfileFolders. allFolders.length = " + allFolders.length); + Vector v = new Vector(); + for (int idx=0; idx 1) + quickSort(sortedCollection, 0, size - 1); + return sortedCollection; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemStringTokenizer.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemStringTokenizer.java new file mode 100644 index 00000000000..ca6332bc9d5 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemStringTokenizer.java @@ -0,0 +1,108 @@ +/******************************************************************************** + * 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.core; +import java.util.Vector; + +/** + * Similar to java's StringTokenizer, but supports multi-character delimiter + * versus just single character delimiters. Eg usage is: + * + * SystemStringTokenizer tokens = new SystemStringTokenizer(stringToParse, "___"); + * while (tokens.hasMoreTokens()) + * String nextToken = tokens.nextToken(); + * + */ +public class SystemStringTokenizer +{ + private Vector tokens; + private int nextToken; + + /** + * Constructor + * @param inputString The string to be tokenized + * @param delimiter The multi-char string that delimits the tokens. Eg "___" + */ + public SystemStringTokenizer(String inputString, String delimiter) + { + tokens = tokenize(inputString, delimiter); + nextToken = 0; + } + + /** + * Return a count of the number of tokens in the input string + */ + public int countTokens() + { + return tokens.size(); + } + + /** + * Return true if there are more tokens + */ + public boolean hasMoreTokens() + { + return (nextToken < tokens.size()); + } + + /** + * Return the next token + */ + public String nextToken() + { + if (nextToken < tokens.size()) + return (String)tokens.elementAt(nextToken++); + else + return null; + } + + /** + * Parse a string into tokens. + */ + 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= 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; + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemType.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemType.java new file mode 100644 index 00000000000..3fafb44f4c6 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemType.java @@ -0,0 +1,199 @@ +/******************************************************************************** + * 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.core; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.rse.ui.propertypages.SystemTypeFieldEditor; + + +/** + * Represents a registered system type, as registered by the systemtype extension point. + * Currently, only two pieces of information per type is recorded:
    + *

      + *
    1. name. eg "Windows" + *
    2. image. eg "windows.gif" + *
    + */ +public class SystemType +{ + + private String name, description; + private ImageDescriptor image, connectedImage; + private boolean enabled=true; + private String userId; + + // yantzi: artemis 6.0 added offline attribute and extension point attribute to enable offline support + private boolean enableOffline; + + /** + * Constructor + * @param name - display name for this system type + * @param image - image for this system type, not connected + * @param connectedImage - image for this system type, when connected + * @param enableOffline - whether to enable offline + * @param description - translatable description of the system type + */ + public SystemType(String name, ImageDescriptor image, ImageDescriptor connectedImage, boolean enableOffline, + String description) + { + this.name = name; + this.description = description; + this.image = image; + this.connectedImage = connectedImage; + this.enableOffline = enableOffline; + } + + /** + * Convert to a string. Same as {@link #getName()} + */ + public String toString() + { + return name; + } + + /** + * Return the display name for this system type + * @return the name shown in the New Connection wizard for this system type. + */ + public String getName() + { + return name; + } + + /** + * Return the translatable description of this system type + * @return a description of this system type. Might be null. + */ + public String getDescription() + { + return description; + } + + /** + * Return true if this system type supports offline mode or not + * @return true if this system type supports offline mode + */ + public boolean isEnableOffline() + { + return enableOffline; + } + + /** + * Configuration method. + * Set whether this system type supports offline mode or not. + */ + public void setEnableOffline(boolean enable) + { + enableOffline = enable; + } + + /** + * Return true if this system type is currently enabled, meaning it shows + * up in the New Connection wizard. User can affect this via preferences page. + * @return true if this type is enabled + */ + public boolean isEnabled() + { + return enabled; + } + + /** + * Specify if this system type is currently enabled, affecting if it shows up in + * the New Connection wizard. User can affect this via preferences page. + */ + public void setEnabled(boolean enabled) + { + this.enabled = enabled; + } + + /** + * Return the image for connections of this system type, when not connected + */ + public ImageDescriptor getImage() + { + return image; + } + + /** + * Return the image for connections of this system type, when connected + */ + public ImageDescriptor getConnectedImage() + { + if (connectedImage == null) + return image; + else + return connectedImage; + } + + /** + * Return the default user ID preferences setting for this system type. + */ + public String getDefaultUserID() + { + return userId; + } + + /** + * Set the default user ID for this system type. This is a preferences value + */ + public void setDefaultUserID(String id) + { + this.userId = id; + } + + /** + * Compare this system type to another one. Compare by name. + */ + public boolean equals(Object o) + { + if (o instanceof String) + return ((String)o).equals(name); + else if (o instanceof SystemType) + return ((SystemType)o).getName().equals(name); + else + return false; + } + + /** + * Hash by name + */ + public int hashCode() + { + return name.hashCode(); + } + + /** + * Helper method... given a system type name, return its system type object + */ + public static SystemType getSystemType(SystemType[] allTypes, String name) + { + SystemType type = null; + for (int idx=0; (type==null)&&(idx
    + * It is the implementors responsability to close the socket and clean + * up all associated resources (like the InputStream) when finished. + * + * @param socket The communications socket connected to the remote peer. The only + * thing read of the socket will have been the request key. + */ + public void handleRequest(Socket socket, int requestKey); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/comm/ISystemCommunicationsDaemonListener.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/comm/ISystemCommunicationsDaemonListener.java new file mode 100644 index 00000000000..140ffe4b8bf --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/comm/ISystemCommunicationsDaemonListener.java @@ -0,0 +1,32 @@ +/******************************************************************************** + * 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.core.comm; + +/** + * Listener interface for thoes that are interested in events from the SystemCommunicationsDaemon. + * + * @author yantzi + */ +public interface ISystemCommunicationsDaemonListener +{ + + /** + * This method is invoked whenever the state of the SystemCommunicationsDaemon changes. For example + * if the daemon is started, stopped or ends in error. + */ + public void daemonStateChanged(SystemCommunicationsDaemonEvent event); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/comm/ISystemKeystoreProvider.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/comm/ISystemKeystoreProvider.java new file mode 100644 index 00000000000..e6b21d2d53e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/comm/ISystemKeystoreProvider.java @@ -0,0 +1,33 @@ +/******************************************************************************** + * 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.core.comm; + +import java.util.List; + + + + +/* + * Interface for the keystoreProviders extension point. + * Implementors must provide a keystore and it's password. + */ +public interface ISystemKeystoreProvider +{ + public String getKeyStorePassword(); + public String getKeyStorePath(); + public boolean importCertificates(List certificates); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/comm/SystemCommunicationsDaemon.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/comm/SystemCommunicationsDaemon.java new file mode 100644 index 00000000000..a6480aa09f2 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/comm/SystemCommunicationsDaemon.java @@ -0,0 +1,446 @@ +/******************************************************************************** + * 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.core.comm; + +import java.io.IOException; +import java.io.InputStream; +import java.net.ServerSocket; +import java.net.Socket; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import org.eclipse.rse.core.SystemBasePlugin; +import org.eclipse.rse.core.SystemPlugin; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.ui.ISystemMessages; +import org.eclipse.rse.ui.ISystemPreferencesConstants; +import org.eclipse.rse.ui.actions.DisplaySystemMessageAction; +import org.eclipse.rse.ui.actions.SystemStartCommunicationsDaemonAction; +import org.eclipse.swt.widgets.Display; + + +/** + * Communications daemon that can be used by other functions for receiving incoming socket + * requests. Functions need to implement the ICommunicationsDaemonHandler interface and register + * a unique 4 byte id (as an integer) which the server sends across the socket to let the + * daemon know which local function to pass the socket off to. + */ +public class SystemCommunicationsDaemon extends Thread { + + + private static final String THREAD_NAME = "RSE daemon"; + + // Communication Daemon Request Handlers + private static Map handlers = new Hashtable(50); + private static List _listeners = new Vector(10); + + // Starting point for dynamically generated keys + private static int _nextKey = 0xD0000000; + + // Instance fields + private static SystemCommunicationsDaemon inst = null; + private boolean halt = false; + private ServerSocket serverSocket; + private boolean displayErrors = true; + + // We need to hold a reference to the _startAction in order to change the "Stop Daemon" label + // to "Start Daemon" if the daemon fails. + private static SystemStartCommunicationsDaemonAction _startAction; + + /** + * Inner class for running ICommunicationHandlers on a new thread. This is done + * for two main reasons: + * 1. Allow the communication daemon to continue handling requests while + * processing other requests (this is important because some requests + * like the program verifiers run long. + * 2. Keep the communications daemon safe from crashes (unhandled exceptions) + * in the communication handlers. + */ + protected class CommunicationHandlerThread extends Thread + { + private ISystemCommunicationsDaemonHandler _handler; + private Socket _socket; + private int _requestKey; + + protected CommunicationHandlerThread(ISystemCommunicationsDaemonHandler handler, Socket socket, int requestKey) + { + _handler = handler; + _socket = socket; + _requestKey = requestKey; + } + + public void run() + { + _handler.handleRequest(_socket, _requestKey); + } + } + + /** + * Singleton, so constructor is private. Use the getInstance method + * to retrieve and instance of this class. + */ + private SystemCommunicationsDaemon() { + } + + /** + * Returns the singleton instance of this class. If the an instance + * has already been created then it is returned, otherwise a new + * instance is created and returned. + */ + public static synchronized SystemCommunicationsDaemon getInstance() + { + if (inst == null) + { + inst = new SystemCommunicationsDaemon(); + } + return inst; + } + + /* + * Stop the communications daemon + */ + private void halt() { + halt = true; + if (serverSocket != null) { + try { + serverSocket.close(); + + // yantzi:2.1.2 (defect 49812) wait for RSE daemon thread to finish (wait at most 5 seconds) + if (inst != null) + { + inst.join(5000); + } + + } + catch (IOException e) + { + SystemBasePlugin.logError("RSE Communications daemon: Unable to close socket", e); + } + catch (InterruptedException e) + { + // some other thread interrupted this one (which should not happen + SystemBasePlugin.logError("SystemCommunicationsDaemon.halt", e); + } + } + } + + /** + * @see Thread.run() + */ + public void run() { + byte[] buffer; + Socket socket = null; + InputStream in = null; + + setName(THREAD_NAME); + + // Create server socket and start listening + int port = SystemPlugin.getDefault().getPreferenceStore().getInt(ISystemPreferencesConstants.DAEMON_PORT); + + try { + serverSocket = new ServerSocket(port); + + fireStateChangeEvent(SystemCommunicationsDaemonEvent.STARTED); + + // Process incoming socket connections + while (!halt) { + socket = serverSocket.accept(); + + // Pass incoming socket off to the appropriate handler, + // the first four bytes (integer) determines the handler. + in = socket.getInputStream(); + buffer = new byte[4]; + in.read(buffer); + + // RequestKey (integer) must be sent as Big Endian (high order bits first) + // convert first four bytes to Java integer + int requestKey = 0 | (buffer[0] << 24); + + requestKey = requestKey | ((buffer[1] << 24) >>> 8); + requestKey = requestKey | ((buffer[2] << 24) >>> 16); + requestKey = requestKey | ((buffer[3] << 24) >>> 24); + + + // yantzi: 5.0.1: changed from asking hanlder for request key to requiring + // handler to provide key when they are registered. + ISystemCommunicationsDaemonHandler handler = (ISystemCommunicationsDaemonHandler) handlers.get(new Integer(requestKey)); + + if (handler != null) + { + new CommunicationHandlerThread(handler, socket, requestKey).start(); + } + else + { + // handler not found + SystemBasePlugin.logWarning("SystemCommunicationsDaemon: Handler not found for key " + requestKey); + socket.close(); + } + } + } catch (IOException e) { + if (!halt) + { + SystemBasePlugin.logError("CommunicationsDaemon, IOException occured during communications daemon request",e); + + fireStateChangeEvent(SystemCommunicationsDaemonEvent.STOPPED_IN_ERROR); + + // yantzi:2.1.2 (defect 51016) Suppress error messages when workbench is first starting up + if (displayErrors) + { + SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_DAEMON_NOTSTARTED); + msg.makeSubstitution(new Integer(port)); + Display.getDefault().asyncExec(new DisplaySystemMessageAction(msg)); + } + + // Reset label of action + if (_startAction != null) + { + _startAction.setActionLabelToStart(); + } + } + else + { + fireStateChangeEvent(SystemCommunicationsDaemonEvent.STOPPED); + } + } finally { + serverSocket = null; + //dy need to get a new thread next time in order to re-run + inst = null; + } + } + + /** + * Start the communications daemon if it is not already running + */ + public synchronized void startDaemon() + { + startDaemon(true); + } + + /** + * Start the communications daemon if it is not already running + * + * @param displayErrors true if error messages should be displayed, false + * if they should be not be displayed. + */ + public synchronized void startDaemon(boolean displayErrors) { + if (!isRunning()) + { + SystemBasePlugin.logDebugMessage("CommunicationsDaemon.startDaemon()", "Starting iSeries Communications Daemon"); + + //yantzi:2.1.2 added boolean to suppress error messages when workbench is first being started + + if (_startAction != null) + { + _startAction.setActionLabelToStop(); + } + + // Just in case someone cached an old copy of the daemon ... + SystemCommunicationsDaemon daemon = getInstance(); + daemon.displayErrors = displayErrors; + daemon.start(); + } + else + { + SystemBasePlugin.logDebugMessage("CommunicationsDaemon.startDaemon()", "Daemon already started"); + } + } + + /** + * Stops the communications daemon if it is running + */ + public synchronized void stopDaemon() { + if (isRunning()) + { + + if (_startAction != null) + { + _startAction.setActionLabelToStart(); + } + + SystemBasePlugin.logDebugMessage("RSE CommunicationsDaemon.stopDaemon()", "Stopping iSeries Communications Daemon"); + getInstance().halt(); + + // Need to get rid of the old Thread object and create a new + // one next time (calling start on the same thread object twice + // does not seem to work. DY + inst = null; + + } + else + { + SystemBasePlugin.logDebugMessage("RSE CommunicationsDaemon.stopDaemon()", "Daemon already stopped"); + } + } + + /** + * Returns the port the daemon is currently running on, or zero if the + * daemon is not running. + */ + public synchronized int getPort() { + if (isRunning()) + { + return serverSocket.getLocalPort(); + } + + return 0; + } + + /** + * Check to see if the iSeries communications daemon is running + * + * @return true if the communications daemon is running, false if it + * is not running + */ + public synchronized boolean isRunning() { + return serverSocket != null; + } + + // + // Helper methods + // + + /** + * Returns the user preference for auto-starting the communications daemon + * when the Workbench starts. + */ + public static boolean isAutoStart() { + return SystemPlugin.getDefault().getPreferenceStore().getBoolean(ISystemPreferencesConstants.DAEMON_AUTOSTART); + } + + /** + * Add a new CommunicationsDaemonHandler + * + * @see ISystemCommunicationsDaemonHandler + * + * @param requestKey + * + * The request key must be four byte integer key used by this handler. This + * is the first thing that much be sent over the socket from the corresponding + * client / server when connecting to the RSE communications daemon. The daemon + * when then compare this integer against all registered handlers and pass off the + * socket connection (via the handleRequest method) to the first match. + * + * Use the SystemCommunicationsDaemon.getInstance().addCommunicationsDaemonHandler(...) + * method to register with the daemon. There is also a corresponding remove method. + * + * Known handlers: + * RSEInteractiveJobHandler 0x67DF7A14 + * CODECommIntegrationHandler 0xA387E2CD + * iSeries DebugEngine + * + * The range of integers from 0xD0000000 to 0xFFFFFFFF is reserved for dyanmically + * generated kes. + * + * @return true if the handler was registered, false it the handler was not registered because + * the requestKey is already being used + */ + public boolean addCommunicationsDaemonHandler(ISystemCommunicationsDaemonHandler handler, int requestKey) + { + Integer key = new Integer(requestKey); + + if (!handlers.containsKey(key)) + { + handlers.put(key, handler); + return true; + } + + return false; + } + + /** + * Remove a CommunicationsDaemonHandler + * + * @see ISystemCommunicationsDaemonHandler + */ + public void removeCommunicationsDaemonHandler(int requestKey) + { + handlers.remove(new Integer(requestKey)); + } + + /** + * Sets the SystemStartCommunicationsDaemon action. This is used to change the + * label of the action if the daemon fails to start or fails during regular + * operation. + */ + public static void setAction(SystemStartCommunicationsDaemonAction action) + { + _startAction = action; + } + + /** + * getNextKey() can be called to generated a dynamic key used by any communications + * handler. They generated key is guaranteed to be unique. Callers still need to + * call the addCommunicationsDaemonHandler() method to register their handler. + */ + public static int getNextKey() + { + int key; + + synchronized (handlers) + { + key = _nextKey; + + if (_nextKey == 0xFFFFFFFF) + { + _nextKey = 0xD0000000; + } + else + { + _nextKey++; + } + } + + return key; + } + + /** + * Add an ISystemCommunicationsDaemonListener listener to receive state change events from the SystemCommunicationsDaemon. + */ + public static void addDaemonListener(ISystemCommunicationsDaemonListener listener) + { + if (!_listeners.contains(listener)) + { + _listeners.add(listener); + } + } + + /** + * Remove the ISystemCommunicationsDaemonListener listener. + */ + public static void removeDaemonListener(ISystemCommunicationsDaemonListener listener) + { + _listeners.remove(listener); + } + + /** + * Fire a state change event for the daemon + */ + private static void fireStateChangeEvent(int newstate) + { + if (_listeners.size() > 0) + { + SystemCommunicationsDaemonEvent event = new SystemCommunicationsDaemonEvent(newstate); + for (int i = 0; i < _listeners.size(); i++) + { + ((ISystemCommunicationsDaemonListener) _listeners.get(i)).daemonStateChanged(event); + } + } + } + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/comm/SystemCommunicationsDaemonEvent.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/comm/SystemCommunicationsDaemonEvent.java new file mode 100644 index 00000000000..1bbfc099e41 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/comm/SystemCommunicationsDaemonEvent.java @@ -0,0 +1,50 @@ +/******************************************************************************** + * 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.core.comm; + +/** + * Event data for the SystemCommunicationsDaemon. + * + * @author yantzi + */ +public class SystemCommunicationsDaemonEvent +{ + // Communications daemon event types + public static final int STARTED = 1; + public static final int STOPPED = 2; + public static final int STOPPED_IN_ERROR = 3; + + private int state; + + /** + * Constructor for SystemCommunicationsDaemonEvent + * + * @state The new state for the daemon. + */ + public SystemCommunicationsDaemonEvent(int state) + { + this.state = state; + } + + /** + * Get the new state for the communications daemon. + */ + public int getState() + { + return state; + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/comm/SystemKeystoreProviderManager.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/comm/SystemKeystoreProviderManager.java new file mode 100644 index 00000000000..ceaa4d0a25c --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/comm/SystemKeystoreProviderManager.java @@ -0,0 +1,66 @@ +/******************************************************************************** + * 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.core.comm; + +import java.util.ArrayList; +import java.util.List; + +public class SystemKeystoreProviderManager +{ + private static SystemKeystoreProviderManager _instance = new SystemKeystoreProviderManager(); + + private List _extensions; + + private SystemKeystoreProviderManager() + { + _extensions= new ArrayList(); + } + + public static SystemKeystoreProviderManager getInstance() + { + return _instance; + } + + public void registerKeystoreProvider(ISystemKeystoreProvider ext) + { + _extensions.add(ext); + } + + public boolean hasProvider() + { + return !_extensions.isEmpty(); + } + + public ISystemKeystoreProvider getDefaultProvider() + { + if (_extensions.size() > 0) + { + return (ISystemKeystoreProvider)_extensions.get(_extensions.size() - 1); + } + return null; + } + + public ISystemKeystoreProvider[] getProviders() + { + ISystemKeystoreProvider[] providers = new ISystemKeystoreProvider[_extensions.size()]; + for (int i = 0; i < _extensions.size(); i++) + { + providers[i] = (ISystemKeystoreProvider)_extensions.get(i); + } + return providers; + } +} \ No newline at end of file