@Override
 public void endPlsqlTable(String tableName, String typeDDL, String typeDropDDL) {
   ListenerHelper top = stac.pop();
   TableHelper tableHelper = (TableHelper) stac.peek();
   String tableAlias = tableHelper.targetTypeName().toLowerCase();
   ObjectRelationalDataTypeDescriptor ordt = descriptorMap.get(tableAlias);
   if (ordt == null) {
     ordt = new ObjectRelationalDataTypeDescriptor();
     ordt.descriptorIsAggregate();
     ordt.setAlias(tableHelper.tableAlias());
     ordt.setJavaClassName(tableName.toLowerCase() + COLLECTION_WRAPPER_SUFFIX);
     ordt.getQueryManager();
   }
   boolean itemsMappingFound =
       ordt.getMappingForAttributeName(ITEMS_MAPPING_ATTRIBUTE_NAME) == null ? false : true;
   if (top.isRecord()) {
     if (!itemsMappingFound) {
       ObjectArrayMapping itemsMapping = new ObjectArrayMapping();
       itemsMapping.setAttributeName(ITEMS_MAPPING_ATTRIBUTE_NAME);
       itemsMapping.setFieldName(ITEMS_MAPPING_FIELD_NAME);
       itemsMapping.setStructureName(tableHelper.targetTypeName());
       itemsMapping.setReferenceClassName(((RecordHelper) top).recordName().toLowerCase());
       ordt.addMapping(itemsMapping);
     }
     tableHelper.nestedIsComplex();
   } else {
     if (!itemsMappingFound) {
       ArrayMapping itemsMapping = new ArrayMapping();
       itemsMapping.setAttributeName(ITEMS_MAPPING_ATTRIBUTE_NAME);
       itemsMapping.setFieldName(ITEMS_MAPPING_FIELD_NAME);
       itemsMapping.useCollectionClass(ArrayList.class);
       itemsMapping.setStructureName(tableHelper.targetTypeName());
       ordt.addMapping(itemsMapping);
     }
     if (top.isTable()) {
       tableHelper.nestedIsComplex();
     }
   }
   if (!itemsMappingFound) {
     descriptorMap.put(tableAlias, ordt);
   }
 }
Example #2
0
  private Table createDetailedTable(Composite base) {
    IPreferenceStore store = DdmUiPreferences.getStore();

    Table tab = new Table(base, SWT.SINGLE | SWT.FULL_SELECTION);
    tab.setHeaderVisible(true);
    tab.setLinesVisible(true);

    TableHelper.createTableColumn(
        tab,
        "Type",
        SWT.LEFT,
        "4-byte array (object[], int[], float[])", //$NON-NLS-1$
        PREFS_STATS_COL_TYPE,
        store);

    TableHelper.createTableColumn(
        tab,
        "Count",
        SWT.RIGHT,
        "00,000", //$NON-NLS-1$
        PREFS_STATS_COL_COUNT,
        store);

    TableHelper.createTableColumn(
        tab,
        "Total Size",
        SWT.RIGHT,
        "000.000 WW", //$NON-NLS-1$
        PREFS_STATS_COL_SIZE,
        store);

    TableHelper.createTableColumn(
        tab,
        "Smallest",
        SWT.RIGHT,
        "000.000 WW", //$NON-NLS-1$
        PREFS_STATS_COL_SMALLEST,
        store);

    TableHelper.createTableColumn(
        tab,
        "Largest",
        SWT.RIGHT,
        "000.000 WW", //$NON-NLS-1$
        PREFS_STATS_COL_LARGEST,
        store);

    TableHelper.createTableColumn(
        tab,
        "Median",
        SWT.RIGHT,
        "000.000 WW", //$NON-NLS-1$
        PREFS_STATS_COL_MEDIAN,
        store);

    TableHelper.createTableColumn(
        tab,
        "Average",
        SWT.RIGHT,
        "000.000 WW", //$NON-NLS-1$
        PREFS_STATS_COL_AVERAGE,
        store);

    tab.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {

            Client client = getCurrentClient();
            if (client != null) {
              int index = mStatisticsTable.getSelectionIndex();
              TableItem item = mStatisticsTable.getItem(index);

              if (item != null) {
                Map<Integer, ArrayList<HeapSegmentElement>> heapMap =
                    client.getClientData().getVmHeapData().getProcessedHeapMap();

                ArrayList<HeapSegmentElement> list = heapMap.get(item.getData());
                if (list != null) {
                  showChart(list);
                }
              }
            }
          }
        });

    return tab;
  }
 private GroupedShardResults shardCommentTarget(String... ids) {
   return TableHelper.shard(commentTargetTable, ids);
 }
 /**
  * Adds External Jar File to Project Build Path. If External Jar File already exists and
  * 'overwriteIfExists' parameter is set to true, it is overwritten
  *
  * @param externalJarLocation
  * @param projectName
  * @return
  */
 public static String addExternalJar(
     final String externalJarLocation, final String projectName, boolean overwriteIfExists) {
   assertTrue(
       "External Jar Location cannot be empty but is " + externalJarLocation,
       externalJarLocation != null && externalJarLocation.length() > 0);
   SWTBotExt bot = new SWTEclipseExt().openPropertiesOfProject(projectName);
   bot.shell(IDELabel.Shell.PROPERTIES_FOR + " " + projectName).activate().bot();
   bot.tree()
       .expandNode(IDELabel.JavaBuildPathPropertiesEditor.JAVA_BUILD_PATH_TREE_ITEM_LABEL)
       .select();
   bot.sleep(Timing.time3S());
   bot.tabItem(IDELabel.JavaBuildPathPropertiesEditor.LIBRARIES_TAB_LABEL).activate();
   final SWTBotButton btn = bot.button(IDELabel.Button.ADD_VARIABLE);
   btn.click();
   bot.sleep(Timing.time2S());
   // workaround because first click is not working when test is run via maven
   try {
     bot.shell(IDELabel.Shell.NEW_VARIABLE_CLASS_PATH_ENTRY).activate();
   } catch (WidgetNotFoundException wnfe) {
     btn.click();
     bot.sleep(Timing.time2S());
     bot.shell(IDELabel.Shell.NEW_VARIABLE_CLASS_PATH_ENTRY).activate();
   }
   String jarFileName = new File(externalJarLocation).getName();
   String variableEntryName = jarFileName.toUpperCase() + "_LOCATION";
   boolean externalJarExists = false;
   for (int i = 0; i < bot.table().rowCount(); i++) {
     if (bot.table().getTableItem(i).getText().split(" - ")[0].equals(variableEntryName)) {
       bot.table().getTableItem(i).select();
       externalJarExists = true;
       break;
     }
   }
   bot.button(IDELabel.Button.CONFIGURE_VARIABLES).click();
   bot.shell(IDELabel.Shell.PREFERENCES_FILTERED).activate();
   if (externalJarExists && overwriteIfExists) {
     bot.button(IDELabel.Button.EDIT).click();
     bot.shell(IDELabel.Shell.EDIT_VARIABLE_ENTRY).activate();
     bot.textWithLabel(IDELabel.NewVariableEntryDialog.PATH_TEXT_LABEL)
         .setText(externalJarLocation);
   } else {
     bot.button(IDELabel.Button.NEW).click();
     bot.shell(IDELabel.Shell.NEW_VARIABLE_ENTRY).activate();
     bot.textWithLabel(IDELabel.NewVariableEntryDialog.NAME_TEXT_LABEL).setText(variableEntryName);
     bot.textWithLabel(IDELabel.NewVariableEntryDialog.PATH_TEXT_LABEL)
         .setText(externalJarLocation);
   }
   bot.clickButton(IDELabel.Button.OK).click();
   String result = TableHelper.getSelectionText(bot.table());
   bot.waitUntil(new ActiveShellTitleMatches(bot, "Preferences \\(Filtered\\)"), Timing.time3S());
   bot.clickButton(IDELabel.Button.OK).click();
   bot.waitUntil(
       new ActiveShellTitleMatches(bot, IDELabel.Shell.NEW_VARIABLE_CLASS_PATH_ENTRY),
       Timing.time3S());
   bot.clickButton(IDELabel.Button.OK).click();
   bot.waitUntil(
       new ActiveShellTitleMatches(bot, IDELabel.Shell.PROPERTIES_FOR + " " + projectName),
       Timing.time3S());
   bot.clickButton(IDELabel.Button.OK).click();
   new SWTUtilExt(bot).waitForNonIgnoredJobs();
   return result;
 }