Package vg.modules.notepad.components.textComponent

Examples of vg.modules.notepad.components.textComponent.ITextComponent


  }
  public void goToAIF(final UIRequestGoToInAIF aif) {
    synchronized (theMutexObject) {
      for(UIEventCreateNewConnection buf : this.connections) {
        if(aif != null && buf.getConnectionId() == aif.getConnectId()) {
          ITextComponent tc = this.desktop.getComponent(buf.getFileId());
          if(tc != null) {
            tc.selectAnchor(aif.getAnchorValue());
          }
          this.desktop.selectTabAt(buf.getFileId());
          break;
        }
      }
View Full Code Here


            String[] list = innerDir.list();
            if(list != null) {
              if(list.length >= 1) {
                final File workFile = new File(innerDir.getAbsolutePath() + File.separator + list[0]);
                if(SwingUtilities.isEventDispatchThread()) {
                  ITextComponent tc = open(workFile);
                  if(tc != null) {
                    try {
                      Integer tabId = new Integer(dirs[i]);
                      this.desktop.addTab(tabId, workFile.getName(), workFile.getAbsolutePath(), tc);
                    } catch (Throwable ex) {
                     
                    }
                  }
                } else {
                  final String tmp = dirs[i];
                  SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                      ITextComponent tc = open(workFile);
                      if(tc != null) {
                        try {
                          Integer tabId = new Integer(tmp);
                          Notepad.this.desktop.addTab(tabId, workFile.getName(), workFile.getAbsolutePath(), tc);
                        } catch (Throwable ex) {
View Full Code Here

      public void actionPerformed(ActionEvent ae){
        synchronized (theMutexObject) {
          JFileChooser jfc = new JFileChooser(".");
          int returnVal = jfc.showOpenDialog(Notepad.this); //to show JFileChooser
          if(returnVal == JFileChooser.APPROVE_OPTION){
            ITextComponent tc = open(jfc.getSelectedFile());
            desktop.addTab(jfc.getSelectedFile().getName(), jfc.getSelectedFile().getAbsolutePath(), tc);
          }
        }
      }
    });
View Full Code Here

    // good
    this.setVisible(false);
  }
  private ITextComponent open(File input) {
    //to erase any text in the text area before adding new text
    ITextComponent textComponent = new TextComponent();
    StringBuffer str = new StringBuffer(1024*4);
    Reader in = null;
    try{
      //to read the selected file
      in = new FileReader(input);
      //100000 is the max. char can be written in the text area
      char[] buff = new char[100000];
      int nch;
      while((nch = in.read(buff, 0, buff.length)) != -1) {
        str.append(new String(buff, 0, nch));
      }
      textComponent.setText(str.toString());
      return(textComponent);
    } catch(Exception ex){
      VisualGraph.log.printException(ex);
    } finally {
      if(in != null) {
View Full Code Here

    }
    return(null);
  }
  private synchronized void find() {
    String whatFind = this.searchField.getText();
    ITextComponent textComponent = this.desktop.getCurrentTextComponent();
    if(textComponent != null) {
      textComponent.find(whatFind);
    }
  }
View Full Code Here

TOP

Related Classes of vg.modules.notepad.components.textComponent.ITextComponent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.