コード例 #1
0
 public void run(TaskMonitor monitor, PlugInContext context) throws Exception {
   // -- get the LM because when the Histogram will be shown, the app. focus
   //   will change and context.addLayer will not work (null pointer exc.)
   // [mmichaud 2012-04-09] to completely resolve this problem, I added the
   // new JInternalFrame is added after the addLayer method has been called
   this.currentLM = context.getLayerManager();
   monitor.allowCancellationRequests();
   if (this.selAttribute == null) {
     context.getWorkbenchFrame().warnUser(I18N.get(sNoAttributeChoosen));
     return;
   }
   javax.swing.JInternalFrame internalFrame = context.getWorkbenchFrame().getActiveInternalFrame();
   FeatureDataset result = classifyAndCreatePlot(monitor, context);
   context.getWorkbenchFrame().activateFrame(internalFrame);
   if (result == null) {
     context.getWorkbenchFrame().warnUser(I18N.get(sNotEnoughValuesWarning));
   } else if (result.size() > 0) {
     String name = this.selAttribute + "_" + this.selClassifier;
     this.currentLM.addLayer(StandardCategoryNames.WORKING, name, result);
     JInternalFrame frame = new JInternalFrame(this.sHistogram);
     frame.setLayout(new BorderLayout());
     frame.add(plot, BorderLayout.CENTER);
     frame.setClosable(true);
     frame.setResizable(true);
     frame.setMaximizable(true);
     frame.setSize(450, 450);
     context.getWorkbenchFrame().addInternalFrame(frame);
     plot = null;
   } else {
     context.getWorkbenchFrame().warnUser(sWarning);
   }
 }