From: Marcelo V. <va...@us...> - 2012-02-09 17:43:44
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CtagsInterface jEdit plugin". The branch, master has been updated via d0ce4a2a6f5c293808afea738e6ed9ea213d137d (commit) from dd534a0928713ab47387ce642910a4e7167d442d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit: http://jedit.git.sourceforge.net/git/gitweb.cgi?p=jedit/CtagsInterface;a=commit;h=d0ce4a2a6f5c293808afea738e6ed9ea213d137d commitdiff: http://jedit.git.sourceforge.net/git/gitweb.cgi?p=jedit/CtagsInterface;a=commitdiff;h=d0ce4a2a6f5c293808afea738e6ed9ea213d137d tree: http://jedit.git.sourceforge.net/git/gitweb.cgi?p=jedit/CtagsInterface;a=tree;h=d0ce4a2a6f5c293808afea738e6ed9ea213d137d;hb=d0ce4a2a6f5c293808afea738e6ed9ea213d137d commit d0ce4a2a6f5c293808afea738e6ed9ea213d137d Author: Marcelo Vanzin <va...@us...> Date: Tue Feb 7 20:23:39 2012 -0800 Add option to not show the progress dockable automatically. Probably the most annoying feature in a plugin, ever. diff --git a/CtagsInterface.props b/CtagsInterface.props index e92fdef..63e9594 100644 --- a/CtagsInterface.props +++ b/CtagsInterface.props @@ -112,13 +112,15 @@ messages.CtagsInterface.searchActiveProjectFirst=Active project first, and only messages.CtagsInterface.showTooltips=Show tag tooltips messages.CtagsInterface.completeDesc=Show tag description in code completion messages.CtagsInterface.checkCtags=Check path -messages.CtagsInterface.badCtagsPath=Ctags path does not exist or is not an executable file +messages.CtagsInterface.badCtagsPath=Ctags path does not exist or is not an executable file messages.CtagsInterface.goodCtagsPath=Ctags path is okay messages.CtagsInterface.noPVSupport=ProjectViewer integration not initialized. \ Please make sure ProjectViewer is loaded and then restart CtagsInterface. messages.CtagsInterface.tagging=Running Ctags messages.CtagsInterface.parsing=Parsing tag file messages.CtagsInterface.autoCloseProgress=Automatically close progress tab when tagging is over +messages.CtagsInterface.showProgress=Show progress dialog automatically +messages.CtagsInterface.taskFinished=CtagsInterface background task finished. # projectviewer option pane plugin.projectviewer.ctagsinterface.main.CtagsInterfacePlugin.option-pane=CtagsInterface-ProjectDependencies diff --git a/src/ctagsinterface/dockables/Progress.java b/src/ctagsinterface/dockables/Progress.java index 723386b..204a9c8 100644 --- a/src/ctagsinterface/dockables/Progress.java +++ b/src/ctagsinterface/dockables/Progress.java @@ -18,9 +18,11 @@ import javax.swing.JTextArea; import javax.swing.SwingUtilities; import javax.swing.Timer; +import org.gjt.sp.jedit.jEdit; import org.gjt.sp.jedit.View; import org.gjt.sp.util.ThreadUtilities; +import ctagsinterface.main.CtagsInterfacePlugin; import ctagsinterface.main.Logger; import ctagsinterface.options.GeneralOptionPane; @@ -30,9 +32,11 @@ public class Progress extends JPanel private JTabbedPane tabs; private HashMap<Logger, ProgressTab> progressTabs = new HashMap<Logger, ProgressTab>(); + private View view; public Progress(View view) { + this.view = view; setLayout(new BorderLayout()); tabs = new JTabbedPane(); add(tabs, BorderLayout.CENTER); @@ -114,6 +118,12 @@ public class Progress extends JPanel public void run() { getTab(logger).endTask(); + if (!GeneralOptionPane.getShowProgress()) { + String msg = CtagsInterfacePlugin.MESSAGE + + "taskFinished"; + view.getStatus().setMessageAndClear( + jEdit.getProperty(msg)); + } } }); } diff --git a/src/ctagsinterface/main/CtagsInterfacePlugin.java b/src/ctagsinterface/main/CtagsInterfacePlugin.java index 6d995ae..469e9a5 100644 --- a/src/ctagsinterface/main/CtagsInterfacePlugin.java +++ b/src/ctagsinterface/main/CtagsInterfacePlugin.java @@ -50,7 +50,7 @@ import ctagsinterface.projects.ProjectWatcher; public class CtagsInterfacePlugin extends EditPlugin { - + private static final String MISC_ORIGIN_ID = "temp"; public static final String TAGS_UPDATED_BUFFER_PROP = "TagsUpdated"; private static final String DOCKABLE = "ctags-interface-tag-list"; @@ -161,7 +161,7 @@ public class CtagsInterfacePlugin extends EditPlugin } // Adds a temporary tag file to the DB - // Existing tags from source files in the tag file are removed first. + // Existing tags from source files in the tag file are removed first. static private void addTempTagFile(View view, String tagFile) { Logger logger = getLogger(view, "Tag file " + tagFile); @@ -319,7 +319,7 @@ public class CtagsInterfacePlugin extends EditPlugin JOptionPane.showMessageDialog( view, "No tag selected nor identified at caret"); return; - } + } Vector<Tag> tags = queryScopedTag(view, tag); if (tags == null) return; @@ -335,7 +335,7 @@ public class CtagsInterfacePlugin extends EditPlugin TagCompletion.complete(view, prefix); } - // Run a query on the database and display the results (for debugging) + // Run a query on the database and display the results (for debugging) public static void runQuery(final View view) { String q = JOptionPane.showInputDialog("Enter query:"); @@ -354,7 +354,7 @@ public class CtagsInterfacePlugin extends EditPlugin }); } - // Show a query dialog + // Show a query dialog public static void showQueryDialog(final View view) { new QueryDialog(view); @@ -392,7 +392,7 @@ public class CtagsInterfacePlugin extends EditPlugin return null; return selected.substring(0, selected.length() - (end - index)); } - + // Returns the tag to jump to: The selected tag or the one at the caret. static public String getDestinationTag(View view) { @@ -401,7 +401,7 @@ public class CtagsInterfacePlugin extends EditPlugin tag = getTagAtCaret(view); return tag; } - + // Returns the tag at the caret. static private String getTagAtCaret(View view) { @@ -583,7 +583,7 @@ public class CtagsInterfacePlugin extends EditPlugin } } } - + // Refreshes the given origin in the DB static public void refreshOrigin(OriginType type, String name) { @@ -593,7 +593,7 @@ public class CtagsInterfacePlugin extends EditPlugin index.deleteTagsOfOrigin(logger, origin); tagOrigin(logger, origin); } - + // Deletes an origin with all associated data from the DB public static void deleteOrigin(final Logger logger, final OriginType type, final String name) @@ -604,7 +604,7 @@ public class CtagsInterfacePlugin extends EditPlugin { index.deleteOrigin(logger, index.getOrigin(type, name, false)); if (pvi != null && type == OriginType.PROJECT) - pvi.updateWatchers(); + pvi.updateWatchers(); } }); } @@ -629,7 +629,7 @@ public class CtagsInterfacePlugin extends EditPlugin case ARCHIVE: tagArchive(logger, origin.id, handler); break; } } - + private static void addWorkRequest(String originId, Task task) { Task current = tasks.get(originId); @@ -642,8 +642,20 @@ public class CtagsInterfacePlugin extends EditPlugin private static Progress getProgressDockable(View view) { DockableWindowManager dwm = view.getDockableWindowManager(); - dwm.showDockableWindow(PROGRESS); - return (Progress) dwm.getDockable(PROGRESS); + if (GeneralOptionPane.getShowProgress()) { + dwm.showDockableWindow(PROGRESS); + } + + Progress win = (Progress) dwm.getDockable(PROGRESS); + /* + * This is horrible. But getDockable() returns null if the + * dockable window is not instantiated yet, even if it + * really exists. + */ + if (win == null) { + win = new Progress(view); + } + return win; } private static StatusBar getStatusBar() @@ -665,16 +677,16 @@ public class CtagsInterfacePlugin extends EditPlugin return; s.setMessage(""); } - + private static void parseTagFile(Runner runner, Parser parser, String tagFile, TagHandler handler) { parser.parseTagFile(tagFile, handler); runner.releaseFile(tagFile); } - + /* Source file support */ - + public static void tagSourceFile(final String file) { setStatusMessage("Tagging file: " + file); @@ -717,7 +729,7 @@ public class CtagsInterfacePlugin extends EditPlugin } /* Archive support */ - + public static void tagArchive(final Logger logger, final String archive, final TagHandler handler) { @@ -739,9 +751,9 @@ public class CtagsInterfacePlugin extends EditPlugin }); removeStatusMessage(); } - + /* Source tree support */ - + // Runs Ctags on a source tree and add the tags and associated data to the DB public static void tagSourceTree(final Logger logger, final String tree, final TagHandler handler) @@ -757,13 +769,13 @@ public class CtagsInterfacePlugin extends EditPlugin }); removeStatusMessage(); } - + /* Project support */ - + public static ProjectWatcher getProjectWatcher() { return pvi; } - + // Runs Ctags on a list of files and add the tags and associated data to the DB private static void tagFiles(Logger logger, Vector<String> files, TagHandler handler) @@ -773,7 +785,7 @@ public class CtagsInterfacePlugin extends EditPlugin String tagFile = runner.runOnFiles(files); parseTagFile(runner, parser, tagFile, handler); } - + // Runs Ctags on a project and inserts the tags and associated data to the DB public static void tagProject(final Logger logger, final String project, final TagHandler handler) @@ -809,14 +821,14 @@ public class CtagsInterfacePlugin extends EditPlugin } removeStatusMessage(); } - + /* * Interface for other plugins */ - + public static Vector<Tag> queryTag(String tag) { - Vector<Tag> tags = new Vector<Tag>(); + Vector<Tag> tags = new Vector<Tag>(); index.queryTag(tag, tags); return tags; } diff --git a/src/ctagsinterface/options/GeneralOptionPane.java b/src/ctagsinterface/options/GeneralOptionPane.java index bd6103c..16c0f38 100644 --- a/src/ctagsinterface/options/GeneralOptionPane.java +++ b/src/ctagsinterface/options/GeneralOptionPane.java @@ -39,6 +39,7 @@ public class GeneralOptionPane extends AbstractOptionPane { static public final String PREVIEW_TOOLBAR = OPTION + "previewToolbar"; static public final String PREVIEW_WRAP = OPTION + "previewWrap"; static public final String PREVIEW_DELAY = OPTION + "previewDelay"; + static public final String SHOW_PROGRESS = OPTION + "showProgress"; static public final String AUTO_CLOSE_PROGRESS = OPTION + "autoCloseProgress"; static private final String CHECK_CTAGS = MESSAGE + "checkCtags"; static private final String BAD_CTAGS_PATH = MESSAGE + "badCtagsPath"; @@ -56,6 +57,7 @@ public class GeneralOptionPane extends AbstractOptionPane { JCheckBox previewToolbar; JCheckBox previewWrap; JTextField previewDelay; + JCheckBox showProgress; JCheckBox autoCloseProgress; public GeneralOptionPane() { @@ -77,25 +79,25 @@ public class GeneralOptionPane extends AbstractOptionPane { cmd = new JTextField(jEdit.getProperty(CMD), 40); addComponent(jEdit.getProperty(MESSAGE + "cmd"), cmd); - + pattern = new JTextField(jEdit.getProperty(PATTERN), 40); addComponent(jEdit.getProperty(MESSAGE + "pattern"), pattern); - + updateOnLoad = new JCheckBox(jEdit.getProperty(MESSAGE + "updateOnLoad"), getUpdateOnLoad()); addComponent(updateOnLoad); updateOnSave = new JCheckBox(jEdit.getProperty(MESSAGE + "updateOnSave"), getUpdateOnSave()); addComponent(updateOnSave); - + tooltips = new JCheckBox(jEdit.getProperty(MESSAGE + "showTooltips"), getShowTooltips()); addComponent(tooltips); - + completeDesc = new JCheckBox(jEdit.getProperty(MESSAGE + "completeDesc"), getCompleteDesc()); addComponent(completeDesc); - + JPanel previewPanel = new JPanel(); previewPanel.setLayout(new GridLayout(0, 1)); previewPanel.setBorder(new TitledBorder(jEdit.getProperty( @@ -128,6 +130,10 @@ public class GeneralOptionPane extends AbstractOptionPane { previewPanel.add(previewDelayPanel); addComponent(previewPanel); + showProgress = new JCheckBox(jEdit.getProperty(MESSAGE + "showProgress"), + getShowProgress()); + addComponent(showProgress); + autoCloseProgress = new JCheckBox(jEdit.getProperty(MESSAGE + "autoCloseProgress"), getAutoCloseProgress()); addComponent(autoCloseProgress); @@ -146,6 +152,7 @@ public class GeneralOptionPane extends AbstractOptionPane { jEdit.setBooleanProperty(PREVIEW_TOOLBAR, previewToolbar.isSelected()); jEdit.setBooleanProperty(PREVIEW_WRAP, previewWrap.isSelected()); jEdit.setIntegerProperty(PREVIEW_DELAY, Integer.valueOf(previewDelay.getText())); + jEdit.setBooleanProperty(SHOW_PROGRESS, showProgress.isSelected()); jEdit.setBooleanProperty(AUTO_CLOSE_PROGRESS, autoCloseProgress.isSelected()); EditBus.send(new PropertiesChanged(null)); } @@ -206,6 +213,9 @@ public class GeneralOptionPane extends AbstractOptionPane { public static int getPreviewDelay() { return jEdit.getIntegerProperty(PREVIEW_DELAY, 0); } + public static boolean getShowProgress() { + return jEdit.getBooleanProperty(SHOW_PROGRESS, true); + } public static boolean getAutoCloseProgress() { return jEdit.getBooleanProperty(AUTO_CLOSE_PROGRESS, true); } ----------------------------------------------------------------------- Summary of changes: CtagsInterface.props | 4 +- src/ctagsinterface/dockables/Progress.java | 10 +++ src/ctagsinterface/main/CtagsInterfacePlugin.java | 64 ++++++++++++-------- src/ctagsinterface/options/GeneralOptionPane.java | 20 +++++-- 4 files changed, 66 insertions(+), 32 deletions(-) hooks/post-receive -- CtagsInterface jEdit plugin |