public MessageListTableFormatBase(
     Table table, Enum<?>[] columns, IWorkbenchPartSite site, DataDictionary dataDictionary) {
   super(table, columns, dataDictionary);
   this.site = site;
   site.getSelectionProvider();
   init(table);
 }
コード例 #2
0
ファイル: UIUtils.java プロジェクト: ralic/dbeaver
 @Nullable
 public static ISelectionProvider getSelectionProvider(IServiceLocator serviceLocator) {
   ISelectionProvider selectionProvider = serviceLocator.getService(ISelectionProvider.class);
   if (selectionProvider != null) {
     return selectionProvider;
   }
   IWorkbenchPartSite partSite = getWorkbenchPartSite(serviceLocator);
   if (partSite == null) {
     IWorkbenchPart activePart = serviceLocator.getService(IWorkbenchPart.class);
     if (activePart == null) {
       IWorkbenchWindow activeWindow = DBeaverUI.getActiveWorkbenchWindow();
       if (activeWindow != null) {
         activePart = activeWindow.getActivePage().getActivePart();
       }
     }
     if (activePart != null) {
       partSite = activePart.getSite();
     }
   }
   if (partSite != null) {
     return partSite.getSelectionProvider();
   } else {
     return null;
   }
 }
コード例 #3
0
 protected void initContextMenu(Control control) {
   MenuManager menuManager = createMenuManager();
   Menu contextMenu = menuManager.createContextMenu(control);
   control.setMenu(contextMenu);
   IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
   IWorkbenchPartSite site = window.getActivePage().getActivePart().getSite();
   site.registerContextMenu(CONTEXTMENUID, menuManager, site.getSelectionProvider());
 }
コード例 #4
0
 @Override
 public void dispose() {
   fFilterActionGroup.dispose();
   fShowActionGroup.dispose();
   fChangeListener = null;
   ISelectionProvider selectionProvider = fSite.getSelectionProvider();
   selectionProvider.removeSelectionChangedListener(fWorkingSetAssignementAction);
   super.dispose();
 }
コード例 #5
0
  void setSelectionFromEditor(IWorkbenchPart part) {
    if (!fProcessSelectionEvents
        || !linkBrowsingViewSelectionToEditor()
        || !(part instanceof IEditorPart)) return;

    IWorkbenchPartSite site = part.getSite();
    if (site == null) return;
    ISelectionProvider provider = site.getSelectionProvider();
    if (provider != null) setSelectionFromEditor(part, provider.getSelection());
  }
コード例 #6
0
ファイル: PasteHandler.java プロジェクト: pkdevboxy/osee
  @Override
  public Object execute(ExecutionEvent event) throws ExecutionException {
    if (HandlerUtil.getActivePartChecked(event) instanceof ViewPart) {
      ViewPart view = (ViewPart) HandlerUtil.getActivePartChecked(event);
      IWorkbenchPartSite myIWorkbenchPartSite = view.getSite();
      ISelectionProvider selectionProvider = myIWorkbenchPartSite.getSelectionProvider();

      if (selectionProvider != null
          && selectionProvider.getSelection() instanceof IStructuredSelection) {
        IStructuredSelection selection = (IStructuredSelection) selectionProvider.getSelection();

        ArtifactClipboard clipboard = new ArtifactClipboard(view.getSite().getId());
        Iterator<?> iterator = selection.iterator();
        Object selectionObject = null;

        while (iterator.hasNext()) {
          Object object = iterator.next();

          if (object instanceof IAdaptable) {
            selectionObject = ((IAdaptable) object).getAdapter(Branch.class);

            if (selectionObject == null) {
              selectionObject = ((IAdaptable) object).getAdapter(Artifact.class);
            }
          } else if (object instanceof Match) {
            selectionObject = ((Match) object).getElement();
          }

          if (selectionObject instanceof Artifact) {
            ArtifactPasteConfiguration config = new ArtifactPasteConfiguration();
            Operations.executeAsJob(
                new ArtifactPasteOperation(
                    config,
                    (Artifact) selectionObject,
                    clipboard.getCopiedContents(),
                    new ArtifactNameConflictHandler()),
                true);
          }
        }
      }
    }
    return null;
  }
コード例 #7
0
  public ViewActionGroup(
      int mode, IPropertyChangeListener changeListener, IWorkbenchPartSite site) {
    fChangeListener = changeListener;
    fSite = site;
    if (fChangeListener == null) {
      fChangeListener =
          new IPropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent event) {}
          };
    }
    fFilterActionGroup = new WorkingSetFilterActionGroup(site, fChangeListener);
    fShowActionGroup = new WorkingSetShowActionGroup(site);
    fWorkingSetAssignementAction = new ConfigureWorkingSetAssignementAction(site);

    ISelectionProvider selectionProvider = site.getSelectionProvider();
    selectionProvider.addSelectionChangedListener(fWorkingSetAssignementAction);

    fMode = mode;
    if (fMode == SHOW_WORKING_SETS) fActiveActionGroup = fShowActionGroup;
    else fActiveActionGroup = fFilterActionGroup;
  }
コード例 #8
0
ファイル: CompileHandler.java プロジェクト: ralic/dbeaver
 @Override
 public void updateElement(UIElement element, Map parameters) {
   List<OracleSourceObject> objects = new ArrayList<>();
   IWorkbenchPartSite partSite = UIUtils.getWorkbenchPartSite(element.getServiceLocator());
   if (partSite != null) {
     final ISelectionProvider selectionProvider = partSite.getSelectionProvider();
     if (selectionProvider != null) {
       ISelection selection = selectionProvider.getSelection();
       if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
         for (Iterator<?> iter = ((IStructuredSelection) selection).iterator(); iter.hasNext(); ) {
           final Object item = iter.next();
           final OracleSourceObject sourceObject =
               RuntimeUtils.getObjectAdapter(item, OracleSourceObject.class);
           if (sourceObject != null) {
             objects.add(sourceObject);
           }
         }
       }
     }
     if (objects.isEmpty()) {
       final IWorkbenchPart activePart = partSite.getPart();
       final OracleSourceObject sourceObject =
           RuntimeUtils.getObjectAdapter(activePart, OracleSourceObject.class);
       if (sourceObject != null) {
         objects.add(sourceObject);
       }
     }
   }
   if (!objects.isEmpty()) {
     if (objects.size() > 1) {
       element.setText("Compile " + objects.size() + " objects");
     } else {
       final OracleSourceObject sourceObject = objects.get(0);
       String objectType = TextUtils.formatWord(sourceObject.getSourceType().name());
       element.setText("Compile " + objectType /* + " '" + sourceObject.getName() + "'"*/);
     }
   }
 }
  @Override
  public Object execute(ExecutionEvent event) {

    //	Plugin.isManuallyStarted = true;

    System.out.println("ASIDECodeAnnotateHandler.java is ran ---first line");
    targetPart = HandlerUtil.getActivePart(event);

    IWorkbenchPartSite site = targetPart.getSite();
    ISelectionProvider selectionProvider = site.getSelectionProvider();
    if (selectionProvider == null) {
      return null;
    }
    ISelection selection = selectionProvider.getSelection();
    if (selection == null) {
      System.out.println("selectProject = ");
      return null;
    }
    IResource iRes = extractSelection(selection);
    if (iRes == null) {
      System.out.println("test == null");
      return null;
    }
    selectProject = iRes.getProject();
    if (selectProject == null) {
      System.out.println("selectProject == null");
      return null;
    }
    System.out.println("selectProject = " + selectProject.getName());

    // the following is temporarily added here
    pathCollector = ModelRegistry.getPathCollectorForProject(selectProject);

    if (pathCollector == null) {
      pathCollector = new PathCollector(selectProject);
    }

    paths = pathCollector.getAllPaths();

    if (paths == null) paths = Collections.synchronizedList(new ArrayList<Path>());

    System.out.println(
        "ASIDECodeAnnotateHandler.java is ran -- start iterating files of the project");
    IScriptProject scriptProject = DLTKCore.create(selectProject);
    if (scriptProject == null) {
      System.out.println("scirpt project == null");
      return null;
    }
    int count = 1;

    // gather statistics
    // GatherStatistics.NumOfWarningsInEachFile();
    // while tablename = ...

    Utils.removeAllQuestionMarkers(iRes);
    Plugin.projectResource = iRes;
    Iterator ite = Plugin.sensitive_DB_Tables.iterator();
    String currentSensitiveTableName = null;
    // commented out Nov. 27
    /*while(ite.hasNext()){
    currentSensitiveTableName = (String) ite.next();
    Plugin.CurrentSensitiveDBTable = currentSensitiveTableName;
    System.out.println("Current Table is=" + Plugin.CurrentSensitiveDBTable);*/

    String currentTableName;

    while (!Plugin.sensitive_DB_Tables_AlphRanked
        .isEmpty()) { // collect the warnings that comes from one table, one throughout iteration
                      // for each table, and put the results into the

      currentTableName = Plugin.sensitive_DB_Tables_AlphRanked.first();
      count = 1;
      Plugin.allMarkerRecords.clear();

      while (Plugin.sensitiveOperationsForCurrentIteration != null
          && Plugin.sensitiveOperationsForCurrentIteration.size() != 0) {
        count++;
        System.out.println("-----------------begin round " + count);
        System.out.println(
            "Plugin.sensitiveOperationsForCurrentIteration size =!!!"
                + Plugin.sensitiveOperationsForCurrentIteration.size());
        IScriptFolder[] folders = null;
        try {
          folders = scriptProject.getScriptFolders();
        } catch (ModelException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
        System.out.println("number of folders ==" + folders.length);

        /*String pattern = "Exec";
        process(selectProject, pattern);*/

        ////////////////
        Plugin.sensitiveOperationsForAnotherIteration.clear();
        Plugin.sensitiveOperationsForAnotherIteration = new HashSet();
        //	System.out.println("at the begining point: size of current " +
        // Plugin.sensitiveOperationsForCurrentIteration.size());
        int numOfFiles = 0;
        for (IScriptFolder folder : folders) {
          String folderName = folder.getElementName();
          if (!Constants.PHPLibraryFolders.contains(folderName)) {

            ISourceModule[] sourceModules = null;
            try {
              sourceModules = folder.getSourceModules();
            } catch (ModelException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
            numOfFiles += sourceModules.length;
          }
        }
        /*    for(int i = 0; i < 20; i++)
        System.out.println("files num = " + numOfFiles);*/
        System.out.println("sum of folders =" + folders.length);
        int currentFolderNum = 1;
        for (IScriptFolder folder : folders) {
          System.out.println("folder scanning = " + currentFolderNum + "/" + folders.length);
          String folderName = folder.getElementName();
          System.out.println("folder name = " + folderName);

          if (!Constants.PHPLibraryFolders.contains(folderName)) {

            ISourceModule[] sourceModules = null;
            try {
              sourceModules = folder.getSourceModules();
            } catch (ModelException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }

            for (ISourceModule tmpSourceModule : sourceModules) {
              System.out.println("scanning " + tmpSourceModule.getElementName());
              // if it is not the first time to run CodeAnnotate on this project, then disable the
              // scan function,
              // we have already pop the marker records from the file and displayed in Eclipse
              // already.
              if (false) {
              } // temporarily testing
              /*		if(Plugin.FIRST_TIME_RUN == false){
              	//simply display the markers based on the marker records in the file
              	String fileDir = tmpSourceModule.getResource().getFullPath().toString();
              	System.out.println("all markers size = " + Plugin.allMarkerRecords.size());
              	HashSet<MarkerRecord> markerRecordsInSingleFile = Utils.getMarkerRecordsForSingleFile(Plugin.allMarkerRecords, fileDir);
              	Utils.createMarkersForSingleFile(markerRecordsInSingleFile, tmpSourceModule);

              	HashSet<AnnotationRecord> annotationRecordsInSingleFile = Utils.getAnnotationRecordsForSingleFile(Plugin.allAnnotationRecords, fileDir);
              	Utils.createAnnotationsForSingleFile(annotationRecordsInSingleFile, tmpSourceModule);

              	System.out.println("finished creating markers for fileDir = " + fileDir + ", markerRecordsInSingleFile size = " + markerRecordsInSingleFile.size());
              }*/
              else { // start scanning the files for sensitive operations

                //			System.out.println("isourcemodule being built = " +
                // tmpSourceModule.getElementName().toLowerCase());
                //				System.out.println("full path of the source module is ---" +
                // tmpSourceModule.getResource().getFullPath().toString());

                SensitiveOperationVisitor visitor =
                    new SensitiveOperationVisitor(
                        tmpSourceModule,
                        Plugin.sensitiveOperationsForCurrentIteration,
                        Plugin.sensitiveOperationsForAnotherIteration,
                        Plugin.sensitiveOperations);
                Program root = null;
                try {
                  root = Utils.getCompilationUnit(tmpSourceModule);
                } catch (Exception e) {
                  // TODO Auto-generated catch block
                  System.err.println("root = util.getcompilationUnit() throws exception!");
                  e.printStackTrace();
                }
                //		System.out.println("begin of traverseTopDown");
                if (root == null) {
                  System.err.println(
                      "tmpSourceModule name = "
                          + tmpSourceModule.getElementName()
                          + " in "
                          + tmpSourceModule.getPath().toString());
                  System.err.println("root == null");
                  // return null;
                }
                root.traverseTopDown(visitor);

                Plugin.sensitiveOperations = visitor.getSensitiveOperations();
                Plugin.sensitiveOperationsForAnotherIteration =
                    visitor.getSensitiveOperationsForAnotherIteration();
              }
            }
          }
          currentFolderNum++;
        }
        Plugin.sensitiveOperationsForCurrentIteration.clear();
        Plugin.sensitiveOperationsForCurrentIteration = new HashSet();

        //	System.out.println("Plugin.sensitiveOperationsForAnotherIteration size after iteration ="
        // + Plugin.sensitiveOperationsForAnotherIteration.size());
        Plugin.sensitiveOperationsForCurrentIteration =
            (HashSet<SensitiveMethod>) Plugin.sensitiveOperationsForAnotherIteration.clone();
        //	System.out.println("after assignment, Plugin.sensitiveOperationsForCurrentIteratio size =
        // " + Plugin.sensitiveOperationsForCurrentIteration.size());

        /*String newRuleFileName = "newRulesForIteration" + count + "th.txt";
        InRunPluginDataSave.writeNewSensitiveRulesIntoFile(newRuleFileName, Plugin.sensitiveOperationsForCurrentIteration);

        String mappingFileName = "numOfWarningsInEachFileInIteration" + (count-1) + "th.txt";;
        InRunPluginDataSave.writeMappingBetweenWarningsAndFiles(mappingFileName, Plugin.numberOfWarningsInEachFile);

        if(count == 2){
        String newTableNamesFileName = "tableNamesEncounteredInIteration" + (count-1) + "th.txt";
        InRunPluginDataSave.writeTableNamesIntoFile(newTableNamesFileName, Plugin.allTableNames);

        String mappingFileName2 = "numOfWarningsRelatedToEachTableForIteration" + (count-1) + "th.txt";
        InRunPluginDataSave.writeMappingBetweenWarningsAndFiles(mappingFileName2, Plugin.numberOfWarningsRelatedToEachTable);
        }*/

        PostRunPluginConfig.writeMarkerRecordIntoFile(
            Plugin.allMarkerRecords, count, currentTableName);
      }

      //// newly added
      // remove the first table name in the treeset so that we focus on the next table in the next
      // iteration.
      Plugin.sensitive_DB_Tables_AlphRanked.pollFirst();
      Plugin.sensitiveOperationsForCurrentIteration = RulesUtils.getSensitiveOperations();
    }

    // commented out Nov. 27
    /*GatherStatistics.writeMarkersForEachTable(Plugin.allMarkerRecords, Plugin.CurrentSensitiveDBTable);
    Plugin.allMarkerRecords.clear();
    Plugin.allMarkerRecords = new HashSet();
    count = 1;
    Plugin.sensitiveOperationsForCurrentIteration.clear();
    Plugin.sensitiveOperationsForCurrentIteration = new HashSet();
    Plugin.sensitiveOperationsForCurrentIteration = (HashSet<SensitiveMethod>) Plugin.sensitiveOperationsForCurrentIteration_backup.clone();
    Plugin.sensitiveOperations.clear();
    Plugin.sensitiveOperations = new HashSet();
    Plugin.sensitiveOperations = (HashSet<SensitiveMethod>)Plugin.sensitiveOperations_backup.clone();
    }*/
    // above is temporarily added.

    // below are temporarily added for the analysis use
    //		GatherStatistics.filesWithoutRequiredAccessControls(Plugin.numberOfWarningsInEachFile,
    // Plugin.numberOfAccessControlsInEachFile);

    /*
     * Use a Job to attach a {@link CodeAnnotateDocumentEditListener} to
     * each and every IDocument that is related to a ICompilationUnit in the
     * selected project
     */
    /*
     * Job job = new MountListenerJob("Mount listener to Java file",
     * JavaCore.create(selectProject)); job.setPriority(Job.INTERACTIVE);
     * job.schedule();
     */

    /* Delegates all heavy lifting to {@link PathFinder} */
    /*Job heavy_job = new Job("Finding paths in Project: "
    				+ selectProject.getName()) {

    			@Override
    			protected IStatus run(final IProgressMonitor monitor) {
    				try {
    					Plugin.getDefault().getWorkbench().getDisplay()
    							.asyncExec(new Runnable() {

    								@Override
    								public void run() {
    									// PathFinder.getInstance(selectProject).run(monitor);

    								}

    							});

    				} finally {
    					monitor.done();
    				}
    				return Status.OK_STATUS;
    			}

    		};
    		heavy_job.setPriority(Job.LONG);
    		heavy_job.schedule();
    */
    System.out.println("finished scanning, marker records saved");
    // PostRunPluginConfig.config(Plugin.allMarkerRecords, Plugin.allAnnotationRecords);
    //	PostRunPluginConfig.writeMarkerRecordIntoFile(Plugin.allMarkerRecords, count);
    //		GatherStatistics.readWarningStatistics(Plugin.sensitive_DB_Tables_AlphRanked,
    // "Update_Level5.txt");
    return null;
  }
コード例 #10
0
  private void selectFiles(IProject project, List<? extends IResource> createdFiles) {
    // Attempt to select the newly created files in the Package Explorer
    IWorkbench workbench = AdtPlugin.getDefault().getWorkbench();
    IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
    IViewPart viewPart = page.findView(JavaUI.ID_PACKAGES);
    if (viewPart != null) {
      IWorkbenchPartSite site = viewPart.getSite();
      IJavaProject javaProject = null;
      try {
        javaProject = BaseProjectHelper.getJavaProject(project);
      } catch (CoreException e) {
        AdtPlugin.log(e, null);
      }
      final ISelectionProvider provider = site.getSelectionProvider();
      if (provider != null) {
        List<TreePath> pathList = new ArrayList<TreePath>();
        for (IResource file : createdFiles) {
          // Create a TreePath for the given file,
          // which should be the JavaProject, followed by the folders down to
          // the final file.
          List<Object> segments = new ArrayList<Object>();
          segments.add(file);
          IContainer folder = file.getParent();
          if (folder != null && !(folder instanceof IProject)) {
            segments.add(folder);
            // res folder
            folder = folder.getParent();
            if (folder != null && !(folder instanceof IProject)) {
              segments.add(folder);
            }
          }
          // project
          segments.add(javaProject);

          Collections.reverse(segments);
          TreePath path = new TreePath(segments.toArray());
          pathList.add(path);

          // IDEA: Maybe normalize the files backwards (IFile objects aren't unique)
          // by maybe using the package explorer icons instead
        }

        TreePath[] paths = pathList.toArray(new TreePath[pathList.size()]);
        final TreeSelection selection = new TreeSelection(paths);

        provider.setSelection(selection);

        // Workaround: The above doesn't always work; it will frequently select
        // some siblings of the real files. I've tried a number of workarounds:
        // normalizing the IFile objects by looking up the canonical ones via
        // their relative paths from the project; deferring execution with
        // Display.asyncRun; first calling select on the parents, etc.
        // However, it turns out a simple workaround works best: Calling this
        // method TWICE. The first call seems to expand all the necessary parents,
        // and the second call ensures that the correct children are selected!
        provider.setSelection(selection);

        viewPart.setFocus();
      }
    }
  }
コード例 #11
0
 @Override
 public ISelectionProvider getSelectionProvider() {
   return partSite.getSelectionProvider();
 }
コード例 #12
0
ファイル: APIUsageActions.java プロジェクト: taoxiease/asegrp
  public void run(IAction action) {
    IWorkbenchPartSite site = _part.getSite();
    ISelectionProvider provider = site.getSelectionProvider();
    StructuredSelection selection = (StructuredSelection) provider.getSelection();
    Object[] items = selection.toArray();

    RepositoryAnalyzer ra = RepositoryAnalyzer.getInstance();

    if (items.length != 1) {
      logger.error("ERROR: This should be run only on one item");
    }

    if (items[0] instanceof IJavaProject) {
      try {
        RepositoryAnalyzer.resetMIIdGen();

        IJavaProject project = (IJavaProject) items[0];

        String codesamples_dir_local = codesamples_dir + project.getElementName().toString();

        ra.setLibProject(project);
        ParseSrcFiles psf = new ParseSrcFiles();
        psf.parseSources(project);

        loadPackageInfoToMemory(project);

        /*Debugging section for getting list of classes*/
        try {
          BufferedWriter bw = new BufferedWriter(new FileWriter("APIList.txt"));
          for (Iterator iter = ra.getLibClassMap().values().iterator(); iter.hasNext(); ) {
            LibClassHolder lcc = (LibClassHolder) iter.next();

            bw.write(lcc.getName() + "#");
            for (LibMethodHolder lmh : lcc.getMethods()) {
              bw.write(lmh.toString() + "#");
            }

            bw.write("\n");
          }
          bw.close();
        } catch (Exception ex) {
          ex.printStackTrace();
        }

        /*End of Debug Section*/

        // Analysing code samples collected from Google code search engine
        RepositoryCreator rcObj = new RepositoryCreator();
        rcObj.createLocalRepos(codesamples_dir_local);

        logger.debug("Finished downloading files...");
        ra.analyzeRepository(codesamples_dir_local);

        // Debugging output of all collected sequences from the samples
        logger.info("Outputting all gathered sequenes...");
        List<String> seqList = ra.getMethodIDSequences();
        BufferedWriter bw = new BufferedWriter(new FileWriter("MethodSequences.txt"));
        int counter = 0;
        for (String sequence : seqList) {
          counter++;
          bw.write("Sequence " + counter + "\n");

          String elementArr[] = sequence.split(" ");
          for (String elem : elementArr) {
            LibMethodHolder lmh = ra.getIdToLibMethod().get(Integer.parseInt(elem));
            bw.write(
                "\t "
                    + /*lmh.getDescriptor() + " : " +*/ lmh.getContainingClass().getName()
                    + " : "
                    + lmh
                    + "\n");
          }
        }
        bw.close();
        // End of debugging output

        // MAFIA: Writing files for mining (mcseq.txt and mcseq.spec)
        /*List<String> seqIDList = ra.getMethodIDSequences();
         		BufferedWriter bwBideMcSeq = new BufferedWriter(new FileWriter("mcseq.txt"));
         		int seqCounter = 0, maxLen = 0, totalSeqLength = 0;
         		for(String IDSequence : seqIDList)
         		{
         			bwBideMcSeq.write(IDSequence + " \n");
         			seqCounter++;
         			if(IDSequence.length() > maxLen)
         				maxLen = IDSequence.length();
         			totalSeqLength += IDSequence.length();
         		}
         		bwBideMcSeq.write(" \n");
         		bwBideMcSeq.close();
         		//End of Mafia output

         		//Executing Mafia tool
         		try
        {
        	Runtime javaRuntime = Runtime.getRuntime();
        	String command = "mafia.exe -mfi .008 -ascii mcseq.txt frequent.dat ";

        	@SuppressWarnings("unused")
        	Process bideProcess = javaRuntime.exec(command);
        	Thread.sleep(60 * 1000); //TODO: To replace with WAIT later
        	//bideProcess.waitFor();  //NOTE: This method hangs if the process initiated process any console output and it is not consumed
        }
        catch(Exception ex)
        {
        	logger.error("Error in executing MAFIA!!!" + ex);
        }

         		//Reading the BIDE output: Each frequent sequence must include only APIs categorized
        //as hotspots
        HashSet<Integer> hotspotSet = new HashSet<Integer>();
        BufferedWriter bw_freqSeq = new BufferedWriter(new FileWriter("FrequentSeq.txt"));
         		Scanner bide_out = new Scanner(new File("frequent.dat"));

         		HashSet<CodeExampleStore> codeExampleStore = RepositoryAnalyzer.getInstance().getCodeExampleSet();


         		int fcounter = 0;
         		while(bide_out.hasNextLine())
         		{
         			fcounter++;
         			String freqSeq = bide_out.nextLine();
         			String[] freqSeqList = (freqSeq.substring(0,freqSeq.indexOf("("))).split(" ");
         			bw_freqSeq.write("Frequent Usage Scenario: " + fcounter + "\n");

         			HashSet<Integer> currentSeqSet = new HashSet<Integer>();
         			String scenarioType = "InvokesUS";
         			for(String miId : freqSeqList)
         			{
         				Integer intObj = new Integer(miId);
         				hotspotSet.add(intObj);
         				currentSeqSet.add(intObj);
         				LibMethodHolder lmh = ra.getIdToLibMethod().get(intObj);

         				bw_freqSeq.write("\t " + lmh.getContainingClass().getName() + " : " + lmh + "\n");
         				if(lmh.getName().indexOf("ExtendsClass") != -1) {
         					scenarioType = "ExtendsUS";
         				}

         				if(lmh.getName().indexOf("ImplementsInterface") != -1) {
         					scenarioType = "ImplementsUS";
         				}

         				//if((lmh.getMethodType() & LibMethodHolder.TEMPLATE) == 0 && (lmh.getMethodType() & LibMethodHolder.HOOK) != 0)
         				//{
         				//	logger.warn("Warning: Hook method appeared in main sequence " + lmh);
         				//}

         				//Get the corresponding hook hotspots
         				//HashSet<LibMethodHolder> methodsInvoked = lmh.getInvokedMethods();
         				//for(LibMethodHolder invokedLMH : methodsInvoked)
         				//{
         				//	if((invokedLMH.getMethodType() & LibMethodHolder.TEMPLATE) == 0 && (invokedLMH.getMethodType() & LibMethodHolder.HOOK) != 0)
         				//	{
         				//		bw_freqSeq.write("\t\tStrict Hook: " + invokedLMH.getContainingClass().getName() + " : " + invokedLMH + "\n");
         				//	} else if ((invokedLMH.getMethodType() & LibMethodHolder.HOOK) != 0)
         				//	{
         				//		bw_freqSeq.write("\t\tOptional Hook: " + invokedLMH.getContainingClass().getName() + " : " + invokedLMH + "\n");
         				//	}
         				//}
         			}
         			bw_freqSeq.write("Scenario Type : " + scenarioType);
         			//Identify the equivalent example
         			for(CodeExampleStore cesObj : codeExampleStore) {
         				if(cesObj.methodIds.containsAll(currentSeqSet))
         				{
         					bw_freqSeq.write(" FileName : " + cesObj.filename + " MethodName : " + cesObj.methodname + "\n");
         					break;
         				}
         			}
         		}

        bide_out.close();
        bw_freqSeq.close();


        logger.info("Number of Final Hotspots: " + hotspotSet.size());
        logger.info("Hotspot IDs: " + hotspotSet);
        */
        // Freeing the memory
        RepositoryAnalyzer.clearInstance();

      } catch (Throwable th) {
        th.printStackTrace();
      }

    } else {
      logger.error("ERROR: This should be run only on a Java project");
    }
  }