Пример #1
0
 public void update() {
   javaCodeDisplayer.update();
   if (_browserRootObject != _browser.getRootObject()) {
     _browser.update();
     _browserRootObject = _browser.getRootObject();
     if (_browserRootObject instanceof FJPJavaParseException) {
       SwingUtilities.invokeLater(
           new Runnable() {
             @Override
             public void run() {
               if (_browser != null && _browserRootObject != null) {
                 _browser.addToSelected(_browserRootObject);
                 _browserView.treeSingleClick(_browserRootObject);
               }
             }
           });
     }
   }
 }
Пример #2
0
  public ParsedJavaFileView(
      JavaFileResource javaFileResource, SGController controller, boolean editable) {
    super(JSplitPane.HORIZONTAL_SPLIT);
    _controller = controller;
    _javaFileResource = javaFileResource;
    if (editable) {
      javaCodeDisplayer =
          new CodeEditor((GenerationAvailableFileResource) javaFileResource, controller);
      javaCodeDisplayer.getComponent().requestFocus();
    } else {
      javaCodeDisplayer =
          new CodeDisplayer(
              (GenerationAvailableFileResource) javaFileResource,
              ContentSource.CONTENT_ON_DISK,
              controller);
    }
    _browser = new JavaParserBrowser((SGJavaFile) javaFileResource.getCGFile(), _controller);
    _browserRootObject = _browser.getRootObject();
    _browserView = new JavaParserBrowserView(_browser);
    _codePanel = (ASCIIFileCodePanel) javaCodeDisplayer.getComponent();
    setLeftComponent(_codePanel);
    setRightComponent(_browserView);

    Dimension preferredDim = javaCodeDisplayer.getComponent().getMinimumSize();
    preferredDim.width = 100;
    javaCodeDisplayer.getComponent().setMinimumSize(preferredDim);
    setResizeWeight(1);
    resetToPreferredSizes();
    validate();
    if (_browserRootObject instanceof FJPJavaParseException) {
      SwingUtilities.invokeLater(
          new Runnable() {
            @Override
            public void run() {
              if (_browser != null && _browserRootObject != null) {
                _browser.addToSelected(_browserRootObject);
                _browserView.treeSingleClick(_browserRootObject);
              }
            }
          });
    }
  }