From: <sh...@us...> - 2011-08-30 21:24:03
|
Revision: 19881 http://jedit.svn.sourceforge.net/jedit/?rev=19881&view=rev Author: shlomy Date: 2011-08-30 21:23:55 +0000 (Tue, 30 Aug 2011) Log Message: ----------- Got rid of compilation warnings. Removed lots of commented-out code, as well as javadoc templates that weren't filled in. Modified Paths: -------------- plugins/FastOpen/trunk/com/patelsoft/fastopen/AbstractIndexManager.java plugins/FastOpen/trunk/com/patelsoft/fastopen/FastOpen.java plugins/FastOpen/trunk/com/patelsoft/fastopen/FastOpenFile.java plugins/FastOpen/trunk/com/patelsoft/fastopen/FastOpenPlugin.java plugins/FastOpen/trunk/com/patelsoft/fastopen/FastOpenTextField.java plugins/FastOpen/trunk/com/patelsoft/fastopen/Files.java plugins/FastOpen/trunk/com/patelsoft/fastopen/IndexListener.java plugins/FastOpen/trunk/com/patelsoft/fastopen/IndexManager.java plugins/FastOpen/trunk/com/patelsoft/fastopen/PollingIndexManager.java plugins/FastOpen/trunk/com/patelsoft/fastopen/SimpleIndexManager.java Modified: plugins/FastOpen/trunk/com/patelsoft/fastopen/AbstractIndexManager.java =================================================================== --- plugins/FastOpen/trunk/com/patelsoft/fastopen/AbstractIndexManager.java 2011-08-30 18:55:11 UTC (rev 19880) +++ plugins/FastOpen/trunk/com/patelsoft/fastopen/AbstractIndexManager.java 2011-08-30 21:23:55 UTC (rev 19881) @@ -15,8 +15,8 @@ { Files files; View view; - Set allfiles; - List listeners; + Set<FastOpenFile> allfiles; + List<IndexListener> listeners; protected final int INDEXING_STARTED=1; protected final int INDEXING_COMPLETED=2; @@ -30,8 +30,8 @@ super(); this.view = view; this.files = files; - allfiles = new HashSet(1,1.0f); - listeners = new ArrayList(); + allfiles = new HashSet<FastOpenFile>(1,1.0f); + listeners = new ArrayList<IndexListener>(); }//End of constructor /** @@ -39,23 +39,15 @@ */ protected void queryFilesFromSource() { - //System.out.println("Inside queryFilesFromSource allfiles size " + allfiles.size()); notifyListeners(INDEXING_STARTED); - Set tmp_set = new HashSet(20,1.0f); + Set<FastOpenFile> tmp_set = new HashSet<FastOpenFile>(20,1.0f); if(allfiles != null && allfiles.size() > 0) - { tmp_set.addAll(allfiles); - } - //boolean hideOpenFiles = jEdit.getBooleanProperty("fastopen.hideOpenFiles"); - //start = System.currentTimeMillis(); files.prjFile2FOFile(view,tmp_set); - files.diffPrjFilesWithOpenBuffers(jEdit.getBuffers(),view, tmp_set); if(jEdit.getBooleanProperty("fastopen.showrecentfiles")) - { files.getRecentFiles(tmp_set); - } allfiles = tmp_set; notifyListeners(INDEXING_COMPLETED); @@ -65,36 +57,32 @@ public void addIndexListener(IndexListener listener) { if(listener != null) - { listeners.add(listener); - } } public void removeIndexListener(IndexListener listener) { if(listener != null) - { listeners.remove(listener); - } } public void notifyListeners(int activity) { if(activity == INDEXING_STARTED) { - Iterator iterListeners = listeners.iterator(); + Iterator<IndexListener> iterListeners = listeners.iterator(); while(iterListeners.hasNext()) { - IndexListener listener = (IndexListener)iterListeners.next(); + IndexListener listener = iterListeners.next(); listener.indexingStarted(this); } } else if(activity == INDEXING_COMPLETED) { - Iterator iterListeners = listeners.iterator(); + Iterator<IndexListener> iterListeners = listeners.iterator(); while(iterListeners.hasNext()) { - IndexListener listener = (IndexListener)iterListeners.next(); + IndexListener listener = iterListeners.next(); listener.indexingCompleted(this); } } Modified: plugins/FastOpen/trunk/com/patelsoft/fastopen/FastOpen.java =================================================================== --- plugins/FastOpen/trunk/com/patelsoft/fastopen/FastOpen.java 2011-08-30 18:55:11 UTC (rev 19880) +++ plugins/FastOpen/trunk/com/patelsoft/fastopen/FastOpen.java 2011-08-30 21:23:55 UTC (rev 19881) @@ -49,7 +49,6 @@ import org.gjt.sp.jedit.Buffer; import org.gjt.sp.jedit.GUIUtilities; -import org.gjt.sp.jedit.MiscUtilities; import org.gjt.sp.jedit.TextUtilities; import org.gjt.sp.jedit.View; import org.gjt.sp.jedit.jEdit; @@ -62,6 +61,7 @@ import projectviewer.vpt.VPTProject; +@SuppressWarnings("serial") public class FastOpen extends JPanel implements ActionListener, IndexListener, DefaultFocusComponent { @@ -79,7 +79,7 @@ private JDialog mainWindow = null; private JComboBox projectCombo; private ProjectSwitchListener vListener; - private final Comparator comparator = new FastOpenComparator(); + private final Comparator<Object> comparator = new FastOpenComparator(); public static Color openFilesForeground = jEdit.getColorProperty( "fastopen.openFiles.foregroundcolor", Color.black); @@ -90,7 +90,6 @@ private IndexManager indexManager; - // Set allfiles = new HashSet(1); //Just to avoid NPE private final String noWordSep; private final Files files = new Files(); @@ -103,14 +102,11 @@ private javax.swing.Timer timer; /** - * Constructor for the FastOpen object - * - * @param view - * Description of the Parameter + * FastOpen constructor + * @param view The parent view */ public FastOpen(View view) { - //System.out.println("Creating NEW Instance of FO"); super(); this.view = view; noWordSep = view.getBuffer().getProperty("noWordSep") + ".:-" + File.separator; @@ -128,7 +124,7 @@ String txtSelection = getFileAtCaret(); int lineNumber = -1; try { - List vecContent = parseFileLnoPattern(txtSelection); + List<Object> vecContent = parseFileLnoPattern(txtSelection); lineNumber = ((Integer) vecContent.get(1)).intValue(); } catch (NullPointerException npe) @@ -138,8 +134,8 @@ if (txtSelection != null) { - if (txtSelection.indexOf("\n") == -1) /* Only - run the Algo if the input filename does not contain newline characters. */ + // Only run the Algo if the input filename does not contain newline characters. + if (txtSelection.indexOf("\n") == -1) { FastOpenFile matchingfiles[] = retrieveMatchingFiles(txtSelection); @@ -147,72 +143,54 @@ { /* Only one matching file so don't show the mainWindow */ openFile((FastOpenFile) matchingfiles[0]); - if (lineNumber != -1) - { gotoLine(lineNumber); - } closeMainWindow(); return; } - txtfilename.setText((txtSelection == null ? null - : txtSelection.trim())); + txtfilename.setText((txtSelection == null ? null : txtSelection.trim())); } else { view.getStatus().setMessageAndClear( - "FastOpen ignored long text exceeding 50 characters as useful search criteria."); + "FastOpen ignored long text exceeding 50 characters as useful search criteria."); txtfilename.setText(""); } } } - /* else { - HistoryModel model = txtfilename.getModel(); - String lastEntry = model.get(0).toString(); - txtfilename.setText(lastEntry); - } */ if (files.isPVThere()) - { loadProjectsInCombo(); - } txtfilename.selectAll(); txtfilename.requestFocus(); - if (mainWindow != null) mainWindow.setVisible(true); + if (mainWindow != null) + mainWindow.setVisible(true); } /** Closes the FastOpen window */ public void closeMainWindow() { - if (mainWindow != null) { + if (mainWindow != null) GUIUtilities.saveGeometry(mainWindow, "fastopen.window"); - } SwingUtilities.invokeLater(new Runnable() { public void run() { - DockableWindowManager dwm = jEdit.getActiveView() - .getDockableWindowManager(); + DockableWindowManager dwm = jEdit.getActiveView().getDockableWindowManager(); dwm.hideDockableWindow("fastopen"); } }); if (mainWindow != null) - { mainWindow.dispose(); - //mainWindow = null; - } - } - /** Description of the Method */ + /** Initialize the UI components */ private void setupFastOpen() { setLayout(new BorderLayout()); - // txtfilename = new FastOpenTextField(20); txtfilename = new FastOpenTextField("fastopen.patterns", false, true); - // this.setNextFocusableComponent(txtfilename); txtfilename.addActionListener(this); txtfilename.getDocument().addDocumentListener(new DocumentListener() { @@ -223,9 +201,7 @@ public void run() { if (timer == null) - { startDelayTimer(); - } } }); } @@ -237,9 +213,7 @@ public void run() { if (timer == null) - { startDelayTimer(); - } } }); } @@ -248,12 +222,11 @@ { try { - if (e.getDocument().getText(0, e.getDocument().getLength()) - .trim().length() == 0) + if (e.getDocument().getText(0, + e.getDocument().getLength()).trim().length() == 0) { jlist.setListData(new String[0]); } - else { SwingUtilities.invokeLater(new Runnable() @@ -261,14 +234,11 @@ public void run() { if (timer == null) - { startDelayTimer(); - } } }); } } - catch (BadLocationException badle) { } @@ -280,8 +250,6 @@ "fastopen.search.delay", 2) * 1000), new DelaySearchAction()); timer.setRepeats(false); timer.start(); - // System.out.println("Timer started with delay - // " + timer.getDelay()); } } @@ -303,10 +271,10 @@ } }; - // Below steps are used to receive notifications of the - // KeyStrokes we are interested in unlike - // ActionListener/KeyListener - // which is fired irrespective of the kind of KeyStroke. + /* Below steps are used to receive notifications of the KeyStrokes we are + * interested in unlike ActionListener/KeyListener which is fired irrespective + * of the kind of KeyStroke. + */ InputMap inputMap = txtfilename.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); KeyStroke up_arrow = KeyStroke.getKeyStroke("UP"); @@ -337,15 +305,12 @@ isSelected, cellHasFocus); projectviewer.vpt.VPTProject project = (projectviewer.vpt.VPTProject) value; if (project != null) - { setText(project.getName()); - } return this; } }); projectCombo.addItemListener(vListener); - loadProjectsInCombo();// For dockables which does not - // call showWindow. + loadProjectsInCombo();// For dockables which does not call showWindow. pnlNorth.add(projectCombo, BorderLayout.EAST); } @@ -362,10 +327,7 @@ addKeyListener(keyHandler); txtfilename.addKeyListener(keyHandler); if(projectCombo != null) - { projectCombo.addKeyListener(keyHandler); - } - }// End of setupFastOpen /** @@ -413,7 +375,6 @@ return mainWindow; } - /** Description of the Method */ void moveListDown() { int selectedIndex = jlist.getSelectedIndex(); @@ -427,7 +388,6 @@ } } - /** Description of the Method */ void moveListUp() { int selectedIndex = jlist.getSelectedIndex(); @@ -456,15 +416,8 @@ indexManager.stop(); indexManager = null; } - // pv = null; } - /** - * Description of the Method - * - * @param evt - * Description of the Parameter - */ public void actionPerformed(ActionEvent evt) { // For enter keys pressed inside txtfilename @@ -474,18 +427,14 @@ if (selectedIndex != -1 && listSize != 0 && selectedIndex < listSize) { - List vec = parseFileLnoPattern(getFilePattern()); - + List<Object> vec = parseFileLnoPattern(getFilePattern()); if (vec != null) { - // openFile(jlist.getSelectedIndex(),((Integer)vec.get(1)).intValue()); - openFile((FastOpenFile) jlist.getSelectedValue(), ((Integer) vec - .get(1)).intValue()); + openFile((FastOpenFile) jlist.getSelectedValue(), + ((Integer) vec.get(1)).intValue()); } else { - // openFile(new - // int[]{jlist.getSelectedIndex()}); openFile((FastOpenFile) jlist.getSelectedValue()); } @@ -493,18 +442,13 @@ } } - /** Description of the Method */ void findfile() { - // System.out.println("Inside findfile initialIndexingInProgress - // " + initialIndexingInProgress); if (!initialIndexingInProgress) { String txtToFind = getFilePattern(); if (txtToFind != null && txtToFind.trim().length() > 0) { - // Log.log(Log.DEBUG, this.getClass(), "Trying - // to retrieveFiles with text " + txtToFind); FastOpenFile foundfileslist[] = retrieveMatchingFiles(txtToFind); if (foundfileslist != null && foundfileslist.length > 0) { @@ -513,23 +457,11 @@ txtfilename.setForeground(jEdit.getColorProperty( "view.fgColor", Color.black)); } - - /* - * if(_foundfileslist != null) { - * _foundfileslist.clear(); } - * _foundfileslist = foundfileslist; - * foundfileslist = null; - */ - - // jlist.setListData(extractPathFromPrjDir(_foundfileslist)); jlist.setListData(foundfileslist); - jlist.setSelectedIndex(0); } else { - // Log.log(Log.NOTICE, FastOpen.class, - // "No matching file found."); jlist.setListData(new String[0]); txtfilename.setForeground(Color.red); } @@ -538,19 +470,12 @@ } } - /** - * Description of the Method - * - * @param event - * Description of the Parameter - */ void onefileselection(AWTEvent event) { - // openFile(((JList)event.getSource()).getSelectedIndices()); - Object selectedFiles[] = ((JList) event.getSource()).getSelectedValues(); - // Since getSelectedValues return type is Object[], it cannot be - // directly casted to FastOpenFile[] and thus the below loop. + /* Since getSelectedValues return type is Object[], it cannot be + * directly casted to FastOpenFile[] and thus the below loop. + */ for (int i = 0; i < selectedFiles.length; i++) { try @@ -559,51 +484,18 @@ } catch (NullPointerException e) { - // Sometimes (during testing) jEdit was throwing - // a NPE as below. due to which only some files - // could be opened in Multi select mode. and - // thus this catch to prevent an exception - // halting opening remaining files. - // [error] AWT-EventQueue-0: - // java.lang.NullPointerException - // [error] AWT-EventQueue-0: at - // org.gjt.sp.jedit.Buffer.markTokens(Buffer.java:2109) - // [error] AWT-EventQueue-0: at - // org.gjt.sp.jedit.textarea.ChunkCache.lineToChunkList(ChunkCache.java:772) + /* Sometimes (during testing) jEdit was throwing a NPE as below. due to + * which only some files could be opened in Multi select mode. and thus + * this catch to prevent an exception halting opening remaining files. + * [error] AWT-EventQueue-0: java.lang.NullPointerException + * [error] AWT-EventQueue-0: at org.gjt.sp.jedit.Buffer.markTokens(Buffer.java:2109) + * [error] AWT-EventQueue-0: at org.gjt.sp.jedit.textarea.ChunkCache.lineToChunkList(ChunkCache.java:772) + */ } }// End of for } - /** - * Description of the Method - * - * @param matchingfiles List of files to open - * - */ - /* - * private void openFile(int matchingfileindex[]) { if(matchingfileindex != - * null && matchingfileindex.length >0) { for(int i=0;i<matchingfileindex.length;i++) { - * openFile((FastOpenFile)_foundfileslist.get(matchingfileindex[i])); } } } - */ - - private void openFile(FastOpenFile matchingfiles[]) - { - if (matchingfiles != null && matchingfiles.length > 0) - { - for (int i = 0; i < matchingfiles.length; i++) - { - openFile(matchingfiles[i]); - } - } - } - - /* - * private Buffer openFile(int matchingfileindex, int lineNo) { Buffer - * buf =openFile((FastOpenFile)_foundfileslist.get(matchingfileindex)); - * gotoLine(lineNo); return buf; } - */ - private Buffer openFile(FastOpenFile matchingfile, int lineNo) { Buffer buf = openFile(matchingfile); @@ -617,12 +509,10 @@ { Document d = txtfilename.getDocument(); return d.getText(0,d.getLength()); - } catch (BadLocationException e) { - Log.log(Log.DEBUG, this.getClass(), - "Caught BadLocationException. Returning."); + Log.log(Log.DEBUG, this.getClass(), "Caught BadLocationException. Returning."); } catch (Exception e) { @@ -633,145 +523,63 @@ private void gotoLine(final int lineNo) { - //VFSManager.runInAWTThread(new Runnable() VFSManager.runInWorkThread(new Runnable() { public void run() { JEditTextArea txtArea = view.getTextArea(); - if (lineNo <= txtArea.getLineCount()) - { - txtArea.setCaretPosition(txtArea - .getLineStartOffset(lineNo - 1)); - } - + txtArea.setCaretPosition(txtArea.getLineStartOffset(lineNo - 1)); else - { - Log.log(Log.DEBUG, this.getClass(), "Ignoring linecounbt " - + lineNo); - } + Log.log(Log.DEBUG, this.getClass(), "Ignoring linecount " + lineNo); } - } - - ); + }); } - /** - * Description of the Method - * - * @param pf - * Description of the Parameter - * @return Description of the Return Value - */ public Buffer openFile(FastOpenFile pf) { return pf.open(this.view); } /** - * Description of the Method - * - * @param foundfileslist - * Description of the Parameter - * @return Description of the Return Value - */ - /*private String[] extractPathFromPrjDir(List foundfileslist) - { - String paths[] = new String[foundfileslist.size()]; - - Iterator iter = foundfileslist.iterator(); - for (int i = 0; iter.hasNext(); i++) - { - FastOpenFile pf = (FastOpenFile) iter.next(); - paths[i] = pf.getDecoratedPath(); - } - - return paths; - }*/ - - /** - * @deprecated Moved to FastOpenFile class. This was done to avoid - * multiple path (String object) creation for efficiency - * reasons. Gets the decoratedPath attribute of the FastOpen - * object - * - * @param pf - * Description of the Parameter - * @return The decoratedPath value - */ - /* - * public String getDecoratedPath(FastOpenFile pf) { if(pf == null) { - * return null; } - * - * return pf.getName() + " (" + pf.getPath() + ")"; } - */ - - /** * Gets the fileAtCaret attribute of the FastOpen object - * * @return The fileAtCaret value */ private String getFileAtCaret() { JEditTextArea textArea = view.getTextArea(); - if (textArea.getSelectionCount() > 0) - { return textArea.getSelectedText(textArea.getSelection()[0]); - } int line = textArea.getCaretLine(); int lineLength = textArea.getLineLength(line); - if (lineLength == 0) - { return null; - } - String lineText = textArea.getLineText(line); int lineStart = textArea.getLineStartOffset(line); int offset = textArea.getCaretPosition() - lineStart; - if (offset == lineLength) - { - // --offset; return null; - } - int wordStart = TextUtilities.findWordStart(lineText, offset, noWordSep); int wordEnd = TextUtilities.findWordEnd(lineText, offset + 1, noWordSep); String filename = textArea.getText(lineStart + wordStart, wordEnd - wordStart); - /* - * Get rid of any path info, since we index by filename and not - * by pathname - */ + // Get rid of any path info, since we index by filename and not by pathname int idx = filename.lastIndexOf('/'); if (idx > -1) - { filename = filename.substring(idx + 1); - } idx = filename.lastIndexOf("\\"); if (idx > -1) - { filename = filename.substring(idx + 1); - } return filename; } - /** - * Description of the Method - * - * @param txtSelection - * Description of the Parameter - */ - List parseFileLnoPattern(String txtSelection) + List<Object> parseFileLnoPattern(String txtSelection) { Matcher matcher = reLineNo.matcher(txtSelection); if ((txtSelection != null && txtSelection.trim().length() != 0) && matcher.matches()) { - List vecReturn = new ArrayList(2); + List<Object> vecReturn = new ArrayList<Object>(2); vecReturn.add(0, matcher.group(1)); vecReturn.add(1, Integer.valueOf(matcher.group(2))); return vecReturn; @@ -780,7 +588,6 @@ return null; } - /** Description of the Method */ private void loadProjectsInCombo() { vListener.pause(); @@ -792,7 +599,6 @@ projectCombo.removeAllItems(); } -// int currProjectIdx = 0; projectviewer.vpt.VPTProject currPrj = files.getCurrentProject(view); List<VPTProject> readOnlyProjects = projectviewer.ProjectManager.getInstance().getProjects(); @@ -808,222 +614,70 @@ vListener.resume(); } - /** - * Description of the Method - * - * @param fileToFind - * Description of the Parameter - * @return Description of the Return Value - */ - /* - * public List retrieveMatchingFiles(String fileToFind, View view) { - * //Log.log(Log.DEBUG,this.getClass(),"Got fileToFind "+ fileToFind); - * if(fileToFind != null) { List foundfileslist = new ArrayList(); - * //System.out.println( "Trying to match inside retrieveMatchingFiles " + - * fileToFind); Set allfiles = new TreeSet(comparator); - * - * //// long start = System.currentTimeMillis(); Collection dataFiles = - * files.prjFile2FOFile(view); if(dataFiles != null) { - * allfiles.addAll(dataFiles); } - * // long end = System.currentTimeMillis(); System.out.println("Time - * taken to get projects and add " + (end-start) + " ms"); - * // start = System.currentTimeMillis(); dataFiles - * =files.diffPrjFilesWithOpenBuffers(jEdit.getBuffers(),view); - * if(dataFiles != null) { allfiles.addAll(dataFiles); } // end = - * System.currentTimeMillis(); System.out.println("Time taken to diff - * projectfile with open buffers and add " + (end-start) + " ms"); - * - * // start = System.currentTimeMillis(); - * if(jEdit.getBooleanProperty("fastopen.showrecentfiles")) { dataFiles - * =getRecentFiles(); if(dataFiles != null) { - * allfiles.addAll(dataFiles); } } // end = System.currentTimeMillis(); - * System.out.println("Time taken to get recentfiles and add " + - * (end-start) + " ms"); - * - * - * System.out.println("Total files collected " + allfiles.size()); - * //Iterator iterPrjFiles = project.getFiles().iterator(); Iterator - * iterPrjFiles = allfiles.iterator(); - * - * List vecPattern = parseFileLnoPattern(fileToFind); if(vecPattern != - * null) { fileToFind = (String)vecPattern.get(0); } try { RE re = null; - * if(jEdit.getBooleanProperty("fastopen.ignorecase")) { re = new - * RE(MiscUtilities.globToRE("^" + fileToFind), RE.REG_ICASE); } else { - * re = new RE(MiscUtilities.globToRE("^" + fileToFind)); } - * - * while(iterPrjFiles.hasNext()) { FastOpenFile file = - * (FastOpenFile)iterPrjFiles.next(); - * if(jEdit.getBooleanProperty("fastopen.hideOpenFiles")) { - * if(file.isOpened()) { continue; } } - * - * if(re.getMatch(file.getName()) != null) { foundfileslist.add(file); } } - * //End of while iterPrjFiles = null; - * - * //if(jEdit.getBooleanProperty("fastopen.sortFiles")) //{ // - * Collections.sort(foundfileslist, comparator); //} } catch(REException - * e) { txtfilename.setForeground(Color.red); return foundfileslist; } - * - * return foundfileslist; } else { return new ArrayList(0); } } - */ - public FastOpenFile[] retrieveMatchingFiles(String fileToFind) { - // We try to collect files just once and hold on to them until - // the user closes FO. This reduces Object creation and - // hopefully increases performance. - - // Log.log(Log.DEBUG,this.getClass(),"Got fileToFind "+ - // fileToFind); - // long start,end; + /* We try to collect files just once and hold on to them until the user closes FO. + * This reduces Object creation and hopefully increases performance. + */ if (fileToFind != null) { - // if(allfiles == null || allfiles.size() == 0) - // { - /* - * long start = System.currentTimeMillis(); //start = - * System.currentTimeMillis(); - * files.prjFile2FOFile(view,allfiles); - * - * //end = System.currentTimeMillis(); - * //System.out.println("Time taken to get projects and - * add " + (end-start) + " ms but before adding to - * addFiles"); - * - * //long end2 = System.currentTimeMillis(); - * //System.out.println("Time taken to get projects and - * add " + (end2-end) + " ms total time is " + - * (end2-start)); - * - * //start = System.currentTimeMillis(); - * files.diffPrjFilesWithOpenBuffers(jEdit.getBuffers(),view, - * allfiles); - * - * //end = System.currentTimeMillis(); - * //System.out.println("Time taken to diff projectfile - * with open buffers and add " + (end-start) + " ms"); - * - * //start = System.currentTimeMillis(); - * - * if(jEdit.getBooleanProperty("fastopen.showrecentfiles")) { - * getRecentFiles(allfiles); } - * - * long end = System.currentTimeMillis(); - * System.out.println("Time taken to get allfiles and - * add " + (end-start) + " ms"); - * System.out.println("Total files collected " + - * allfiles.size()); - */ - - /* - * } else { System.out.println("Reusing allfiles " + - * allfiles); } - */ - // System.out.println("Completed allfiles for filetoFind - // " + fileToFind + " " + allfiles); - // long startTime = System.currentTimeMillis(); - Set allfiles = indexManager.getCollectedFiles(); - // long endTime = System.currentTimeMillis(); - // System.out.println("IndexManager.getCollectedFiles - // took time " + (endTime - startTime)/1000 +" sec"); + Set<FastOpenFile> allfiles = indexManager.getCollectedFiles(); if (allfiles == null || allfiles.size() == 0) /* IndexManager still loading. */ - { return null; - } - // startTime = System.currentTimeMillis(); - List vecPattern = parseFileLnoPattern(fileToFind); - // endTime = System.currentTimeMillis(); - - // System.out.println("parsing Line no pattern took time - // " + (endTime - startTime)/1000 +" sec"); + List<Object> vecPattern = parseFileLnoPattern(fileToFind); if (vecPattern != null) - { fileToFind = (String) vecPattern.get(0); - } - // long start = System.currentTimeMillis(); - List foundfileslist = new ArrayList(allfiles.size()); + List<FastOpenFile> foundfileslist = new ArrayList<FastOpenFile>(allfiles.size()); - /* Initializating Collections is a Performance Optimization - since the need for expansion is done away with. Setting - foundfileslist's size to max allfiles.size() since thats - the max it can go(in case of say regexp '*') anyways. - unused elements are as it is NULLs. */ + /* Initializing Collections is a Performance Optimization since the need for + * expansion is done away with. Setting foundfileslist's size to max + * allfiles.size() since thats the max it can go (in case of say regexp '*') + * anyways. unused elements are as it is NULLs. */ + Pattern re = null; + try + { + if (jEdit.getBooleanProperty("fastopen.ignorecase")) + re = Pattern.compile(StandardUtilities.globToRE("^" + fileToFind),Pattern.CASE_INSENSITIVE); + else + re = Pattern.compile(StandardUtilities.globToRE("^" + fileToFind)); + } + catch(java.util.regex.PatternSyntaxException e) + { + txtfilename.setForeground(Color.red); + return null; + } - Pattern re = null; + final boolean hideOpenFiles = jEdit.getBooleanProperty("fastopen.hideOpenFiles"); - try - { - if (jEdit.getBooleanProperty("fastopen.ignorecase")) - { - re = Pattern.compile(StandardUtilities.globToRE("^" + fileToFind),Pattern.CASE_INSENSITIVE); - } - else - { - re = Pattern.compile(StandardUtilities.globToRE("^" + fileToFind)); - } - } - catch(java.util.regex.PatternSyntaxException e) - { - txtfilename.setForeground(Color.red); - return null; - } + /* Moved outside the while loop to improve performance instead of repeated + * searching in jEdit's hash properties when it is not going to change between + * calls. + */ + Iterator<FastOpenFile> iterPrjFiles = allfiles.iterator(); - // start = System.currentTimeMillis(); + /* Since we check for hideOpenFiles option, there is a possibility of Array + * fragmentation because it would be incremented but nothing would be stored + * at that position since the file under iteration is already open, so we + * increment i manually when applicable + */ + while (iterPrjFiles.hasNext()) + { + FastOpenFile file = (FastOpenFile) iterPrjFiles.next(); + if (hideOpenFiles && file.isOpened()) + continue; + if (re.matcher(file.getName()).find()) + foundfileslist.add(file); + }// End of while - final boolean hideOpenFiles = jEdit - .getBooleanProperty("fastopen.hideOpenFiles"); + iterPrjFiles = null; + allfiles = null; - /* Moved outside the while loop to improve performance instead - of repeated seaching in jEdit's hash properties when it is not - going to change between calls. */ - Iterator iterPrjFiles = allfiles.iterator(); - - /* Since we check for hideOpenFiles option, there is a possibility - of Array fragmentation because it would be incremented - but nothing would be stored at that position since the file under - iteration is already open, so we increment i manually when applicable */ - while (iterPrjFiles.hasNext()) - { - FastOpenFile file = (FastOpenFile) iterPrjFiles.next(); - if (hideOpenFiles && file.isOpened()) - { - continue; - } - - if (re.matcher(file.getName()).find()) - { - // System.out.println("Duplicate - // file exists for file "+ file - // + " "+ - // (foundfileslist.contains(file))); - foundfileslist.add(file); - } - }// End of while - - // System.out.println("Final foundfileslist "+ - // foundfileslist); - // end = System.currentTimeMillis(); - - // System.out.println("Time taken to collect - // matching files " + (end-start) + " ms"); - - iterPrjFiles = null; - allfiles = null; - - if (jEdit.getBooleanProperty("fastopen.sortFiles")) - { - // start = System.currentTimeMillis(); - Collections.sort(foundfileslist, comparator); - // long end = - // System.currentTimeMillis(); - // System.out.println("Time taken to - // find and sort " + (end-start) + " ms - // found files " + - // foundfileslist.size()); - } - return (FastOpenFile[]) foundfileslist - .toArray(new FastOpenFile[foundfileslist.size()]); + if (jEdit.getBooleanProperty("fastopen.sortFiles")) + Collections.sort(foundfileslist, comparator); + return (FastOpenFile[]) foundfileslist.toArray( + new FastOpenFile[foundfileslist.size()]); } return new FastOpenFile[0]; } @@ -1034,7 +688,6 @@ private IndexManager getIndexManager() { String indexManagerType = jEdit.getProperty("fastopen.indexing.strategy"); - //System.out.println("See indexmanager strategy " + indexManagerType); if ("polling".equals(indexManagerType)) { IndexManager idxMgr = new PollingIndexManager(view, files); @@ -1047,121 +700,58 @@ idxMgr.addIndexListener(this); return idxMgr; } - else - { - return null; - } + return null; } public void indexingStarted(IndexManager manager) { - // System.out.println("Inside indexingStarted"); - if (indexingStatus == 0) // This is the first time - // Indexing is underway. - { + if (indexingStatus == 0) // This is the first time Indexing is underway. initialIndexingInProgress = true; - } indexingStatus = 1; - // System.out.println("Leaving indexingStarted"); } public void indexingCompleted(IndexManager manager) { - // System.out.println("Inside indexingCompleted"); if (initialIndexingInProgress) { initialIndexingInProgress = false; - findfile(); // Try to search for file which the user - // typed in the name for. + findfile(); // Try to search for file which the user typed in the name for. } indexingStatus = 2; - // System.out.println("Leaving indexingCompleted"); } // Inner Classes start - /** - * Description of the Class - * - * @author jiger - * @created February 24, 2003 - */ class ListHandler extends KeyAdapter implements MouseListener { - /** - * Description of the Method - * - * @param event - * Description of the Parameter - */ public void keyPressed(KeyEvent event) { if (event.getKeyCode() == KeyEvent.VK_ENTER) - { handleListEvents(event); - } } - /** - * Description of the Method - * - * @param e - * Description of the Parameter - */ public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) - { handleListEvents(e); - } } - /** - * Description of the Method - * - * @param e - * Description of the Parameter - */ public void mouseEntered(MouseEvent e) { } - /** - * Description of the Method - * - * @param e - * Description of the Parameter - */ public void mouseExited(MouseEvent e) { } - /** - * Description of the Method - * - * @param e - * Description of the Parameter - */ public void mousePressed(MouseEvent e) { } - /** - * Description of the Method - * - * @param e - * Description of the Parameter - */ public void mouseReleased(MouseEvent e) { } - /** - * Description of the Method - * - * @param event - * Description of the Parameter - */ private void handleListEvents(AWTEvent event) { txtfilename.grabFocus(); @@ -1171,35 +761,20 @@ } }// End of class ListHandler - /** - * Description of the Class - * - * @author jiger - * @created February 24, 2003 - */ - class ProjectSwitchListener implements ItemListener { private boolean paused; - /** Description of the Method */ public void pause() { paused = true; } - /** Description of the Method */ public void resume() { paused = false; } - /** - * Description of the Method - * - * @param evt - * Description of the Parameter - */ public void itemStateChanged(ItemEvent evt) { if (!paused && evt.getStateChange() == ItemEvent.SELECTED) @@ -1207,42 +782,12 @@ projectviewer.vpt.VPTProject newProject = (projectviewer.vpt.VPTProject) evt .getItem(); projectviewer.ProjectViewer.setActiveNode(view, newProject); - // projectviewer.config.ProjectViewerConfig.getInstance().setLastNode(newProject); - // Set PV(if there is one) to the new Project. - // projectviewer.ProjectViewer pv = - // projectviewer.ProjectViewer.getViewer(view); - - // if(pv != null) - // { - // System.out.println("PV present when switching - // project. Setting to OV Object!! " + - // newProject); - // pv.setProject(projectviewer.ProjectManager.getInstance().getProject(newProject)); - // pv.setProject(newProject); - // pv.setActiveNode(view,newProject); if (mainWindow != null) mainWindow.toFront(); - /* when PV is updating itself, FO loses focus. Hopefully this - call should work in some jdk/platforms if implemented properly - by the platform's jdk. */ - // } - // else - // { - // System.out.println("PV is NULL!!! when - // setting " + newProject); - // } - - /* - * if(_foundfileslist != null) { - * _foundfileslist.clear(); } + /* when PV is updating itself, FO loses focus. Hopefully this call should + * work in some jdk/platforms if implemented properly by the platform's jdk. */ - jlist.setListData(new String[0]); - // allfiles=null; //Very important. Not having - // this, means that retrieveMatchingFiles will - // not search the newly selected Project at - // all!! - // updateTitle(); Log.log(Log.DEBUG, this, "Suggesting reindex"); indexManager.suggestReindex(); @@ -1250,7 +795,6 @@ txtfilename.selectAll(); } } - }// End of ProjectSwitchListener /** @@ -1261,20 +805,16 @@ * @created February 24, 2003 */ - class FastOpenComparator implements Comparator + class FastOpenComparator implements Comparator<Object> { - private final Comparator collator = java.text.Collator.getInstance(); + private final Comparator<Object> collator = java.text.Collator.getInstance(); /** * Compares 2 files for sorting purpose. - * - * @param obj1 - * FastOpenFile 1 - * @param obj2 - * FastOpenFile 1 - * @return a negative integer, zero, or a positive integer as - * the first argument is less than, equal to, or greater - * than the second. + * @param obj1 FastOpenFile 1 + * @param obj2 FastOpenFile 1 + * @return a negative integer, zero, or a positive integer as the first argument is + * less than, equal to, or greater than the second. */ public int compare(Object obj1, Object obj2) { @@ -1288,42 +828,24 @@ && fileOrder.equals(FastOpenPlugin.OPEN_FILES_FIRST)) { if (pf1.isOpened() && !pf2.isOpened()) - { return -1; - } else if (!pf1.isOpened() && pf2.isOpened()) - { return 1; - } - else if (!pf1.isOpened() && !pf2.isOpened()) /* Incase - of closed files, Project files should take precedence. */ + else if (!pf1.isOpened() && !pf2.isOpened()) + // In case of closed files, Project files should take precedence { - // Then check for which one is - // Project file. + // Then check for which one is Project file. if (pf1.isProjectFile() && !pf2.isProjectFile()) - { return -1; - } - else if (!pf1.isProjectFile() - && pf2.isProjectFile()) - { + else if (!pf1.isProjectFile() && pf2.isProjectFile()) return 1; - } - else - // Let the default comparator - // take care. - { - return collator.compare( - pf1.getDecoratedPath().toLowerCase(), - pf2.getDecoratedPath().toLowerCase()); - /* Paths are converted to lowercase for comparision - to simulate case-insensivitivity becoz not doing - so would lead to showing the same file twice if the - path contains mixed case letters. For e.g jEdit Recent - files would store path as C:/dir/path_to_file.txt and - Projectviewer would as c:\dir/path_to_file.txt (notice - the c drive case). */ - } + return collator.compare(pf1.getDecoratedPath().toLowerCase(), + pf2.getDecoratedPath().toLowerCase()); + /* Paths are converted to lowercase to avoid showing the same + * file twice - e.g jEdit Recent files would store path as + * C:/dir/path_to_file.txt, while Projectviewer would as + * c:\dir/path_to_file.txt (notice the c drive case). + */ } else { @@ -1336,28 +858,18 @@ && fileOrder.equals(FastOpenPlugin.OPEN_FILES_LAST)) { if (pf1.isOpened() && !pf2.isOpened()) - { return 1; - } else if (!pf1.isOpened() && pf2.isOpened()) - { return -1; - } - else if (!pf1.isOpened() && !pf2.isOpened()) /* In case - of closed files, Project files should take precedence. */ + else if (!pf1.isOpened() && !pf2.isOpened()) + // In case of closed files, Project files should take precedence { // Then check for which one is Project file. if (pf1.isProjectFile() && !pf2.isProjectFile()) - { return 1; - } - else if (!pf1.isProjectFile() - && pf2.isProjectFile()) - { + else if (!pf1.isProjectFile() && pf2.isProjectFile()) return -1; - } - else - // Let the default comparator take care. + else // Let the default comparator take care { return collator.compare( pf1.getDecoratedPath().toLowerCase(), @@ -1380,7 +892,6 @@ } return collator.compare(obj1, obj2); } - }// End of class FastOpenComparator /** @@ -1392,49 +903,27 @@ class FastOpenRenderer extends DefaultListCellRenderer { - /** - * Gets the listCellRendererComponent attribute of the - * FastOpenRenderer object - * - * @param list - * Description of the Parameter - * @param value - * Description of the Parameter - * @param index - * Description of the Parameter - * @param isSelected - * Description of the Parameter - * @param cellHasFocus - * Description of the Parameter - * @return The listCellRendererComponent value - */ public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - super.getListCellRendererComponent(list, value, index, isSelected, - cellHasFocus); - FastOpenFile file = (FastOpenFile) value; // (FastOpenFile)_foundfileslist.get(index); + super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + FastOpenFile file = (FastOpenFile) value; setText(file.getDecoratedPath()); if (file.isOpened()) { if (file.isProjectFile()) - { setForeground(FastOpen.openFilesForeground); - } - else - {// Open, Non-Project file + else // Open, Non-Project file setForeground(FastOpen.nonprjopenFilesForeground); - } } return this; } - }// End of class FastOpenRenderer /** * This class is used for sorting the project combo box. */ - public static class Sorter implements Comparator + public static class Sorter implements Comparator<Object> { public int compare(Object element1, Object element2) { @@ -1465,7 +954,6 @@ public void focusGained(FocusEvent e) { focusOnDefaultComponent(); - } public void focusLost(FocusEvent e) @@ -1499,7 +987,6 @@ mF.mainWindow = null; } add(mF, BorderLayout.CENTER); - } public void focusOnDefaultComponent() { Modified: plugins/FastOpen/trunk/com/patelsoft/fastopen/FastOpenFile.java =================================================================== --- plugins/FastOpen/trunk/com/patelsoft/fastopen/FastOpenFile.java 2011-08-30 18:55:11 UTC (rev 19880) +++ plugins/FastOpen/trunk/com/patelsoft/fastopen/FastOpenFile.java 2011-08-30 21:23:55 UTC (rev 19881) @@ -24,7 +24,6 @@ private final int hashcode; //Store hashcode of the file since the filename and path are final and cannot be changed so why calculate everytime in hashCode(). private final String decoratedPath; - public FastOpenFile(Buffer buffer) { name = buffer.getName(); @@ -54,7 +53,6 @@ public FastOpenFile(BufferHistory.Entry entry) { - //,,false,false)); this.name = MiscUtilities.getFileName(entry.path); this.path = entry.path; this.projectFile = false; @@ -65,9 +63,7 @@ private int calculateHashCode() { if(OperatingSystem.isWindows()) - { return (this.path.toLowerCase() + this.name).hashCode(); - } return (this.path + this.name).hashCode(); } @@ -98,62 +94,16 @@ public boolean equals(Object fofile) { - if(fofile != null && fofile instanceof FastOpenFile) - { + if(fofile != null && fofile instanceof FastOpenFile) + { FastOpenFile f = (FastOpenFile)fofile; if(OperatingSystem.isWindows()) - { - //System.out.println("In equals OperatingSystem.isWindows() " + OperatingSystem.isWindows() +" file " + f.getName() +" f is Project file " + f.isProjectFile() +" this is prj. file " + projectFile); - /*if(f.getName().indexOf("EngineBean") != -1) - { - // System.out.println("See ACEngineBean details " + f.getName() + " " + ((getPath().equalsIgnoreCase(f.getPath()) && getName().equalsIgnoreCase(f.getName())))); - }*/ return (getPath().equalsIgnoreCase(f.getPath()) && getName().equalsIgnoreCase(f.getName())); - } return (getPath().equals(f.getPath()) && getName().equals(f.getName())); } return super.equals(fofile); } - /*public boolean equals(projectviewer.vpt.VPTFile file) //Overloaded for convinient in Index Mgmt. - { - if(file != null) - { - if(OperatingSystem.isWindows()) - { - return (getPath().equalsIgnoreCase(file.getNodePath()) && getName().equalsIgnoreCase(file.getName()) && projectFile); - } - return (getPath().equals(file.getNodePath()) && getName().equals(file.getName()) && projectFile); - } - return false; - } - - public boolean equals(Buffer file) //Overloaded for convinient in Index Mgmt. - { - if(file != null) - { - if(OperatingSystem.isWindows()) - { - return (getPath().equalsIgnoreCase(file.getPath()) && getName().equalsIgnoreCase(file.getName()) && !projectFile); - } - return (getPath().equals(file.getPath()) && getName().equals(file.getName()) && !projectFile); - } - return false; - } - - public boolean equals(BufferHistory.Entry file) //Overloaded for convinient in Index Mgmt. - { - if(file != null) - { - if(OperatingSystem.isWindows()) - { - return (getPath().equalsIgnoreCase(file.path) && getName().equalsIgnoreCase(MiscUtilities.getFileName(file.path)) && !projectFile); - } - return (getPath().equals(file.path) && getName().equals(MiscUtilities.getFileName(file.path)) && !projectFile); - } - return false; - }*/ - public int hashCode() { return hashcode; Modified: plugins/FastOpen/trunk/com/patelsoft/fastopen/FastOpenPlugin.java =================================================================== --- plugins/FastOpen/trunk/com/patelsoft/fastopen/FastOpenPlugin.java 2011-08-30 18:55:11 UTC (rev 19880) +++ plugins/FastOpen/trunk/com/patelsoft/fastopen/FastOpenPlugin.java 2011-08-30 21:23:55 UTC (rev 19881) @@ -157,7 +157,6 @@ JPanel panel = new JPanel(new GridLayout(5,1)); JPanel panelChk = new JPanel(new GridLayout(0,3)); JPanel panelColors = new JPanel(new FlowLayout(FlowLayout.LEFT)); - //final JPanel pnlRadios = new JPanel(new FlowLayout(FlowLayout.LEFT)); final JPanel pnlRadios = new JPanel(new GridLayout(0,3)); pnlRadios.setBorder(new EtchedBorder()); JPanel pnlslider = new JPanel(new BorderLayout()); @@ -265,9 +264,7 @@ Component[] components = container.getComponents(); // for each element in the container enable/disable it for (int i = 0; i < components.length; i++) - { components[i].setEnabled(isEnabled); - } } } //End of FastOpenOptionPane Modified: plugins/FastOpen/trunk/com/patelsoft/fastopen/FastOpenTextField.java =================================================================== --- plugins/FastOpen/trunk/com/patelsoft/fastopen/FastOpenTextField.java 2011-08-30 18:55:11 UTC (rev 19880) +++ plugins/FastOpen/trunk/com/patelsoft/fastopen/FastOpenTextField.java 2011-08-30 21:23:55 UTC (rev 19881) @@ -7,6 +7,7 @@ import org.gjt.sp.jedit.gui.HistoryTextField; +@SuppressWarnings("serial") public class FastOpenTextField extends HistoryTextField { /** Modified: plugins/FastOpen/trunk/com/patelsoft/fastopen/Files.java =================================================================== --- plugins/FastOpen/trunk/com/patelsoft/fastopen/Files.java 2011-08-30 18:55:11 UTC (rev 19880) +++ plugins/FastOpen/trunk/com/patelsoft/fastopen/Files.java 2011-08-30 21:23:55 UTC (rev 19881) @@ -6,14 +6,12 @@ import org.gjt.sp.jedit.Buffer; import org.gjt.sp.jedit.BufferHistory; +import org.gjt.sp.jedit.BufferHistory.Entry; import org.gjt.sp.jedit.View; import org.gjt.sp.util.Log; import projectviewer.vpt.VPTNode; import projectviewer.vpt.VPTProject; -// import projectviewer.*; -// import projectviewer.config.*; -// import projectviewer.vpt.*; public class Files { @@ -34,7 +32,6 @@ } } - /** * Gets the currentProjectViewer attribute of the FastOpen object * @@ -44,48 +41,19 @@ { Object obj = projectviewer.ProjectViewer.getViewer(view); if(obj instanceof projectviewer.ProjectViewer) - { return (projectviewer.ProjectViewer)obj; - } return null; } /** * Gets the currentProject attribute of the FastOpen object - * * @return The currentProject value */ public VPTProject getCurrentProject(View view) { if(isPVThere()) - { - /* projectviewer.ProjectViewer pv = getCurrentProjectViewer(view); - - if(pv != null) - { - System.out.println("PV obj exists. returning active project " + pv.getActiveProject(view)); - return pv.getActiveProject(view); - } - - //currPrj = projectviewer.PVActions.getCurrentProject(view); - //System.out.println("PV instance does NOT exist. returning last project as per config " + (projectviewer.config.ProjectViewerConfig.getInstance().getLastNode())); - System.out.println("PV instance does not exists. returning last project " + projectviewer.config.ProjectViewerConfig.getInstance().getLastNode()); - //return (VPTProject)projectviewer.config.ProjectViewerConfig.getInstance().getLastNode(); - VPTNode nodePrj = projectviewer.config.ProjectViewerConfig.getInstance().getLastNode(); - if(nodePrj instanceof VPTProject) - { - return (VPTProject)nodePrj; - } - //return (projectviewer.vpt.VPTProject)projectviewer.ProjectViewer.getActiveNode(view); */ - return projectviewer.ProjectViewer.getActiveProject(view); - } return null; - /*if(isPVThere()) - { - return projectviewer.PVActions.getCurrentProject(view); - } - return null;*/ } @@ -94,16 +62,12 @@ return PVThere; } - public boolean isProjectLoaded(String projectName) - { - return projectviewer.ProjectManager.getInstance().isLoaded(projectName); - } + public boolean isProjectLoaded(String projectName) + { + return projectviewer.ProjectManager.getInstance().isLoaded(projectName); + } - /** - * Description of the Method - * - */ - void prjFile2FOFile(View view, Collection allFiles) + void prjFile2FOFile(View view, Collection<FastOpenFile> allFiles) { if(isPVThere() && atleatOneProject(view)) { @@ -128,8 +92,8 @@ boolean added = allFiles.add(fofile); if(!added) //Means hashcode is same but status is different { - allFiles.remove(fofile); //Removes the old duplicate class as per FOFile's hashCode impl. - allFiles.add(fofile); + allFiles.remove(fofile); //Removes the old duplicate class as per FOFile's hashCode impl. + allFiles.add(fofile); } } } @@ -144,39 +108,28 @@ if(isPVThere()) { if(getCurrentProject(view) != null) - { return true; - } } - return false; } - /** - * Description of the Method - * - * @param buffer Description of the Parameter - */ - void diffPrjFilesWithOpenBuffers(Buffer buffer[],View view, Collection allFiles) + void diffPrjFilesWithOpenBuffers(Buffer buffer[],View view, + Collection<FastOpenFile> allFiles) { if(buffer == null || buffer.length == 0) - { return; - } if(isPVThere()) { projectviewer.vpt.VPTProject project = getCurrentProject(view); - //System.out.println("Got curr project in diffPrjFilesWithOpenBuffers " + project); if(project != null) { - //if(!project.isInProject(buffer[i].getPath())) for(int i = 0; i < buffer.length; i++) { if(!project.isInProject(buffer[i].getPath())) { boolean exists = false; - Iterator iterAllFiles = allFiles.iterator(); + Iterator<FastOpenFile> iterAllFiles = allFiles.iterator(); while(iterAllFiles.hasNext()) { FastOpenFile fofile = (FastOpenFile)iterAllFiles.next(); @@ -199,21 +152,19 @@ else { for(int i = 0; i < buffer.length; i++) - { allFiles.add(new FastOpenFile(buffer[i])); - } } } - public void bufferEntry2FastOpenFile(List files, Collection allFiles) + public void bufferEntry2FastOpenFile(List<Entry> files, Collection<FastOpenFile> allFiles) { - Iterator iter = files.iterator(); + Iterator<Entry> iter = files.iterator(); while(iter.hasNext()) { BufferHistory.Entry entry = (BufferHistory.Entry)iter.next(); boolean exists = false; - Iterator iterAllFiles = allFiles.iterator(); + Iterator<FastOpenFile> iterAllFiles = allFiles.iterator(); while(iterAllFiles.hasNext()) { FastOpenFile fofile = (FastOpenFile)iterAllFiles.next(); @@ -232,7 +183,7 @@ } } - void getRecentFiles(Collection allFiles) + void getRecentFiles(Collection<FastOpenFile> allFiles) { bufferEntry2FastOpenFile(BufferHistory.getHistory(), allFiles); } Modified: plugins/FastOpen/trunk/com/patelsoft/fastopen/IndexListener.java =================================================================== --- plugins/FastOpen/trunk/com/patelsoft/fastopen/IndexListener.java 2011-08-30 18:55:11 UTC (rev 19880) +++ plugins/FastOpen/trunk/com/patelsoft/fastopen/IndexListener.java 2011-08-30 21:23:55 UTC (rev 19881) @@ -7,7 +7,6 @@ * @created 19/Apr/2005 */ - public interface IndexListener { public void indexingStarted(IndexManager manager); Modified: plugins/FastOpen/trunk/com/patelsoft/fastopen/IndexManager.java =================================================================== --- plugins/FastOpen/trunk/com/patelsoft/fastopen/IndexManager.java 2011-08-30 18:55:11 UTC (rev 19880) +++ plugins/FastOpen/trunk/com/patelsoft/fastopen/IndexManager.java 2011-08-30 21:23:55 UTC (rev 19881) @@ -8,10 +8,9 @@ * @created 14/Dec/2004 */ - public interface IndexManager { - public Set getCollectedFiles(); + public Set<FastOpenFile> getCollectedFiles(); public void stop(); public void suggestReindex(); public void addIndexListener(IndexListener listener); Modified: plugins/FastOpen/trunk/com/patelsoft/fastopen/PollingIndexManager.java =================================================================== --- plugins/FastOpen/trunk/com/patelsoft/fastopen/PollingIndexManager.java 2011-08-30 18:55:11 UTC (rev 19880) +++ plugins/FastOpen/trunk/com/patelsoft/fastopen/PollingIndexManager.java 2011-08-30 21:23:55 UTC (rev 19881) @@ -19,7 +19,6 @@ /** * Constructor for PollingIndexManager - * */ public PollingIndexManager(View view, Files files) { @@ -33,7 +32,6 @@ public void run() { - //Thread.yield();//Runs only the first time!! So that FastOpen Main window gets chance to show while(!interrupted) { try @@ -60,11 +58,10 @@ queryFilesFromSource(); long end = System.currentTimeMillis(); Log.log(Log.MESSAGE, this, "Polling Thread ran and collected "+(allfiles != null? allfiles.size():0) + " files in " + (end-start)/1000 +" secs"); - //System.out.println("Total files collected " + allfiles.size()); collecting = false; } - public Set getCollectedFiles() + public Set<FastOpenFile> getCollectedFiles() { return allfiles; } Modified: plugins/FastOpen/trunk/com/patelsoft/fastopen/SimpleIndexManager.java =================================================================== --- plugins/FastOpen/trunk/com/patelsoft/fastopen/SimpleIndexManager.java 2011-08-30 18:55:11 UTC (rev 19880) +++ plugins/FastOpen/trunk/com/patelsoft/fastopen/SimpleIndexManager.java 2011-08-30 21:23:55 UTC (rev 19881) @@ -12,19 +12,17 @@ * @created 15/Dec/2004 */ - public class SimpleIndexManager extends AbstractIndexManager { /** * Constructor for SimpleIndexManager - * */ public SimpleIndexManager(View view, Files files) { super(view, files); }//End of constructor - public Set getCollectedFiles() + public Set<FastOpenFile> getCollectedFiles() { super.queryFilesFromSource(); return allfiles;//We can set super.allfiles to NULL beforen returning the allfiles but we are not doing so inorder to benefit from the checking that the source querying logic does inorder to prevent frequent Object creation if the files already exists in allfiles. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |