- // TODO need an interface for AlignFrame by which to access
- // its AlignViewportI and AlignmentViewPanel
- AlignmentViewPanel currentAlignFrame = Jalview.getCurrentAlignFrame().alignPanel;
- if (currentAlignFrame != null)
- {
- Method newCalcMethod = null;
- try
- {
- for (Method m : AlignmentAnnotationFactory.class.getMethods())
- {
- if (m.getName().equals("newCalculator"))
- {
- if (m.getParameterTypes().length == 3
- && m.getParameterTypes()[2].isInstance(counter))
- {
- newCalcMethod = m;
- break;
- }
- }
- }
- } catch (Exception q)
- {
- }
- if (newCalcMethod == null)
- {
-
- System.err
- .println("Couldn't find a newCalculator method for ColumnCounterI type "
- + counter.getClass().getName());
- }
- try
- {
- newCalcMethod.invoke(null, currentAlignFrame.getAlignViewport(),
- currentAlignFrame, counter);
- } catch (Exception ie)
- {
- System.err
- .println("Exception when reporting newCalculator method for ColumnCounterI type "
- + counter.getClass().getName());
- }
- }
- else
+ AlignmentViewPanel currentAlignFrame = Jalview.getInstance()
+ .getCurrentAlignFrame().alignPanel;
+ if (currentAlignFrame == null)