cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Allow admin to disable auto check in

Allow admin to disable auto check in

Currently in Creo 2.0 there is no method to disable auto check in.  At out company, we have found that the auto check in can be problematic since the user does not get a chance to review what is being checked into Windchill.  Also, there is no comment box to document what has changed.  We would like to have the ability to either disable auto check in or change the default behavior to use the custom check in.

In the meantime, we are adding the custom check in button to the Quick Access Toolbar and recommending that our users use it to check in objects.

2 Comments
MarkBohannon
7-Bedrock

/**
* MDAUtilities (excerpt)
*
* PURPOSE: 1) Listener to cancel Auto Check In, ...
*
* @author Mark Bohannon 20140110 - initial release
*
*/
public class MDAutilities
{

private static Session session = null;

public static void start()
{
  File f = new File(
    "c:\\ptc\\Creo 2.0\\configs\\MDAutilities\\debug_start.txt");
  FileOutputStream fop = null;
  try
  {
   fop = new FileOutputStream(f);
  }
  catch (FileNotFoundException e)
  {
   e.printStackTrace();
  }
  PrintStream ps = null;
  if (f.exists())
  {
   ps = new PrintStream(fop);
   System.setOut(ps);
  }
  try
  {// Begin of try

   session = pfcGlobal.GetProESession();

   /*--------------------------------------------------------------------*\
      Disable Auto Check In
   \*--------------------------------------------------------------------*/

   System.out.println("Disable Auto Check In starting ...");

   // Add Auto Check In Cancel
   addAutoCheckInCancel(session);

   System.out.println("Disable Auto Check In completed");

   System.out
     .println("All start-up commands have finished successfully");

  } // End of try

  catch (jxthrowable x)
  {
   System.out.println("Something wrong with MDA Utilities program");
   System.out.println(x.toString());
   x.printStackTrace(ps);
  }// End of catch

  System.out.close();
}

public static void stop()
{
}

/**
  * ====================================================================*\
  * FUNCTION : addAutoCheckInCancel() PURPOSE : Adds bracket listener which
  * prevents auto check in from File Menu and Model Tree
  * \*====================================================================
  */
public static void addAutoCheckInCancel(Session session)
{
  UICommand command = null;
  UICommand command2 = null;

  try
  {
   // Get command from File Menu
   command = session.UIGetCommand("ProCmdMdlTreeWfChkInExp");

   // If the command is not null, add action listener to check
   if (command != null)
   {
    command.AddActionListener(new AutoCheckInBracketListener(
      session));
   }

   // Get command from Model Tree
   command2 = session.UIGetCommand("ProCmdMdlTreeOAWfChkInExp");

   // If the command is not null, add action listener to check
   if (command2 != null)
   {
    command2.AddActionListener(new AutoCheckInBracketListener(
      session));
   }

  }
  catch (jxthrowable x)
  {
   System.out.println("Exception in addAutoCheckInCancel():" + x);
   return;
  }
}


/**
* AutoCheckInBracketListener()
*
* PURPOSE : This listener class displays a dialog message and cancels the Auto
* Check In function.
*
*/
class AutoCheckInBracketListener extends DefaultUICommandBracketListener
{
public Session session;
String name;

public AutoCheckInBracketListener(Session currentSession)
{
  session = currentSession;
}

public void OnAfterCommand()
{
}

public void OnBeforeCommand() throws com.ptc.cipjava.jxthrowable
{
  MessageDialogOptions messageOptions = pfcUI
    .MessageDialogOptions_Create();
  messageOptions.SetMessageDialogType(MessageDialogType.MESSAGE_ERROR);
  messageOptions.SetDialogLabel("Auto Check In Disabled");
  session.UIShowMessageDialog(
    "The Auto Check In function has been disabled to minimize check in\nerrors.  Please use the Custom Check In function instead.",
    messageOptions);

  XCancelProEAction.Throw();
}
}

PTCModerator
Emeritus
Status changed to: Archived