cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Jeff_Morse
Level 6

Read Support File wizard bean

(also posted to ISU 10.5 forum)

Hello,

I am trying to create a wizard bean to cat a supportfile into the bean's value property. When I compile the code below I get a "cannot resolve symbol" error on the "WizardServices wServices = event.getServices();" line. I also get a "cannot access com.installshield.boot.CoreFileUtils" error but hopefully that will be fixed with the getServices fix. Would someone please tell me what I'm doing wrong? I used code stolen from the "Using Support Files" help, which was for a dialog.

Thanks for any help you can give me,

Jeff
- - - - -

package com.installshield.extras.wizard;

/**
* CatSupportFile.java
*
* @author JeffMorse
* @version 1.0
*
* Cats a support file using ID in "Behavior and Logic -> Support Files"
* and stores the result in the hidden property "value".
*
*/

import java.io.*;
import java.net.*;
import java.lang.*;
import com.installshield.event.*;
import com.installshield.event.ui.*;
import com.installshield.event.wizard.*;
import com.installshield.event.product.*;
import com.installshield.wizard.*;
import com.installshield.wizard.service.*;
import com.installshield.wizard.awt.*;
import com.installshield.wizard.swing.*;
import com.installshield.wizard.console.*;
import com.installshield.product.*;
import com.installshield.util.*;
import com.installshield.ui.controls.*;
import com.installshield.database.designtime.*;

public class CatSupportFile extends WizardAction {
private String supportFileId = "";
// hidden property where value is stored
private String value = "";
/**
* Retrieve the ini value from the specified file
*/
public void execute(WizardBeanEvent event) {
supportFileId = resolveString(supportFileId);
WizardServices wServices = event.getServices();
try {
ISSetupFileDef supportFile = wServices.getISDatabase().getDatabaseDef().getSetupFile(supportFileId);
if (supportFile != null) {
String filePath = event.getWizard().getRuntimeFileResourceLocation(supportFile.getStorageKey(),true,wServices);
value = FileUtils.readTextFromFile(filePath, null);
}
}
catch (ServiceException e) {
event.getServices().logEvent(this, Log.ERROR, e);
}
}
/**
* Validate properties
*/
public void build(WizardBuilderSupport support) {
// validate supportFileId property
if (supportFileId.equals("")) {
support.logEvent(this, Log.ERROR, "Support File ID field must be specified");
support.setBuildCanceled(true);
}
}
public String getSupportFileId() {
return supportFileId;
}
public void setSupportFileId(String supportFileId) {
this.supportFileId = supportFileId;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
Labels (1)
0 Kudos

(6) Replies
RobertDickau
Flexera Alumni

Judging from the API help, perhaps try this:

WizardServices wServices = event.getWizard( ).getServices( );
0 Kudos
Jeff_Morse
Level 6

Thanks Robert, that fixed the 2 getServices () errors. Now I'm still getting the error:

CatSupportFile.java:53: cannot access com.installshield.boot.CoreFileUtils
file com\installshield\boot\CoreFileUtils.class not found
value = FileUtils.readTextFromFile(filePath, null);
^

I tried readFileToString as well and got the same error.

Please help!

Jeff
0 Kudos
RobertDickau
Flexera Alumni

Hmmm... Is bootstrap.jar on the compiler's class path?
0 Kudos
Jeff_Morse
Level 6

U da man! That was it. I added bootstrap.jar to my cp and voila. Now to see if the bean actually does what I want it too. On to step 2.

Thanks very much for your help Robert. Give yourself a raise!

Jeff
0 Kudos
RobertDickau
Flexera Alumni

Jeff Morse wrote:
Give yourself a raise!
I will (in cups of coffee, at least)! Thanks!
0 Kudos

Hi,

Can you please let me know where to find bootstrap.jar?

 

0 Kudos