IBM Doors DXL: Browse Triggers on module

Problem

When there are triggers on a module it often is not visible to administrators and other users that can perform DXL operations.

Approach

A menu point as module add in should be generated. Copy the following script to the moduleaddins directory of your doors installation.

Solution

// This is necessary that it works
/*******************************************************
 * Author: Björn Karpenstein
 * Date:   2014-10-01
 * 
 * This script lists all triggers of the module
 ******************************************************/
pragma runLim, 0;

string lstArray [] = {}; 
 
DB mainWindow;
DBE textBox;
DBE textList;

void listAllTriggerForMod (Module mod) 
{
  string theResult="";
  Trigger t;
  int i = 0;
  for t in mod do 
  {
    insert(textList, i, name(t) "", iconNone);
    i++;
  }
}

string getSourceForTriggerName (string theTrigger) 
{
  string sourceCode = "";
  Trigger t;
  for t in current Module do 
  {
    if(name(t) "" == theTrigger)
    {
      sourceCode = dxl(t) "";
    }		
  }
	
  return sourceCode;
}

void doDeselect(DBE dbe, int idx)
{
  //infoBox "You deselected " dbe[idx] "";
} 


void doActivate(DBE dbe, int idx)
{
  // infoBox "You activated " dbe[idx] "";	
}

void doSelect(DBE dbe, int idx)
{
  string triggerName = getColumnValue(textList,idx,0);
  set(textBox, getSourceForTriggerName(triggerName));	
} 

void main(void)
{
  User currentUser = find();
  bool mayDXL = currentUser.mayEditDXL;
  if (!mayDXL)
  {
   // Show error box and inform user. Stop execution of script.
   errorBox "You are not allowed to run/edit DXL code!";
   halt;
  }		
	
  mainWindow = create("List all triggers");
	
  textList = listView(mainWindow, 0, 310, 20, lstArray);		
  textBox = text(mainWindow, "", "", 400, false);
	
  textList->"right"->"unattached";
  textBox->"left"->"flush"->textList;
  textBox->"top"->"aligned"->textList;	

  realize(mainWindow);			
	
  insertColumn(textList, 0, "Trigger Name", 300, iconNone);
	
  set(textList,doSelect,doDeselect,doActivate);		
  listAllTriggerForMod(current);
	
  // set(textBox, listAllTriggerForMod(current));
  show(mainWindow);	
}

main();

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.