/**
   * Shows or hides the DataflowAnomalyTable, set the right text for the button.
   *
   * @param isShown, true if the Table should be visible, false otherwise
   */
  private void showTableArea(boolean isShown) {
    tableViewer.setVisible(isShown);

    // if the AnomalyTable is visible, an Area is 50% of the View
    // set the new Size and update the SwitchButton's Label
    if (isShown) {
      ((GridData) graphViewer.getLayoutData()).horizontalSpan = 1;
      switchButton.setText(getString(StringKeys.VIEW_DATAFLOW_SWITCHBUTTON_HIDE));

      // refresh the table if it isn't refreshed yet.
      if (!isTableRefreshed) {
        refreshDFATable(getResource());
      }
    } else {
      ((GridData) graphViewer.getLayoutData()).horizontalSpan = 2;
      switchButton.setText(getString(StringKeys.VIEW_DATAFLOW_SWITCHBUTTON_SHOW));
    }

    // lay out to update the View
    dfaFrame.layout(true, true);
  }
  /* @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite) */
  @Override
  public void createControl(Composite parent) {
    dfaFrame = new Composite(parent, SWT.NONE);

    // //////////////////////////////////////////////////
    // upper title area

    Composite titleArea = new Composite(dfaFrame, SWT.NONE);
    GridData tableData = new GridData(GridData.FILL_HORIZONTAL);
    tableData.horizontalSpan = 2;
    titleArea.setLayoutData(tableData);
    titleArea.setLayout(new GridLayout(4, false));

    Label methodLabel = new Label(titleArea, 0);
    methodLabel.setText("Method: ");

    buildMethodSelector(titleArea);

    // a label for the spacing
    Label label = new Label(titleArea, SWT.NONE);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // the Button for showing or hiding the Anomaly-List
    switchButton = new Button(titleArea, SWT.RIGHT);
    switchButton.setLayoutData(new GridData(130, 25));
    switchButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent se) {
            isTableShown = !isTableShown;
            showTableArea(isTableShown);

            if (!isTableShown) {
              if (graphViewer == null || graphViewer.getGraph() == null) {
                return;
              }

              final DataflowGraph graph = graphViewer.getGraph();
              if (graph.isMarked()) {
                graph.demark();
              }
            }
          }
        });

    switchButton.setText(getString(StringKeys.VIEW_DATAFLOW_SWITCHBUTTON_SHOW));

    // //////////////////////////////////////////////////
    // the DataflowGraphViewer (left Part)
    graphViewer = new DataflowGraphViewer(dfaFrame, SWT.NONE);
    graphViewer.setVisible(false);

    // //////////////////////////////////////////////////
    // the DataflowAnomalyTable (right Part)
    tableViewer = new DataflowAnomalyTableViewer(dfaFrame, SWT.BORDER);
    tableViewer.addSelectionChangedListener(this);
    tableViewer.setContentProvider(new DataflowAnomalyTableContentProvider());
    tableViewer.setLabelProvider(new DataflowAnomalyTableLabelProvider());
    isTableRefreshed = false;

    GridLayout mainLayout = new GridLayout(2, true);
    mainLayout.horizontalSpacing = mainLayout.verticalSpacing = 7;
    mainLayout.marginWidth = 3;
    mainLayout.marginHeight = 3;
    dfaFrame.setLayout(mainLayout);

    // hide the table
    showTableArea(false);
    showFirstMethod();
  }
 /** If the review is ready propertyChanged with the results will be called. */
 public void propertyChanged(Object source, int propId) {
   if (source instanceof Iterator<?> && propId == PMDRuntimeConstants.PROPERTY_REVIEW) {
     tableViewer.setInput(source);
   }
 }