コード例 #1
0
ファイル: Trampoline2.java プロジェクト: afdreher/Field
    @Override
    protected String findLibrary(String rawName) {

      //			System.out.println("####\n\n looking for <" + rawName + "> \n\n #############");
      if (Platform.isMac()) {
        String name = "lib" + rawName + ".dylib";

        System.out.println(extendedLibraryPaths);
        for (String s : extendedLibraryPaths) {
          File file = new File(s, name);
          if (file.exists()) {; // System.out.println(" found it <"
            // + file + ">");
            return file.getAbsolutePath();
          }
        }
        for (String s : extendedClassPaths) {
          File file = new File(s, name);
          if (file.exists()) {; // System.out.println(" found it <"
            // + file + ">");
            return file.getAbsolutePath();
          }
        }
      }
      if (Platform.isLinux()) {
        String name = "lib" + rawName + ".so";

        for (String s : extendedLibraryPaths) {
          File file = new File(s, name);
          if (file.exists()) {
            System.out.println(" found it <" + file + ">");
            return file.getAbsolutePath();
          }
        }
        for (String s : extendedClassPaths) {
          File file = new File(s, name);
          if (file.exists()) {
            System.out.println(" found it <" + file + ">");
            return file.getAbsolutePath();
          }
        }
      }
      return super.findLibrary(rawName);
    }
コード例 #2
0
  @Override
  public void registeredWith(iVisualElement root) {
    super.registeredWith(root);
    this.root = root;

    this.container = new Composite(ToolBarFolder.currentFolder.getContainer(), SWT.NO_BACKGROUND);

    ToolBarFolder.currentFolder.add("icons/reload.png", container);

    toolbar = new Composite(container, SWT.BACKGROUND);
    Color backgroundColor = ToolBarFolder.currentFolder.firstLineBackground;
    toolbar.setBackground(backgroundColor);

    tree = new Tree(container, 0);
    tree.setBackground(ToolBarFolder.firstLineBackground);
    new GraphNodeToTreeFancy.Pretty(tree, 200);

    GridLayout gl = new GridLayout(1, false);
    gl.marginHeight = 0;
    gl.marginWidth = 0;
    if (Platform.isLinux()) {
      gl.marginLeft = 0;
      gl.marginRight = 0;
      gl.marginTop = 0;
      gl.marginBottom = 0;
      gl.verticalSpacing = 0;
    }

    container.setLayout(gl);
    {
      GridData data = new GridData();
      data.heightHint = 28;
      if (Platform.getOS() == OS.linux) {
        data.heightHint = 38;
      }
      data.widthHint = 1000;
      data.horizontalAlignment = SWT.FILL;
      data.grabExcessHorizontalSpace = true;
      toolbar.setLayoutData(data);
    }
    {
      GridData data = new GridData();
      data.grabExcessVerticalSpace = true;
      data.grabExcessHorizontalSpace = true;
      data.verticalAlignment = SWT.FILL;
      data.horizontalAlignment = SWT.FILL;
      data.verticalIndent = 0;
      data.horizontalIndent = 0;
      tree.setLayoutData(data);
    }

    Link label = new Link(toolbar, SWT.MULTI | SWT.NO_BACKGROUND | SWT.CENTER);
    label.setText("Java class reloading");
    label.setFont(
        new Font(
            Launcher.display,
            label.getFont().getFontData()[0].getName(),
            label.getFont().getFontData()[0].getHeight() + 2,
            SWT.NORMAL));
    label.setBackground(ToolBarFolder.firstLineBackground);

    toolbar.setLayout(new GridLayout(1, true));
    GridData gd = new GridData(SWT.CENTER, SWT.CENTER, true, true);
    // gd.verticalIndent = 1;
    label.setLayoutData(gd);

    tree.setBackground(ToolBarFolder.background);

    tree.addListener(
        SWT.MouseDown,
        new Listener() {

          @Override
          public void handleEvent(Event arg0) {
            if (Platform.isPopupTrigger(arg0)) {
              TreeItem[] s = tree.getSelection();
              if (s.length == 1) popupFor(s[0], arg0);
            }
          }
        });

    tree.addListener(
        SWT.MouseDoubleClick,
        new Listener() {

          @Override
          public void handleEvent(Event arg0) {
            if (Platform.isPopupTrigger(arg0)) return;

            TreeItem[] s = tree.getSelection();
            if (s.length == 1) doubleClickFor(s[0], arg0);
          }
        });

    for (String s : reloadDomains) {
      Trampoline2.trampoline.reloadingSupport.addDomain(s);
    }
  }