Ejemplo n.º 1
0
 public void actionPerformed(ActionEvent evt) {
   if (evt.getSource() == ok) dispose();
   else if (evt.getSource() == pluginMgr) {
     new org.gjt.sp.jedit.pluginmgr.PluginManager(
         JOptionPane.getFrameForComponent(ErrorListDialog.this));
   }
 }
Ejemplo n.º 2
0
    @Override
    public void actionPerformed(ActionEvent evt) {
      JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) evt.getSource();
      boolean curState = menuItem.isSelected();

      TreePath path = resultTree.getSelectionPath();
      DefaultMutableTreeNode operNode = (DefaultMutableTreeNode) path.getLastPathComponent();

      HyperSearchOperationNode operNodeObj = (HyperSearchOperationNode) operNode.getUserObject();
      if (curState) operNodeObj.cacheResultNodes(operNode);
      operNode.removeAllChildren();
      if (curState) {
        Exception excp = null;
        try {
          operNodeObj.insertTreeNodes(resultTree, operNode);
        } catch (Exception ex) {
          operNodeObj.restoreFlatNodes(resultTree, operNode);
          menuItem.setSelected(false);
          excp = ex;
        } finally {
          ((DefaultTreeModel) resultTree.getModel()).nodeStructureChanged(operNode);
          expandAllNodes(operNode);
          resultTree.scrollPathToVisible(new TreePath(operNode.getPath()));
        }
        if (excp != null) throw new RuntimeException(excp);
      } else operNodeObj.restoreFlatNodes(resultTree, operNode);

      operNodeObj.setTreeViewDisplayed(menuItem.isSelected());
    }
Ejemplo n.º 3
0
    @Override
    public void actionPerformed(ActionEvent evt) {
      Object source = evt.getSource();
      if (source == highlight) {
        String prop = jEdit.getProperty(HIGHLIGHT_PROP);
        Font f = (resultTree != null) ? resultTree.getFont() : UIManager.getFont("Tree.font");
        SyntaxStyle style =
            new StyleEditor(
                    jEdit.getActiveView(),
                    HtmlUtilities.parseHighlightStyle(prop, f),
                    "hypersearch")
                .getStyle();
        if (style != null) jEdit.setProperty(HIGHLIGHT_PROP, GUIUtilities.getStyleString(style));
        updateHighlightStatus();
      } else if (source == clear) {
        removeAllNodes();
      } else if (source == multi) {
        multiStatus = !multiStatus;
        updateMultiStatus();

        if (!multiStatus) {
          for (int i = resultTreeRoot.getChildCount() - 2; i >= 0; i--) {
            resultTreeModel.removeNodeFromParent((MutableTreeNode) resultTreeRoot.getChildAt(i));
          }
        }
      } else if (source == stop) {
        jEdit.setTemporaryProperty("hyperSearch-stopButton", "true");
      }
    }
Ejemplo n.º 4
0
    public void actionPerformed(ActionEvent evt) {
      Object source = evt.getSource();

      if (source == add) {
        ToolBarEditDialog dialog = new ToolBarEditDialog(ToolBarOptionPane.this, iconList, null);
        Button selection = dialog.getSelection();
        if (selection == null) return;

        int index = list.getSelectedIndex();
        if (index == -1) index = listModel.getSize();
        else index++;

        listModel.insertElementAt(selection, index);
        list.setSelectedIndex(index);
        list.ensureIndexIsVisible(index);
      } else if (source == remove) {
        int index = list.getSelectedIndex();
        listModel.removeElementAt(index);
        if (listModel.getSize() != 0) {
          if (listModel.getSize() == index) list.setSelectedIndex(index - 1);
          else list.setSelectedIndex(index);
        }
        updateButtons();
      } else if (source == moveUp) {
        int index = list.getSelectedIndex();
        Object selected = list.getSelectedValue();
        listModel.removeElementAt(index);
        listModel.insertElementAt(selected, index - 1);
        list.setSelectedIndex(index - 1);
        list.ensureIndexIsVisible(index - 1);
      } else if (source == moveDown) {
        int index = list.getSelectedIndex();
        Object selected = list.getSelectedValue();
        listModel.removeElementAt(index);
        listModel.insertElementAt(selected, index + 1);
        list.setSelectedIndex(index + 1);
        list.ensureIndexIsVisible(index + 1);
      } else if (source == edit) {
        ToolBarEditDialog dialog =
            new ToolBarEditDialog(
                ToolBarOptionPane.this, iconList, (Button) list.getSelectedValue());
        Button selection = dialog.getSelection();
        if (selection == null) return;

        int index = list.getSelectedIndex();

        listModel.setElementAt(selection, index);
        list.setSelectedIndex(index);
        list.ensureIndexIsVisible(index);
      }
    }
Ejemplo n.º 5
0
    public void actionPerformed(ActionEvent evt) {
      Object source = evt.getSource();
      if (source instanceof JRadioButton) updateEnabled();
      if (source == ok) ok();
      else if (source == cancel) cancel();
      else if (source == combo) updateList();
      else if (source == fileButton) {
        String directory;
        if (fileIcon == null) directory = null;
        else directory = MiscUtilities.getParentOfPath(fileIcon);
        String paths[] =
            GUIUtilities.showVFSFileDialog(null, directory, VFSBrowser.OPEN_DIALOG, false);
        if (paths == null) return;

        fileIcon = "file:" + paths[0];

        try {
          fileButton.setIcon(new ImageIcon(new URL(fileIcon)));
        } catch (MalformedURLException mf) {
          Log.log(Log.ERROR, this, mf);
        }
        fileButton.setText(MiscUtilities.getFileName(fileIcon));
      }
    }
  // {{{ actionPerformed() method
  public void actionPerformed(ActionEvent evt) {
    Object source = evt.getSource();

    if (source == ok) {
      ok();
    } else if (source == cancel) {
      cancel();
    } else if (source == clear) {
      sortTableModel.clear();
    } else if (source == help) {
      showHelp();
    }
    /*
    else if(source == delDupsCheckBox)
    {
    	if (delDupsCheckBox.isSelected())
    		dontSortCheckBox.setEnabled(true);
    	else {
    		dontSortCheckBox.setEnabled(false);
    		dontSortCheckBox.setSelected(false);
    	}
    }
    */
  } // }}}
Ejemplo n.º 7
0
 public void actionPerformed(ActionEvent evt) {
   if (evt.getSource() == ok) ok();
   else if (evt.getSource() == cancel) cancel();
 }
Ejemplo n.º 8
0
 public void actionPerformed(ActionEvent evt) {
   Object source = evt.getSource();
   if (source == done) ok();
   else if (source == mgrOptions) new GlobalOptions(PluginManager.this, "plugin-manager");
   else if (source == pluginOptions) new PluginOptions(PluginManager.this);
 }
Ejemplo n.º 9
0
 public void actionPerformed(ActionEvent evt) {
   if (evt.getSource() == close) view.removeToolBar(ActionBar.this);
   else invoke();
 }