<commit_before>/**
 * Copyright 2010 JBoss Inc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.drools.guvnor.client.explorer;

import java.util.Map;

import org.drools.guvnor.client.common.AssetFormats;
import org.drools.guvnor.client.common.GenericCallback;
import org.drools.guvnor.client.common.Util;
import org.drools.guvnor.client.images.Images;
import org.drools.guvnor.client.messages.Constants;
import org.drools.guvnor.client.rpc.PackageConfigData;
import org.drools.guvnor.client.rpc.RepositoryServiceFactory;
import org.drools.guvnor.client.security.Capabilities;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.OpenEvent;
import com.google.gwt.event.logical.shared.OpenHandler;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.ui.Tree;
import com.google.gwt.user.client.ui.TreeItem;

/*
 * This class contains static node config for BRMS' explorer widgets
 */
public class ExplorerNodeConfig {
    
    private static Constants constants   = ((Constants) GWT.create( Constants.class ));
    private static Images images = (Images) GWT.create(Images.class);

    //Browse
    public static final String FIND_ID = "find";
    public static String     CATEGORY_ROOT_ID = "rootcategory";                                 //NON-NLS
    public static String     CATEGORY_ID = "category";                                 //NON-NLS
    public static String     STATES_ID   = "states";                                   //NON-NLS
    public static String     STATES_ROOT_ID   = "rootstates";                                   //NON-NLS
    public static final String RECENT_EDITED_ID = "recentEdited";
    public static final String RECENT_VIEWED_ID = "recentViewed";
    public static final String INCOMING_ID = "incoming";

    //QA
    public static final String TEST_SCENARIOS_ID = "testScenarios";
    public static final String TEST_SCENARIOS_ROOT_ID = "roottestScenarios";
    public static final String ANALYSIS_ID = "analysis";
    public static final String ANALYSIS_ROOT_ID = "rootanalysis";
        
    //Package snapshot
    public static final String PACKAGE_SNAPSHOTS = "packageSnapshots";

    
    public static TreeItem getPackageItemStructure(String packageName,
                                                   String uuid,
                                                   final Map<TreeItem, String> itemWidgets) {
    	TreeItem pkg = new TreeItem(Util.getHeader(images.packages(), packageName));
        itemWidgets.put(pkg, uuid);

        TreeItem item = new TreeItem(Util.getHeader(images.ruleAsset(), constants.BusinessRuleAssets()));
        //itemWidgets.put(item, AssetFormats.BUSINESS_RULE_FORMATS[0]);
        item.setUserObject(AssetFormats.BUSINESS_RULE_FORMATS);
        pkg.addItem(item);
        
        item = new TreeItem(Util.getHeader(images.technicalRuleAssets(), constants.TechnicalRuleAssets()));
        itemWidgets.put(item, AssetFormats.DRL);
        item.setUserObject(new String[]{AssetFormats.DRL});
        pkg.addItem(item);        
        
        item = new TreeItem(Util.getHeader(images.functionAssets(), constants.Functions()));
        itemWidgets.put(item, AssetFormats.FUNCTION);
        item.setUserObject(new String[]{AssetFormats.FUNCTION});
        pkg.addItem(item);        
        
        item = new TreeItem(Util.getHeader(images.modelAsset(), constants.Model()));
        itemWidgets.put(item, AssetFormats.DSL);
        item.setUserObject(new String[]{AssetFormats.DSL});
        pkg.addItem(item);        
        
        item = new TreeItem(Util.getHeader(images.ruleAsset(), constants.BusinessRuleAssets()));
        itemWidgets.put(item, AssetFormats.DRL_MODEL);
        item.setUserObject(new String[]{AssetFormats.DRL_MODEL});
        pkg.addItem(item);
        
        if ( Preferences.getBooleanPref( "flex-bpel-editor" ) ) {
            item = new TreeItem(Util.getHeader(images.ruleflowSmall(), constants.RuleFlows()));
            itemWidgets.put(item, AssetFormats.RULE_FLOW_RF);
            item.setUserObject(new String[]{AssetFormats.RULE_FLOW_RF, AssetFormats.BPMN2_PROCESS, AssetFormats.BPEL_PACKAGE});
            pkg.addItem(item);
        } else {
            item = new TreeItem(Util.getHeader(images.ruleflowSmall(), constants.RuleFlows()));
            itemWidgets.put(item, AssetFormats.RULE_FLOW_RF);
            item.setUserObject(new String[]{AssetFormats.RULE_FLOW_RF, AssetFormats.BPMN2_PROCESS});<commit_msg>GUVNOR-634 : Packages->Package Name->Models lists DSL instead jars and model declarations<commit_after>/**
 * Copyright 2010 JBoss Inc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.drools.guvnor.client.explorer;

import java.util.Map;

import org.drools.guvnor.client.common.AssetFormats;
import org.drools.guvnor.client.common.GenericCallback;
import org.drools.guvnor.client.common.Util;
import org.drools.guvnor.client.images.Images;
import org.drools.guvnor.client.messages.Constants;
import org.drools.guvnor.client.rpc.PackageConfigData;
import org.drools.guvnor.client.rpc.RepositoryServiceFactory;
import org.drools.guvnor.client.security.Capabilities;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.OpenEvent;
import com.google.gwt.event.logical.shared.OpenHandler;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.ui.Tree;
import com.google.gwt.user.client.ui.TreeItem;

/*
 * This class contains static node config for BRMS' explorer widgets
 */
public class ExplorerNodeConfig {
    
    private static Constants constants   = ((Constants) GWT.create( Constants.class ));
    private static Images images = (Images) GWT.create(Images.class);

    //Browse
    public static final String FIND_ID = "find";
    public static String     CATEGORY_ROOT_ID = "rootcategory";                                 //NON-NLS
    public static String     CATEGORY_ID = "category";                                 //NON-NLS
    public static String     STATES_ID   = "states";                                   //NON-NLS
    public static String     STATES_ROOT_ID   = "rootstates";                                   //NON-NLS
    public static final String RECENT_EDITED_ID = "recentEdited";
    public static final String RECENT_VIEWED_ID = "recentViewed";
    public static final String INCOMING_ID = "incoming";

    //QA
    public static final String TEST_SCENARIOS_ID = "testScenarios";
    public static final String TEST_SCENARIOS_ROOT_ID = "roottestScenarios";
    public static final String ANALYSIS_ID = "analysis";
    public static final String ANALYSIS_ROOT_ID = "rootanalysis";
        
    //Package snapshot
    public static final String PACKAGE_SNAPSHOTS = "packageSnapshots";

    
    public static TreeItem getPackageItemStructure(String packageName,
                                                   String uuid,
                                                   final Map<TreeItem, String> itemWidgets) {
    	TreeItem pkg = new TreeItem(Util.getHeader(images.packages(), packageName));
        itemWidgets.put(pkg, uuid);

        TreeItem item = new TreeItem(Util.getHeader(images.ruleAsset(), constants.BusinessRuleAssets()));
        //itemWidgets.put(item, AssetFormats.BUSINESS_RULE_FORMATS[0]);
        item.setUserObject(AssetFormats.BUSINESS_RULE_FORMATS);
        pkg.addItem(item);
        
        item = new TreeItem(Util.getHeader(images.technicalRuleAssets(), constants.TechnicalRuleAssets()));
        itemWidgets.put(item, AssetFormats.DRL);
        item.setUserObject(new String[]{AssetFormats.DRL});
        pkg.addItem(item);        
        
        item = new TreeItem(Util.getHeader(images.functionAssets(), constants.Functions()));
        itemWidgets.put(item, AssetFormats.FUNCTION);
        item.setUserObject(new String[]{AssetFormats.FUNCTION});
        pkg.addItem(item);        
        
        item = new TreeItem(Util.getHeader(images.modelAsset(), constants.DSLConfigurations()));
        itemWidgets.put(item, AssetFormats.DSL);
        item.setUserObject(new String[]{AssetFormats.DSL});
        pkg.addItem(item);        

        item = new TreeItem(Util.getHeader(images.modelAsset(), constants.Model()));
        itemWidgets.put(item, AssetFormats.DRL_MODEL);
        item.setUserObject(new String[]{AssetFormats.DRL_MODEL,AssetFormats.MODEL});
        pkg.addItem(item);
        
        if ( Preferences.getBooleanPref( "flex-bpel-editor" ) ) {
            item = new TreeItem(Util.getHeader(images.ruleflowSmall(), constants.RuleFlows()));
            itemWidgets.put(item, AssetFormats.RULE_FLOW_RF);
            item.setUserObject(new String[]{AssetFormats.RULE_FLOW_RF, AssetFormats.BPMN2_PROCESS, AssetFormats.BPEL_PACKAGE});
            pkg.addItem(item);
        } else {
            item = new TreeItem(Util.getHeader(images.ruleflowSmall(), constants.RuleFlows()));
            itemWidgets.put(item, AssetFormats.RULE_FLOW_RF);
            item.setUserObject(new String[]{AssetFormats.RULE_FLOW_RF, AssetFormats.BPMN2_PROCESS});
{'fraction_non_alphanumeric': 0.1005035047882318, 'fraction_numerical': 0.002468160726626518, 'mean_word_length': 2.992905005912495, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1797368', 'n_tokens_mistral': 2995, 'n_tokens_neox': 2904, 'n_words': 628}