Esempio n. 1
0
  public static interface Decorations {

    /** */
    ImageDescriptor ADD = Activator.imageDescriptor("addOverlay.gif");

    /** */
    ImageDescriptor COLLECTION = Activator.imageDescriptor("collectionOverlay.gif");

    /** */
    ImageDescriptor MAPPED = Activator.imageDescriptor("mappedOverlay.gif");
  }
Esempio n. 2
0
 private static void populateClasses(
     final Shell shell, final IParent parent, final List<IType> types, final Filter filter) {
   try {
     for (final IJavaElement element : parent.getChildren()) {
       if (element instanceof IType) {
         final IType type = (IType) element;
         if (type.isClass()
             && type.isStructureKnown()
             && !type.isAnonymous()
             && !type.isLocal()
             && !Flags.isAbstract(type.getFlags())
             && Flags.isPublic(type.getFlags())
             && (filter == null || filter.accept(type))) {
           types.add(type);
         }
       } else if (element instanceof IParent
           && !element.getPath().toString().contains("/test/")
           && (!(element instanceof IPackageFragmentRoot)
               || !((IPackageFragmentRoot) element).isExternal())) {
         populateClasses(shell, (IParent) element, types, filter);
       }
     }
   } catch (final JavaModelException e) {
     Activator.error(e);
   }
 }
Esempio n. 3
0
 /** @param model */
 public JavaPage(String pageName, final Model model, boolean isSource) {
   super(pageName, model);
   setTitle("Java Page");
   setImageDescriptor(Activator.imageDescriptor("transform.png"));
   this.isSource = isSource;
   observablesManager.addObservablesFromContext(context, true, true);
   _builder = new ModelBuilder();
 }
Esempio n. 4
0
 private static void populateResources(
     final Shell shell, final IContainer container, final List<IResource> resources) {
   try {
     for (final IResource resource : container.members()) {
       if (resource instanceof IContainer) {
         populateResources(shell, (IContainer) resource, resources);
       } else {
         resources.add(resource);
       }
     }
   } catch (final Exception e) {
     Activator.error(e);
   }
 }
Esempio n. 5
0
  public static void updateMavenDependencies(
      final List<Dependency> dependencies, final IProject project) throws CoreException {
    final IFile pomIFile = project.getProject().getFile("pom.xml");
    final File pomFile = new File(pomIFile.getLocationURI());
    final org.apache.maven.model.Model pom = MavenPlugin.getMaven().readModel(pomFile);

    // Check if dependency already in the pom
    final List<Dependency> missingDependencies = new ArrayList<>();
    for (final Dependency dependency : dependencies) {
      boolean found = false;
      for (final org.apache.maven.model.Dependency pomDependency : pom.getDependencies()) {
        if (pomDependency.getGroupId().equalsIgnoreCase(dependency.getGroupId())
            && pomDependency.getArtifactId().equalsIgnoreCase(dependency.getArtifactId())) {
          // check for correct version
          if (!pomDependency.getVersion().equalsIgnoreCase(dependency.getVersion())) {
            pomDependency.setVersion(dependency.getVersion());
          }
          found = true;
          break;
        }
      }
      if (!found) {
        missingDependencies.add(dependency);
      }
    }

    for (final Dependency dependency : missingDependencies) {
      final org.apache.maven.model.Dependency pomDependency =
          new org.apache.maven.model.Dependency();
      pomDependency.setGroupId(dependency.getGroupId());
      pomDependency.setArtifactId(dependency.getArtifactId());
      pomDependency.setVersion(dependency.getVersion());
      pom.addDependency(pomDependency);
    }

    if (!missingDependencies.isEmpty()) {
      try (final OutputStream stream = new BufferedOutputStream(new FileOutputStream(pomFile))) {
        MavenPlugin.getMaven().writeModel(pom, stream);
        pomIFile.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
      } catch (final Exception e) {
        Activator.error(e);
      }
    }
  }
Esempio n. 6
0
  public static interface Images {

    /** */
    Image ADD_FUNCTION = Activator.imageDescriptor("addFunction16.gif").createImage();

    /** */
    Image ADD = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ADD);

    /** */
    Image ATTRIBUTE = Activator.imageDescriptor("attribute16.gif").createImage();

    /** */
    Image CHANGE = Activator.imageDescriptor("change16.gif").createImage();

    /** */
    Image CLEAR = Activator.imageDescriptor("clear16.gif").createImage();

    /** */
    Image COLLAPSE_ALL = Activator.imageDescriptor("collapseAll16.gif").createImage();

    /** */
    Image DELETE =
        PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_ETOOL_DELETE);

    /** */
    Image ELEMENT = Activator.imageDescriptor("element16.gif").createImage();

    /** */
    Image FILTER = Activator.imageDescriptor("filter16.gif").createImage();

    /** */
    Image HIDE_MAPPED = Activator.imageDescriptor("hideMapped16.gif").createImage();

    /** */
    Image MAPPED = Activator.imageDescriptor("mapped16.gif").createImage();

    /** */
    Image MENU = Activator.imageDescriptor("menu10x5.gif").createImage();

    /** */
    Image SEARCH = Activator.imageDescriptor("search16.gif").createImage();

    /** */
    Image TREE = Activator.imageDescriptor("tree16.gif").createImage();

    /** */
    Image VARIABLE = Activator.imageDescriptor("variable16.gif").createImage();
  }
Esempio n. 7
0
  public static interface Colors {

    /** */
    Color BACKGROUND = Activator.color(255, 255, 255);

    /** */
    Color CONTAINER = Activator.color(192, 192, 192);

    /** */
    Color CONTAINER_ALTERNATE = Activator.color(224, 224, 224);

    /** */
    Color DROP_TARGET_BACKGROUND = Activator.color(0, 0, 255);

    /** */
    Color DROP_TARGET_FOREGROUND = Activator.color(255, 255, 255);

    /** */
    Color EXPRESSION = Activator.color(192, 0, 192);

    /** */
    Color FOREGROUND = Activator.color(0, 0, 0);

    /** */
    Color FUNCTION = Activator.color(192, 255, 192);

    /** */
    Color FUNCTION_ALTERNATE = Activator.color(128, 255, 128);

    /** */
    Color POTENTIAL_DROP_TARGET1 = Activator.color(0, 0, 128);

    /** */
    Color POTENTIAL_DROP_TARGET2 = Activator.color(32, 32, 160);

    /** */
    Color POTENTIAL_DROP_TARGET3 = Activator.color(64, 64, 192);

    /** */
    Color POTENTIAL_DROP_TARGET4 = Activator.color(92, 92, 224);

    /** */
    Color POTENTIAL_DROP_TARGET5 = Activator.color(128, 128, 255);

    /** */
    Color POTENTIAL_DROP_TARGET6 = Activator.color(92, 92, 224);

    /** */
    Color POTENTIAL_DROP_TARGET7 = Activator.color(64, 64, 192);

    /** */
    Color POTENTIAL_DROP_TARGET8 = Activator.color(32, 32, 160);

    /** */
    Color SELECTED = Activator.color(180, 213, 255);

    /** */
    Color SELECTED_NO_FOCUS = Activator.color(212, 212, 212);

    /** */
    Color VARIABLE = Activator.color(0, 0, 192);
  }