/** Rebuild resource dependancies for this resource */
  @Override
  public void rebuildDependancies() {
    super.rebuildDependancies();

    if (getComponentDefinition() != null) {

      addToDependentResources(getProject().getFlexoDMResource());
      addToDependentResources(getComponentDefinition().getComponentResource());

      if (getComponentDefinition().getWOComponent() != null) {
        for (Enumeration en =
                getComponentDefinition().getWOComponent().getAllComponentInstances().elements();
            en.hasMoreElements(); ) {
          ComponentInstance ci = (ComponentInstance) en.nextElement();
          if (ci.getComponentDefinition() != null) {
            if (logger.isLoggable(Level.FINE)) {
              logger.fine(
                  "Found dependancy between "
                      + this
                      + " and "
                      + ci.getComponentDefinition().getComponentResource());
            }
            addToDependentResources(ci.getComponentDefinition().getComponentResource());
          } else {
            if (logger.isLoggable(Level.WARNING)) {
              logger.warning(
                  "Inconsistant data: ComponentInstance refers to an unknown ComponentDefinition "
                      + ci.getComponentName());
            }
          }
        }
      }
    }
  }
예제 #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);
              }
            }
          });
    }
  }