Package com.subhajit.diagram.sequencediagram

Examples of com.subhajit.diagram.sequencediagram.SequenceDiagramContext


          .getJavaProject();
      URLClassLoader classLoader = ProjectUtils.getClassLoader(
          javaProject, false);
      SequenceDiagramGenerator generator = new SequenceDiagramGenerator(
          classLoader);
      SequenceDiagramContext ctx = new SequenceDiagramContext();
      final String className = EclipseUtils
          .getClassName((CompilationUnit) sourceMethod
              .getCompilationUnit());

      Method method = ProjectUtils.locateMethod(classLoader, className,
          sourceMethod);
      if (method == null) {
        System.err.println("Could not locate method.");
        return;
      }
      ctx.setClassInfo(new ClassInfo(className, classLoader));
      ctx.setFilters(SequenceDiagramAction.getPackageListInteractively()
          .toArray(IConstants.ZERO_LENGTH_STRING_ARRAY));
      ctx.setFollowInvokedMethods(true);

      MethodInfo methodInfo = MethodInfo.createMethodInfo(method);
      ctx.setMethodInfo(methodInfo);
      ctx.setShowInstructions(false);
      ctx.setShowSourceLines(false);
      String sequenceDiagramSpecification = generator
          .generateSequenceDiagramSpec(ctx);

      // Save the spec in a file.
      final File tempFile = File.createTempFile("spe", ".txt");
View Full Code Here


      protected void runTask(IProgress progress) throws Exception {
        progress.setMessage("Computing sequence diagram...");
        SequenceDiagramGenerator gen = new SequenceDiagramGenerator(
            classLoader);

        SequenceDiagramContext ctx = new SequenceDiagramContext();
        ctx
            .setClassInfo(new ClassInfo(className, gen
                .getClassLoader()));
        ctx.setFilters(packagesList
            .toArray(IConstants.ZERO_LENGTH_STRING_ARRAY));
        ctx.setFollowInvokedMethods(false);

        // Show source code lines.
        ctx.setShowSourceLines(true);
        // Find all relevant source code locations.
        EclipseProject eclipseProject = new EclipseProject(ProjectUtils
            .getProjectFile((IJavaProject) inputs.get("project")));
        ctx.setSourceCodeManager(new SourceCodeManager(eclipseProject
            .getSourcePaths()));
        ctx.setShowInstructions(false);

        ClassInfo classInfo = new ClassInfo(className, gen
            .getClassLoader());
        final List<MethodInfo> methods = classInfo.getMethods();
        progress.setRange(0, methods.size() + 1);
        for (MethodInfo method : methods) {
          progress.increment(1, "Processing "
              + method.getMethodName());
          ctx.setMethodInfo(method);
          diagrams.put(method, DrawImage
              .drawImage(gen.generateSequenceDiagramSpec(ctx),
                  OutputFormat.JPG));
        }
View Full Code Here

    final List<String> packagesList = getPackageListInteractively();
    if (packagesList == null || packagesList.isEmpty()) {
      return;
    }

    final SequenceDiagramContext ctx = new SequenceDiagramContext();
    final SequenceDiagramGenerator gen = new SequenceDiagramGenerator(
        classLoader);
    ctx.setClassInfo(new ClassInfo(className, gen.getClassLoader()));
    ctx.setFilters(packagesList
        .toArray(IConstants.ZERO_LENGTH_STRING_ARRAY));
    ctx.setFollowInvokedMethods(false);
    // Show source code lines.
    ctx.setShowSourceLines(true);

    // Find all relevant source code locations.
    // Actually, ask the user to provide these (if any).
    // ctx.setSourceCodeManager(sourceCodeManager)
    ctx.setShowInstructions(false);

    ClassInfo classInfo = new ClassInfo(className, gen.getClassLoader());
    final List<MethodInfo> methods = classInfo.getMethods();
    final Map<MethodInfo, byte[]> diagrams = new HashMap<MethodInfo, byte[]>();

    // Create the sequence diagram.
    new TaskRunner(new ISwingRunnableWithProgress() {
      public void run(IProgress progress) throws Throwable {
        progress.setRange(0, methods.size() + 1);
        for (MethodInfo method : methods) {
          progress.increment(1, "Processing "
              + method.getMethodName());
          ctx.setMethodInfo(method);
          diagrams.put(method, DrawImage
              .drawImage(gen.generateSequenceDiagramSpec(ctx),
                  OutputFormat.JPG));
        }
      }
View Full Code Here

TOP

Related Classes of com.subhajit.diagram.sequencediagram.SequenceDiagramContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.