Session Objects
This section describes how to program on the session level using Creo Object TOOLKIT Java.
Overview of Session Objects
The Session object (contained in the class com.ptc.pfc.pfcSession.Session) is the highest level object in Creo Object TOOLKIT Java. Any program that accesses data from Creo application must first get a handle to the Session object before accessing more specific data.
The Session object contains methods to perform the following operations:
•  Accessing models and windows (described in the Models and Windows chapters).
•  Working with the Creo user interface.
•  Allowing interactive selection of items within the session.
•  Accessing global settings such as line styles, colors, and configuration options.
The following sections describe these operations in detail.
Getting the Session Object
Method Introduced:
  • pfcSession.Session.GetCurrentSession
  • pfcSession.Session.GetCurrentSessionWithCompatibility
  • For every application, Creo assigns a unique session. The session contains license information, the compatibility information as a pfcSession.CreoCompatibility object, and other additional data of the application. When a session is assigned to an application, Creo sets the compatibility to CompatibilityUndefined in the associated AppInfo object. You must set the compatibility of the application before working with sessions. To set the compatibility, call the method pfcSession.pfcSession.GetCurrentSessionWithCompatibility. Use the values defined in the enumerated data type pfcSession.CreoCompatibility to set the compatibility of the application. See Compatibility of Deprecated Methods for more information on compatibility and AppInfo object. Use the method pfcSession.Session.GetCurrentSession to get the current Session object in synchronous mode. If the compatibility is not set, the method throws the exception pfcExceptions.XCompatibilityNotSet.
    If a Creo Object TOOLKIT Java application has more than one starting method, then you must set the compatibility for each method, when you retrieve the current session for the first time.
    The method pfcGlobal.pfcGlobal.GetProESession is deprecated. Use the method pfcSession.Session.GetCurrentSession instead. This method will be deprecated in a future release of Creo. If you call this method without setting the compatibility, the method sets the compatibility to C3Compatible. This setting ensures forward compatibility of the Creo applications. If you set a specific compatibility using the method pfcSession.Session.GetCurrentSessionWithCompatibility, and call the method pfcSession.Session.GetCurrentSession then all calls to pfcSession.Session.GetCurrentSession return the session with the set compatibility.
    Note
    You can make multiple calls to this method, but each call gives you a handle to the same object.
    Getting Session Information
    Methods Introduced:
    The method pfcGlobal.pfcGlobal.GetProEArguments returns an array containing the command line arguments passed to Creo application if these arguments follow one of two formats:
    •  Any argument starting with a plus sign (+) followed by a letter character.
    •  Any argument starting with a minus (-) followed by a capitalized letter.
    The first argument passed in the array is the full path to the Creo executable.
    The method pfcGlobal.pfcGlobal.GetProEVersion returns a string that represent theCreo version, for example “Wildfire”.
    The method pfcGlobal.pfcGlobal.GetProEBuildCode returns a string that represents the build code of the Creo session.
    Note
    The preceding methods can only access information in synchronous mode.
    Creo License Data
    Method Introduced:
    The method wfcSession.WSession.IsOptionOrdered returns a boolean value indicating if the specified Creo license option is currently available in the Creo session. For example, Pro/MESH option.
    Directories
    Methods Introduced:
    The method pfcSession.BaseSession.GetCurrentDirectory returns the absolute path name for the current working directory of Creo application.
    The method pfcSession.BaseSession.ChangeDirectory changes Creo to another working directory.
    File Handling
    Methods Introduced:
    The method pfcSession.BaseSession.ListFiles returns a list of files in a directory, given the directory path. You can filter the list to include only files of a particular type, as specified by the file extension.
    Starting with Pro/ENGINEER Wildfire 5.0 M040, the Windchillmethod pfcSession.BaseSession.ListFiles can also list instance objects when accessing Windchill workspaces or folders. A PDM location (for workspace or commonspace) must be passed as the directory path. The following options have been added in the FileListOpt enumerated type:
    •  FILE_LIST_ALL—Lists all the files. It may also include multiple versions of the same file.
    •  FILE_LIST_LATEST—Lists only the latest version of each file.
    •  FILE_LIST_ALL_INST—Same as the FILE_LIST_ALL option. It returns instances only for PDM locations.
    •  FILE_LIST_LATEST_INST—Same as the FILE_LIST_LATEST option. It returns instances only for PDM locations.
    The method pfcSession.BaseSession.ListSubdirectories returns the subdirectories in a given directory location.
    The method wfcSession.WSession.UIEditFile opens an edit window for the specified text file. The editor used is the default editor for Creo. The method returns a boolean value to indicate if the file was edited.
    The file utility methods refer to files using a single wide character string, which composes of the directory path, file name, extension, and version. The method wfcSession.WSession.ParseFileName takes such a string as input, and returns the four segments as a wfcParsedFileNameData object.
    The method wfcSession.ParsedFileNameData.GetDirectoryPath returns the directory path for the file.
    The method wfcSession.ParsedFileNameData.GetName returns the name of the file.
    The method wfcSession.ParsedFileNameData.GetExtension returns the extension of the file.
    The method wfcSession.ParsedFileNameData.GetVersion returns the version of the file.
    The method wfcSession.WSession.DisplayInformationWindow creates a window and displays the content of the specified file. The input arguments are:
    •  FilePath—Specifies the name of the file.
    •  XOffest—Specifies the location of the window along the X-direction with reference to the Creo main window. The valid range is from 0.0 to 1.0.
    •  YOffest—Specifies the location of the window along the Y-direction with reference to the Creo main window. The valid range is from 0.0 to 1.0.
    •  Rows—Specifies the size of the window in terms of rows. The valid range is from 6 to 33.
    •  Columns—Specifies the size of the window in terms of columns. The valid range is from 8 to 80.
    Configuration Options
    Methods Introduced:
    You can access configuration options programmatically using the methods described in this section.
    Use the method pfcSession.BaseSession.GetConfigOptionValues to retrieve the value of a specified configuration file option. Pass the Name of the configuration file option as the input to this method. The method returns an array of values that the configuration file option is set to. It returns a single value if the configuration file option is not a multi-valued option. The method returns a null if the specified configuration file option does not exist.
    The method pfcSession.BaseSession.SetConfigOption is used to set the value of a specified configuration file option. If the option is a multi-value option, it adds a new value to the array of values that already exist.
    The method pfcSession.BaseSession.LoadConfigFile loads an entire configuration file into Creo application.
    Registry File Data
    Functions Introduced:
    The method wfcWSession.WSession.GetApplicationPath returns the path to the Creo Object TOOLKIT Java executable file, exec_file, from the registry file.
    The method wfcWSession.WSession.GetApplicationTextPath returns the path to the directory containing the text folder for the application from the registry file.
    Macros
    Method Introduced:
    The method pfcSession.BaseSession.RunMacro runs a macro string. A Creo Object TOOLKIT Java macro string is equivalent to a Creo Parametric mapkey minus the key sequence and the mapkey name. To generate a macro string, create a mapkey in Creo Parametric. Refer to the Creo Parametric online help for more information about creating a mapkey.
    Copy the Value of the generated mapkey Option from the Tools  Options dialog box. An example Value is as follows:
    $F2 @MAPKEY_LABELtest;
    ~ Activate `main_dlg_cur` `ProCmdModelNew.file`;
    ~ Activate `new` `OK`;
    The key sequence is $F2. The mapkey name is @MAPKEY_LABELtest. The remainder of the string following the first semicolon is the macro string that should be passed to the method pfcSession.BaseSession.RunMacro.
    In this case, it is as follows:
    ~ Activate `main_dlg_cur` `ProCmdModelNew.file`;
    ~ Activate `new` `OK`;
    Note
    Creating or editing the macro string manually is not supported as the mapkeys are not a supported scripting language. The syntax is not defined for users and is not guaranteed to remain constant across different versions of Creo Parametric.
    The method wfcWSession.WSession.ExecuteMacro executes the macros previously loaded using the method pfcSession.BaseSession.RunMacro.
    Execution Rules
    Consider the following rules about the execution of macros:
    •  In synchronous mode, the mapkey or the macro strings are pushed onto a stack and are popped off and executed only when control returns to Creo Parametric from the Creo Object TOOLKIT Java program. Macros in synchronous mode are stored in reverse order, last in, first out. Due to the last in, first out nature of the stack, macros that cannot be passed entirely in one pfcSession.BaseSession.RunMacro call should have the strings loaded in reverse order of required execution.
    •  To execute a macro from within Creo Object TOOLKIT Java, call the function wfcSession.WSession.ExecuteMacro. The method runs the Creo Parametric macro and returns the control to the Creo Object TOOLKIT Java application. The function works only in the synchronous mode.
    •  Do not call the function wfcSession.WSession.ExecuteMacro during the following operations:
      Activating dialog boxes or setting the current model
      Erasing the current model
      Replaying a trail file
    •  While executing macros, if you click OK in the dialog box to complete the command operation, the dialog box may be displayed momentarily without completing the command operation.
    Note
      You can execute only the dialog boxes with built-in exit confirmation as macros, by canceling the exit action.
      It is possible that a macro may not be executed because a command specified in the macro is currently inaccessible in the menus. The functional success of wfcSession.WSession.ExecuteMacro depends on the priority of the executed command against the current context.
    •  If some of the commands require input to be specified from the keyboard (such as a part name), the macro continues execution after you type the input and press ENTER. However, if you must select something with the mouse (such as selecting a sketching plane), the macro is interrupted and ignores the remaining commands in the string.
    This allows the application to create object-independent macros for long sequences of repeating choices. Note that during execution of the macro the user does not have to select any geometry.
    Colors and Line Styles
    Methods Introduced:
    These methods control the general display of a Creo session.
    Use the method pfcSession.BaseSession.SetStdColorFromRGB to customize any of the Creo standard colors.
    To change the color of any text in the window, use the method pfcSession.BaseSession.SetTextColor.
    To change the appearance of non solid lines (for example, datums) use the method pfcSession.BaseSession.SetLineStyle.
    Initializing Objects
    The helper methods described in this section allow you to initialize session objects.
    Methods Introduced:
    The method wfcSession.wfcSession.CreateMatrix3D initializes a three-dimensional matrix with the specified values.
    Use the methods wfcSession.wfcSession.CreatePoint2D and wfcSession.wfcSession.CreatePoint3D to initialize a two-dimensional and three-dimensional point respectively with the specified values.
    The methods wfcSession.wfcSession.CreateOutline2D and wfcSession.wfcSession.CreateOutline3D initialize a two-dimensional and three-dimensional line respectively with the specified values.
    Use the methods wfcSession.wfcSession.CreateVector2D and wfcSession.wfcSession.CreateVector3D to initialize a two-dimensional and three-dimensional vector respectively with the specified values.
    Accessing the Creo User Interface
    The Session object has methods that work with the Creo user interface. These methods provide access to the menu bar and message window. For more information on accessing menus, refer to the section Menus, Commands, and Pop-up Menus.
    The Text Message File
    A text message file is where you define strings that are displayed in the Creo user interface. This includes the strings on the command buttons that you add to the Creo number, the help string that displays when the user’s cursor is positioned over such a command button, and text strings that you display in the Message Window. You have the option of including a translation for each string in the text message file.
    Restrictions on the Text Message File
    You must observe the following restrictions when you name your message file:
    •  The name of the file must be 30 characters or less, including the extension.
    •  The name of the file must contain lower case characters only.
    •  The file extension must be three characters.
    •  The version number must be in the range 1 to 9999.
    •  All message file names must be unique, and all message key strings must be unique across all applications that run with Creo application. Duplicate message file names or message key strings can cause Creo application to exhibit unexpected behavior. To avoid conflicts with the names of Creo or foreign application message files or message key strings, PTC recommends that you choose a prefix unique to your application, and prepend that prefix to each message file name and each message key string corresponding to that application
    Note
    Message files are loaded into Creo application only once during a session. If you make a change to the message file while Creo is running you must exit and restart Creo application before the change will take effect.
    Contents of the Message File
    The message file consists of groups of four lines, one group for each message you want to write. The four lines are as follows:
    1. A string that acts as the identifier for the message. This keyword must be unique for all Creo messages.
    2. The string that will be substituted for the identifier.
    This string can include placeholders for run-time information stored in a stringseq object (shown in Writing Messages to the Message Window).
    3. The translation of the message into another language (can be blank).
    4. An intentionally blank line reserved for future extensions.
    Writing a Message Using a Message Pop-up Dialog Box
    Method Introduced:
    The method pfcSession.Session.UIShowMessageDialog displays the UI message dialog. The input arguments to the method are:
    •  Message—The message text to be displayed in the dialog.
    •  Options—An instance of the pfcUI.MessageDialogOptions containing other options for the resulting displayed message. If this is not supplied, the dialog will show a default message dialog with an Info classification and an OK button. If this is not to be null, create an instance of this options type with pfcUI.pfcUI.MessageDialogOptions_Create(). You can set the following options:
      Buttons—Specifies an array of buttons to include in the dialog. If not supplied, the dialog will include only the OK button. Use the method pfcUI.MessageDialogOptions.SetButtons to set this option.
      DefaultButton—Specifies the identifier of the default button for the dialog box. This must match one of the available buttons. Use the method pfcUI.MessageDialogOptions.SetDefaultButton to set this option.
      DialogLabel—The text to display as the title of the dialog box. If not supplied, the label will be the english string Info. Use the method pfcUI.MessageDialogOptions.SetDialogLabel to set this option.
      MessageDialogType—The type of icon to be displayed with the dialog box (Info, Prompt, Warning, or Error). If not supplied, an Info icon is used. Use the method pfcUI.MessageDialogOptions.SetMessageDialogType to set this option.
    Accessing the Message Window
    The following sections describe how to access the message window using Creo Object TOOLKIT Java. The topics are as follows:
    Writing Messages to the Message Window
    Methods Introduced:
    These methods enable you to display program information on the screen.
    The input arguments to the methods pfcSession.Session.UIDisplayMessage and pfcSession.Session.UIDisplayLocalizedMessage include the names of the message file, a message identifier, and (optionally) a stringseq object that contains upto 10 pieces of run-time information. For pfcSession.Session.UIDisplayMessage, the strings in the stringseq are identified as%0s, %1s, ... %9s based on their location in the sequence. For pfcSession.Session.UIDisplayLocalizedMessage, the strings in the stringseq are identified as%0w, %1w, ... %9w based on their location in the sequence. To include other types of run-time data (such as integers or reals) you must first convert the data to strings and store it in the string sequence.
    Writing Messages to an Internal Buffer
    Methods Introduced:
    The methods pfcSession.BaseSession.GetMessageContents and pfcSession.BaseSession.GetLocalizedMessageContents enable you to write a message to an internal buffer instead of the Creo message area.
    These methods take the same input arguments and perform exactly the same argument substitution and translation as the pfcSession.Session.UIDisplayMessage and pfcSession.Session.UIDisplayLocalizedMessage methods described in the previous section.
    Message Classification
    Messages displayed in Creo Object TOOLKIT Java include a symbol that identifies the message type. Every message type is identified by a classification that begins with the characters %C. A message classification requires that the message key line (line one in the message file) must be preceded by the classification code.
    Note
    Any message key string used in the code should not contain the classification.
    Creo Object TOOLKIT Java applications can now display any or all of the following message symbols:
    •  Prompt—This Creo Object TOOLKIT Java message is preceded by a green arrow. The user must respond to this message type. Responding includes, specifying input information, accepting the default value offered, or canceling the application. If no action is taken, the progress of the application is halted. A response may either be textual or a selection. The classification for Prompt messages is %CP
    •  Info—This Creo Object TOOLKIT Java message is preceded by a blue dot. Info message types contain information such as user requests or feedback from Creo Object TOOLKIT Java or Creo applications. The classification for Info messages is %CI
    Note
    Do not classify messages that display information regarding problems with an operation or process as Info. These types of messages must be classified as Warnings.
    •  Warning—This Creo Object TOOLKIT Java message is preceded by a triangle containing an exclamation point. Warning message types contain information to alert users to situations that could potentially lead to an error during a later stage of the process. Examples of warnings could be a process restriction or a suspected data problem. A Warning will not prevent or interrupt a process. Also, a Warning should not be used to indicate a failed operation. Warnings must only caution a user that the completed operation may not have been performed in a completely desirable way. The classification for Warning messages is %CW
    •  Error—This Creo Object TOOLKIT Java message is preceded by a a broken square. An Error message informs the user that a required task was not completed successfully. Depending on the application, a failed task may or may not require intervention or correction before work can continue. Whenever possible redress this situation by providing a path. The classification for Error messages is %CE
    •  Critical—This Creo Object TOOLKIT Java message is preceded by a red X. A Critical message type informs the user of an extremely serious situation that is usually preceeded by loss of user data. Options redressing this situation, if available, should be provided within the message. The classification for a Critical messages is %CC
    Reading Data from the Message Window
    Methods Introduced:
    These methods enable a program to get data from the user. The methods obtain keyboard input from a text box in the Creo Parametric user interface.
    Note
    When the user presses Esc or clicks Cancel in the Creo Parametric user interface, these methods throw the exception pfcExceptions.XToolkitMsgUserQuit.
    The pfcSession.Session.UIReadIntMessage and pfcSession.Session.UIReadRealMessage methods contain optional arguments that can be used to limit the value of the data to a certain range.
    The method pfcSession.Session.UIReadStringMessage includes an optional Boolean argument that specifies whether to echo characters entered onto the screen. You would use this argument when prompting a user to enter a password.
    Note
    A default value is displayed in the text box as input. When user presses the Enter key as input in the user interface, the default value is not passed to the Creo Object TOOLKIT Java method; instead, the method returns a constant string use_default_string. When this string is returned, the application must interpret that the user wants to use the default value.
    Displaying Feature Parameters
    Method Introduced:
    The methodpfcSession.Session.UIDisplayFeatureParams allows Creo application to show dimensions or other parameters stored on a specific feature. The displayed dimensions may then be interactively selected by the user.
    File Dialogs
    Methods Introduced:
  • pfcSession.Session.UIOpenFile
  • pfcUI.pfcUI.FileOpenOptions_Create
  • pfcUI.FileOpenOptions.SetFilterString
  • pfcUI.FileOpenOptions.SetPreselectedItem
  • pfcUI.FileUIOptions.SetDefaultPath
  • pfcUI.FileUIOptions.SetDialogLabel
  • pfcUI.FileUIOptions.SetShortcuts
  • wfcSession.WSession.UIOpenFileType
  • wfcSession.wfcSession.FiletypeOpenOptions_Create
  • wfcSession.FiletypeOpenOptions.GetModelFiletypes
  • wfcSession.FiletypeOpenOptions.SetModelFiletypes
  • wfcSession.FiletypeOpenOptions.GetPreselectedItem
  • wfcSession.FiletypeOpenOptions.SetPreselectedItem
  • pfcUI.pfcUI.FileOpenShortcut_Create
  • pfcUI.FileOpenShortcut.SetShortcutName
  • pfcUI.FileOpenShortcut.SetShortcutPath
  • pfcSession.Session.UISaveFile
  • pfcUI.pfcUI.FileSaveOptions_Create
  • wfcSession.WSession.UISaveFileType
  • wfcSession.wfcSession.FiletypeSaveOptions_Create
  • wfcSession.FiletypeSaveOptions.GetModelFiletypes
  • wfcSession.FiletypeSaveOptions.SetModelFiletypes
  • wfcSession.FiletypeSaveOptions.GetPreselectedItem
  • wfcSession.FiletypeSaveOptions.SetPreselectedItem
  • pfcSession.Session.UISelectDirectory
  • pfcUI.pfcUI.DirectorySelectionOptions_Create
  • pfcSession.BaseSession.UIRegisterFileOpen
  • pfcUI.pfcUI.FileOpenRegisterOptions_Create
  • pfcUI.FileOpenRegisterOptions.SetFileDescription
  • pfcUI.FileOpenRegisterOptions.SetFileType
  • pfcUI.FileOpenRegisterListener.FileOpenAccess
  • pfcUI.FileOpenRegisterListener.OnFileOpenRegister
  • pfcSession.BaseSession.UIRegisterFileSave
  • pfcUI.pfcUI.FileSaveRegisterOptions_Create
  • pfcUI.FileSaveRegisterOptions.SetFileDescription
  • pfcUI.FileSaveRegisterOptions.SetFileType
  • pfcUI.FileSaveRegisterListener.FileSaveAccess
  • pfcUI.FileSaveRegisterListener.OnFileSaveRegister
  • The method pfcSession.Session.UIOpenFile opens the dialog box to browse directories and open files. The method lets you specify options for the file open dialog box using the objects pfcUI.FileOpenOptions and pfcUI.FileUIOptions.
    Use the method pfcUI.pfcUI.FileOpenOptions_Create to create a new instance of the pfcUI.FileOpenOptions object. This object contains the following options:
    Use the method pfcUI.pfcUI.FileOpenOptions_Create to create a new instance of the pfcUI.FileOpenOptions object. You can specify a filter string to include only files of a particular type. The filter string is specified using file extension. In the input argument FilterString you can specify all types of files extensions with wildcards separated by commas, for example, *.prt, *.asm, *.txt, *.avi, and so on. Use the methods pfcUI.FileOpenOptions.GetFilterString and pfcUI.FileOpenOptions.SetFilterString to get and set the types of file extensions.
    Use the methods pfcUI.FileOpenOptions.GetPreselectedItem and pfcUI.FileOpenOptions.SetPreselectedItem to get and set the name of an item that must be preselected in the dialog box.
    The pfcUI.FileUIOptions object contains the following options:
    •  DefaultPath—Specifies the name of the path to be opened by default in the dialog box. Use the method pfcUI.FileUIOptions.SetDefaultPath to set this option.
    •  DialogLabel—Specifies the title of the dialog box. Use the method pfcUI.FileUIOptions.SetDialogLabel to set this option.
    •  Shortcuts—Specifies an array of file shortcuts of the type pfcUI.FileOpenShortcut. Create this object using the method pfcUI.FileOpenShortcut_Create. This object contains the following attributes:
      ShortcutName—Specifies the name of shortcut path to be made available in the dialog box.
      ShortcutPath—Specifies the string for the shortcut path.
    Use the method pfcUI.FileUIOptions.SetShortcuts to set the array of file shortcuts.
    The method wfcSession.WSession.UIOpenFileType opens the dialog box to browse directories and open files. The method lets you specify options for the file open dialog box using the objects wfcSession.FiletypeOpenOptions and pfcUI.FileUIOptions.
    Use the method wfcSession.wfcSession.FiletypeOpenOptions_Create to create a new instance of wfcSession.FiletypeOpenOptions object. You can specify a filter string to include only files of a particular type in the dialog box. In the input argument ModelFiletypes, you can specify an array of file types using the enumerated data type wfcModel.MdlfileType. Use the methods wfcSession.FiletypeOpenOptions.GetModelFiletypes and wfcSession.FiletypeOpenOptions.SetModelFiletypes to read and set the file types. Use the methods wfcSession.FiletypeOpenOptions.GetPreselectedItem and wfcSession.FiletypeOpenOptions.SetPreselectedItem to get and set the name of an item that must be preselected in the dialog box.
    Note
    The methods pfcSession.Session.UIOpenFile and wfcSession.WSession.UIOpenFileType, do not actually open the file, but return the file path of the selected file.
    The method pfcSession.Session.UISaveFile opens the save dialog box. The method accepts options similar to pfcSession.Session.UIOpenFile through the pfcUI.FileSaveOptions and pfcUI.FileUIOptions objects. Use the method pfcUI.pfcUI.FileSaveOptions_Create to create a new instance of the pfcUI.FileSaveOptions object. When using the Save dialog box, you can set the name to a non-existent file.
    The method wfcSession.WSession.UISaveFileType opens the save dialog box. The method accepts options similar to wfcSession.WSession.UIOpenFileType. The method lets you specify options for the save dialog box using the objects wfcSession.FiletypeSaveOptions and pfcUI.FileUIOptions. Use the method wfcSession.wfcSession.FiletypeSaveOptions_Create to create a new instance of the wfcSession.FiletypeSaveOptions object. You can specify a filter string to include only files of a particular type. In the input argument ModelFiletypes, you can use the specify an array of file types using the enumerated data type wfcModel.MdlfileType. Use the methods wfcSession.FiletypeSaveOptions.GetModelFiletypes and wfcSession.FiletypeSaveOptions.SetModelFiletypes to read and set the file types. Use the methods wfcSession.FiletypeSaveOptions.GetPreselectedItem and wfcSession.FiletypeSaveOptions.SetPreselectedItem to get and set the name of an item that must be preselected in the dialog box.
    Note
    •  The methods pfcSession.Session.UISaveFile and wfcSession.WSession.UISaveFileType, do not actually save the file, but return the file path of the selected file.
    •  For multi-CAD models, in a linked session of Creo Parametric with Windchill, the methods pfcSession.Session.UISaveFile and wfcSession.WSession.UISaveFileType do not support a file path location on local disk.
    The method pfcSession.Session.UISelectDirectory prompts the user to select a directory using the Creo dialog box for browsing directories. The method accepts options through the pfcUI.DirectorySelectionOptions object which is similar to the pfcUI.FileUIOptions object (described for the method pfcSession.Session.UIOpenFile). Specify the default directory path, the title of the dialog box, and a set of shortcuts to other directories to start browsing. If the default path is specified as NULL, the current directory is used. Use the method pfcUI.pfcUI.DirectorySelectionOptions_Create to create a new instance of the pfcUI.DirectorySelectionOptions object. The method pfcSession.Session.UISelectDirectory returns the selected directory path; the application must use other methods or techniques to perform other relevant tasks with this selected path.
    The method pfcSession.BaseSession.UIRegisterFileOpen registers a new file type in the File  Open dialog box in Creo application. This method takes the pfcUI.FileOpenRegisterOptions and pfcUI.FileOpenRegisterListener objects as its input arguments. These objects are as follows:
    •  pfcUI.FileOpenRegisterOptions—This object contains the options for registering an open operation. Use the method pfcUI.pfcUI.FileOpenRegisterOptions_Create to create a new instance of the object. It contains the following options:
      FileDescription—Specifies the short description of the file type to be opened. This description appears for the file type in the File  Open dialog box. Use the method pfcUI.FileOpenRegisterOptions.SetFileDescription to modify this option.
      FileType—Specifies the file type to be opened. The file type appears as the file extension in the File  Open dialog box. Use the method pfcUI.FileOpenRegisterOptions.SetFileType to modify this option.
    •  pfcUI.FileOpenRegisterListener—This object provides the action listener methods for the new file type to be registered. The method pfcUI.FileOpenRegisterListener.FileOpenAccess is called to determine whether the new file type can be opened using the File  Open dialog box. The method pfcUI.FileOpenRegisterListener.OnFileOpenRegister is called on clicking Open for the newly registered file type.
    The method pfcSession.BaseSession.UIRegisterFileSave registers a new file type in the Save a Copy dialog box in Creo application. This method takes the pfcUI.FileSaveRegisterOptions and pfcUI.FileSaveRegisterListener objects as its input arguments. These objects are described as follows:
    •  pfcUI.FileSaveRegisterOptions—This object contains the options for registering a save operation. Use the method pfcUI.pfcUI.FileSaveRegisterOptions_Create to create a new instance of the object. It contains the following options:
      FileDescription—Specifies the short description of the file type to be saved. This description appears for the file type in the Save a Copy dialog box. Use the method pfcUI.FileSaveRegisterOptions.SetFileDescription to modify this option.
      FileType—Specifies the file type to be saved. The file type appears as the file extension in the Save a Copy dialog box. Use the method pfcUI.FileSaveRegisterOptions.SetFileType to modify this option.
    •  pfcUI.FileSaveRegisterListener—This object provides the action listener methods for the new file type to be registered. The method pfcUI.FileSaveRegisterListener.FileSaveAccess is called to determine whether the new file type can be saved using the Save a Copy dialog box. The method pfcUI.FileSaveRegisterListener.OnFileSaveRegister is called on clicking OK for the newly registered file type.
    Customizing the Creo Navigation Area
    The Creo navigation area includes the Model and Layer Tree pane, Folder browser pane, and Favorites pane. The methods described in this section enable Creo Object TOOLKIT Java applications to add custom panes that contain Web pages to the Creo navigation area.
    Adding Custom Web Pages
    To add custom Web pages to the navigation area, the Creo Object TOOLKIT Java application must:
    1. Add a new pane to the navigation area.
    2. Set an icon for this pane.
    3. Set the URL of the location that will be displayed in the pane.
    Methods Introduced:
    The method pfcSession.Session.NavigatorPaneBrowserAdd adds a new pane that can display a Web page to the navigation area. The input parameters are:
    •  PaneName—Specify a unique name for the pane. Use this name in susbsequent calls to pfcSession.Session.NavigatorPaneBrowserIconSet and pfcSession.Session.NavigatorPaneBrowserURLSet.
    •  IconFileName—Specify the name of the icon file, including the extension. A valid format for the icon file is the PTC-proprietary format used by Creo .BIF, .GIF, .JPG, or .PNG. The new pane is displayed with the icon image. If you specify the value as NULL, the default Creo icon is used.
    The default search paths for finding the icons are:
      <creo_loadpoint>\<version>\Common Files\text\resource
      <Application text dir>\resource
      <Application text dir>\<language>\resource
    The location of the application text directory is specified in the registry file.
    •  URL—Specify the URL of the location to be accessed from the pane.
    Use the method pfcSession.Session.NavigatorPaneBrowserIconSet to set or change the icon of a specified browser pane in the navigation area.
    Use the method pfcSession.Session.NavigatorPaneBrowserURLSet to change the URL of the page displayed in the browser pane in the navigation area.