Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ptp-dev] Service Configuration preference page questions

Dave,

On Jul 30, 2009, at 10:39 AM, Dave Wootton wrote:

Greg
I have an initial version of the Service Configuration preference page
working and have some questions

When I create a new service configuration, I'm calling
ServiceModelManager.getInstance().newServiceConfiguration("name") then
creating a new ServiceConfigurationWizard obejct using that service
configuration. This requires me to code the name of the service
configuration in the call to newServiceConfiguration(), and no way to
change that name.

You can change the name using the IServiceConfiguration.setName() interface.


If I cancel the WizardDialog, the service configuration is still in the list of service configurations since newServiceConfiguration() ceates the service configuration and adds it to the list. I think this should be two steps, with a method to create the service configuration and then a second call to add it to the list. I think the wizard needs somewhere to specify
the name as well.

The way it works now, you would call ServiceModelManager.remove(configuration) if the dialog is cancelled. I think this is better than calling newServiceConfiguration(), then something like addServiceConfiguration() as there is no guarantee that the second step is called, leading to the possibility of orphaned configurations.

There should definitely be something on the page that allows the name to be changed. The nicest way to do this is with a field editor (see Preferences>Team>CVS>File Content for an example), but most preferences just use a dialog.


I have a couple places in my preference page where I need to get a service configuration by name, to edit or remove a service configuration. I call ServiceModelManager.getConfigurations() and iterate over the set until I
find what I want. Is it reasonable to add this method to
ServiceModelManager and return null if no match?

You shouldn't use the configuration name to look up a configuration as they are not guaranteed to be unique. Each configuration has an ID (IServiceConfiguration.getId()) that is guaranteed to be unique and should be used for locating a configuration. However, in your case, I'd suggest storing the configuration object with the table item using TableItem.setData() so you can access it directly. If you'd like to add a getConfiguration(String id) method to ServiceModelConfiguration that's fine also.


I don't fully understand how a service configuration gets added to the
list of service configurations for a project. Are add and delete buttons required on the properties page, or is there another path intended to do
this? If I need an add buttton, then I think I need to craete a  popup
dialog from the properties page, displaying a list of service
configurations to select from, where that list should exclude the ones
already used by the project. The other way would be two service
configuration lists in the properties page with '-->' and '<--' buttons between them to move them from the complete list to the project's list,
but I think that's not the right way to do it.

I think this will happen via the new project wizard when the project is created, and through a project properties page, rather than the preferences page.

Greg



Back to the top