<commit_before>function applicationStarted(pluginWorkspaceAccess) {
 Packages.java.lang.System.err.println("Application started " + pluginWorkspaceAccess);
 edChangedListener = {
  /*Called when a DITA Map is opened*/
  editorOpened: function (editorLocation) {
   Packages.java.lang.System.err.println("\nrunning " + editorLocation);
   /*Get the opened DITA Map*/
   editor = pluginWorkspaceAccess.getEditorAccess(editorLocation, Packages.ro.sync.exml.workspace.api.PluginWorkspace.DITA_MAPS_EDITING_AREA);
   ditaMapPage = editor.getCurrentPage();
   
   
   customizer = {
    customizeComputedTopicrefTitle: function (topicref, targetTopicOrMap, defaultComputedTitle) {
        //Present profiling attributes set on the root element.
         if(targetTopicOrMap.getType() == Packages.ro.sync.ecss.extensions.api.node.AuthorNode.NODE_TYPE_DOCUMENT){
             rootElement = targetTopicOrMap.getRootElement();
             if(rootElement.getType() == Packages.ro.sync.ecss.extensions.api.node.AuthorNode.NODE_TYPE_ELEMENT){
              attrsCount = rootElement.getAttributesCount();
              for (i = 0; i < attrsCount; i++) {
                attrName = rootElement.getAttributeAtIndex(i);
                if(attrName.equals("rev") || attrName.equals("audience") || attrName.equals("platform") || attrName.equals("product") || attrName.equals("props")){
                  //Interesting attribute...
                  defaultComputedTitle = defaultComputedTitle + " [" + attrName + "='" +  rootElement.getAttribute(attrName) + "']";
                }
              }
            }
        }
        //Count chapters and present counter before chapter name.
        if("chapter".equals(topicref.getName())){
          parentOfTopicRef = topicref.getParent();
          cnt = 1;
          nodes = parentOfTopicRef.getContentNodes();
          for(i=0; i< nodes.size();i++){
            if(nodes.get(i) == topicref){
                break;
            } else if("chapter".equals(nodes.get(i).getName())){
                cnt=cnt+1;
            }
          }
          defaultComputedTitle = cnt + " - " + defaultComputedTitle;
        }        
      return defaultComputedTitle;
    }
   }
    ditaMapPage.addNodeRendererCustomizer(new Packages.ro.sync.exml.workspace.api.editor.page.ditamap.DITAMapNodeRendererCustomizer(customizer));
  }
 }
 edChangedListener = new JavaAdapter(Packages.ro.sync.exml.workspace.api.listeners.WSEditorChangeListener, edChangedListener);
 pluginWorkspaceAccess.addEditorChangeListener(edChangedListener, Packages.ro.sync.exml.workspace.api.PluginWorkspace.DITA_MAPS_EDITING_AREA);
}

function applicationClosing(pluginWorkspaceAccess) {
 Packages.java.lang.System.err.println("Application closing " + pluginWorkspaceAccess);
}<commit_msg>Add text descriptor for resource-only topicrefs.<commit_after>function applicationStarted(pluginWorkspaceAccess) {
 Packages.java.lang.System.err.println("Application started " + pluginWorkspaceAccess);
 edChangedListener = {
  /*Called when a DITA Map is opened*/
  editorOpened: function (editorLocation) {
   Packages.java.lang.System.err.println("\nrunning " + editorLocation);
   /*Get the opened DITA Map*/
   editor = pluginWorkspaceAccess.getEditorAccess(editorLocation, Packages.ro.sync.exml.workspace.api.PluginWorkspace.DITA_MAPS_EDITING_AREA);
   ditaMapPage = editor.getCurrentPage();
   
   
   customizer = {
    customizeComputedTopicrefTitle: function (topicref, targetTopicOrMap, defaultComputedTitle) {
        //Present profiling attributes set on the root element.
         if(targetTopicOrMap.getType() == Packages.ro.sync.ecss.extensions.api.node.AuthorNode.NODE_TYPE_DOCUMENT){
             rootElement = targetTopicOrMap.getRootElement();
             if(rootElement.getType() == Packages.ro.sync.ecss.extensions.api.node.AuthorNode.NODE_TYPE_ELEMENT){
              attrsCount = rootElement.getAttributesCount();
              for (i = 0; i < attrsCount; i++) {
                attrName = rootElement.getAttributeAtIndex(i);
                if(attrName.equals("rev") || attrName.equals("audience") || attrName.equals("platform") || attrName.equals("product") || attrName.equals("props")){
                  //Interesting attribute...
                  defaultComputedTitle = defaultComputedTitle + " [" + attrName + "='" +  rootElement.getAttribute(attrName) + "']";
                }
              }
            }
        }
        //Count chapters and present counter before chapter name.
        if("chapter".equals(topicref.getName())){
          parentOfTopicRef = topicref.getParent();
          cnt = 1;
          nodes = parentOfTopicRef.getContentNodes();
          for(i=0; i< nodes.size();i++){
            if(nodes.get(i) == topicref){
                break;
            } else if("chapter".equals(nodes.get(i).getName())){
                cnt=cnt+1;
            }
          }
          defaultComputedTitle = cnt + " - " + defaultComputedTitle;
        } 
        //Maybe it's a resource-only topic
        if(topicref.getAttribute("processing-role") != null){
           processingRoleValue = topicref.getAttribute("processing-role").getValue();
           if(processingRoleValue.equals('resource-only')){
               defaultComputedTitle = defaultComputedTitle + " [resource-only]";
           }
        }
      return defaultComputedTitle;
    }
   }
    ditaMapPage.addNodeRendererCustomizer(new Packages.ro.sync.exml.workspace.api.editor.page.ditamap.DITAMapNodeRendererCustomizer(customizer));
  }
 }
 edChangedListener = new JavaAdapter(Packages.ro.sync.exml.workspace.api.listeners.WSEditorChangeListener, edChangedListener);
 pluginWorkspaceAccess.addEditorChangeListener(edChangedListener, Packages.ro.sync.exml.workspace.api.PluginWorkspace.DITA_MAPS_EDITING_AREA);
}

function applicationClosing(pluginWorkspaceAccess) {
 Packages.java.lang.System.err.println("Application closing " + pluginWorkspaceAccess);
}
{'fraction_non_alphanumeric': 0.11858704793944491, 'fraction_numerical': 0.001345668629100084, 'mean_word_length': 3.050408719346049, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4497422', 'n_tokens_mistral': 1673, 'n_tokens_neox': 1664, 'n_words': 240}