PDA

View Full Version : How to set Destination dialog install path ?



thorne
07-27-2004, 09:10 AM
I want to set the default install path that is displayed to a user (in the Destrination dialog) based on values I set in a wizard bean which is a modified Search File System wizard bean (I set the values I want to use in the Search Directories property). I don't seem to be able to find the magic to do it. I know I can get the values via a $W string, but I cannot figure out how to transfer (i.e. which API and using what IS bean) that value into the Destination dialog. Thanks, Thorne

RobertDickau
07-27-2004, 09:21 AM
I think that dialog box changes the value of $P(rootbean.installLocation), so perhaps use the Set Product Property action to set that to the $W value you've discovered in your Search bean?

thorne
07-27-2004, 09:48 AM
Thanks, Robert. Let me add a curve ball. The $W value is an array and I only want to pick off the 1st value in the array. Can I reference the $W value like this:

"$W(beanID.SearchDirectories[0]) + "pathText"? Thorne

thorne
07-27-2004, 10:19 AM
Here's what I've done and it doesn't seem to change the default install path on the Destination dialog...

Created a Wizard Bean Property Sequence.
Bean = bean ID of product root
Property Name = installLocation
Property Value = $W(beanIdOfSearchFileSystemBean.SearchDirectories[0]) + "/dirA/dirB"

RobertDickau
07-27-2004, 12:02 PM
Hi, Thorne,

I'm not sure you can refer to array elements directly in the Universal environment; you might need to write a custom bean that uses SetProductBeanProperty (from ProductService) to set the installLocation value to the array element...

thorne
07-27-2004, 12:34 PM
Thanks, Robert. I'm creating a Java bean that extends ProductService and contains the setProductBeanProperty method in it. That method has a first argument of "productSource" for which I cannot find an explanation I understand. Can you explain? The help says "Where the source for the Product Tree can be found", but I don't know where to find that string.

Also, I don't know how to code a containing method statement. For example, I code "public void execute(WizardBeanEvent wizardbeanevent) {}" to contain my code for a WizardBeanEvent. What "public void" do I use to contain a setProductBeanProperty method?

Thorne

RobertDickau
07-27-2004, 01:39 PM
I believe you can use the constant ProductService.DEFAULT_PRODUCT_SOURCE as the first argument.

(If you have the Universal training manual, this is described on or around pp. 116-117, I think; this has an example of calling getProductBeanProperty, which should be similar to your custom bean.)

thorne
07-27-2004, 02:16 PM
Robert, I've got the bean written, but when I register it, it is registered as a Product Action and I cannot insert it as a Wizard Action before the Destination dialog displays. How do I use this new bean so it sets the default install path before the Destination dialog is displayed? Thanks, Thorne



import com.installshield.product.*;
import com.installshield.product.service.product.*;
import com.installshield.util.Log;
import com.installshield.wizard.*;
import com.installshield.wizard.service.*;

public class SetDefaultInstallPath extends WizardAction {

private String drives[] = new String[0];
private String value;
private String drive;

public void execute(WizardBeanEvent wizardbeanevent) {

// IGNORE THIS CODE - I'LL FIX IT LATER.
drive = resolveString("$W(beanLDAPinstallLocation.SearchDirectories)"); // get partition letters.
value = drive + "/IBM/HCN"; // default install location. use first partition letter.

try {

ProductService prodService = (ProductService)getService(ProductService.NAME);
prodService.setProductBeanProperty(
ProductService.DEFAULT_PRODUCT_SOURCE,
"beanWithInstallLocation", // bean ID of product bean to alter.
"installLocation", // property in bean to alter.
value
);

} catch (ServiceException se) {

se.printStackTrace();
logEvent(this, Log.ERROR, "Could not execute setProductBeanProperty (drive='" + drive + "'; value='" + value + "').");
return;

}

}

public void build(ProductBuilderSupport support) {
//ensure product-service classes are included in setup.jar.
support.putRequiredService(ProductService.NAME);
}
}

RobertDickau
07-27-2004, 03:21 PM
Was it originally a product action that you changed to a wizard action? If so, you should be able to close and reopen the environment, or perhaps re-register the bean, to have the change take effect...

thorne
07-27-2004, 03:44 PM
Bingo. Thanks, Robert. I can't seem to figure out when I need to terminate ISX to complete changes I make. Guess I'll have to read the class manual again. Thorne