Skip to content

Commit

Permalink
workspace startup check can now be disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
nodj committed Dec 14, 2014
1 parent d3c8ba9 commit 74b6c8b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
4 changes: 2 additions & 2 deletions AutoDerivPlugin/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ issues: noted (#n), see https://github.com/nodj/AutoDeriv/issues/n
================================================================================
AutoDeriv TODO list
--------------------------------------------------------------------------------
[x] add usage examples, explain the !/, the patterns...
[ ] hash useful part of rule, compare this hash before reparsing
[ ] make use of IProgress.isCanceled method ?
[ ] handle conf files with zero rules - especially master
[ ] command to force usage of regex even if path is legal. Eg. "^a$"
[ ] command 'post' & 'pre' for the global .derived file
[ ] command to disable [Pattern -> fnmatch] regex syntax conversion
[ ] add info, warn, err for .derived files
[ ] better change analysis : avoid recursion on project not using AutoDeriv
some command should be implemented as a menu button ?
================================================================================

Expand All @@ -26,6 +24,8 @@ AutoDeriv v1.3.1: 2014-12-?? [wait the git tag]
- Fixed handling of project status: closed vs open
- Added basic plugin configuration. See "autoderiv.ini" part in the home site
- Customizable decoration prefix, suffix, background and foreground colors.
- Customizable logging
- workspace startup check can be disabled.
- several internal modification without -in theory- visible effects:
- Fixed ConcurentModificationException: Prevent parallel execution of
changeEvent listener
Expand Down
7 changes: 6 additions & 1 deletion AutoDerivPlugin/src/autoderiv/Cst.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public class Cst {
public static boolean ENABLE_INFO = false;
public static boolean ENABLE_DBG = false;

public static String OPTION_STARTUP_CHECK_STR = "/options/startupcheck/enable";
public static boolean OPTION_STARTUP_CHECK = true;

public static boolean DECORATION_SUFFIX_ENABLED = true;
public static String DECORATION_SUFFIX_STR = "/decoration/suffix";
public static String DECORATION_SUFFIX = " <deriv>";
Expand Down Expand Up @@ -126,6 +129,8 @@ else if(key.equals(PLUGIN_ID+TRACE_INFO_STR))
else if(key.equals(PLUGIN_ID+TRACE_WARN_STR))
Cst.ENABLE_WARN = "true".equals(valt);

else if(key.equals(PLUGIN_ID+OPTION_STARTUP_CHECK_STR))
Cst.OPTION_STARTUP_CHECK = "true".equals(valt);

else if(key.equals(PLUGIN_ID+DECORATION_SUFFIX_STR)){
DECORATION_SUFFIX_ENABLED = true;
Expand All @@ -135,6 +140,7 @@ else if(key.equals(PLUGIN_ID+DECORATION_PREFIX_STR)){
DECORATION_PREFIX_ENABLED = true;
DECORATION_PREFIX = val;
}

else if(key.equals(PLUGIN_ID+DECORATION_FOREGROUND_R_STR))
DECORATION_FOREGROUND_R = Integer.parseInt(valt);
else if(key.equals(PLUGIN_ID+DECORATION_FOREGROUND_G_STR))
Expand All @@ -143,7 +149,6 @@ else if(key.equals(PLUGIN_ID+DECORATION_FOREGROUND_B_STR))
DECORATION_FOREGROUND_B = Integer.parseInt(valt);

else if(key.equals(PLUGIN_ID+DECORATION_BACKGROUND_R_STR))

DECORATION_BACKGROUND_R = Integer.parseInt(valt);
else if(key.equals(PLUGIN_ID+DECORATION_BACKGROUND_G_STR))
DECORATION_BACKGROUND_G = Integer.parseInt(valt);
Expand Down
33 changes: 15 additions & 18 deletions AutoDerivPlugin/src/autoderiv/handlers/ChangeEventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,24 @@ public void resourceChanged(final IResourceChangeEvent event) {

Debug.dbg("===== ChangeEventHandler.resourceChanged() =====");

// Just debug prints
// switch(event.getType()){
// case IResourceChangeEvent.POST_CHANGE: Debug.info("POST_CHANGE"); break;
// case IResourceChangeEvent.POST_BUILD: Debug.info("POST_BUILD"); break;
// case IResourceChangeEvent.PRE_BUILD: Debug.info("PRE_BUILD"); break;
// case IResourceChangeEvent.PRE_CLOSE: Debug.info("PRE_CLOSE"); break;
// case IResourceChangeEvent.PRE_DELETE:
// // when a project is delete
// Debug.info("PRE_DELETE");
// return;
// case IResourceChangeEvent.PRE_REFRESH: Debug.info("PRE_REFRESH"); break;
// default: Debug.info("default..."); break;
// }
// Just debug prints
switch(event.getType()){
case IResourceChangeEvent.POST_CHANGE: Debug.dbg("POST_CHANGE"); break;
case IResourceChangeEvent.POST_BUILD: Debug.dbg("POST_BUILD"); break;
case IResourceChangeEvent.PRE_BUILD: Debug.dbg("PRE_BUILD"); break;
case IResourceChangeEvent.PRE_CLOSE: Debug.dbg("PRE_CLOSE"); break;
case IResourceChangeEvent.PRE_DELETE:
// when a project is delete
Debug.dbg("PRE_DELETE");
return;
case IResourceChangeEvent.PRE_REFRESH: Debug.dbg("PRE_REFRESH"); break;
default: Debug.dbg("default... What ?"); break;
}

final HashMap<IProject, VisitData> perProjectVisitData = new HashMap<IProject, VisitData>();

// loop in order to work on a per-projects basis
for (IResourceDelta ac : delta.getAffectedChildren()) {
// todo should the visit happen in the WorkspaceJob thread ? Deferred ?
VisitData v = new VisitData();
IProject proj = ac.getResource().getProject();
try {
Expand Down Expand Up @@ -321,7 +320,6 @@ private void deferedStartup(IProgressMonitor progress) {

/* For each project, check if it contains a conf file. Parse it, but
* don't update files as it is a pure waste of time.
* Todo possibility to disable startup overall update
*/
for(IProject proj : ResourcesPlugin.getWorkspace().getRoot().getProjects()){
if(!proj.isOpen()) continue;
Expand All @@ -342,9 +340,8 @@ private void deferedStartup(IProgressMonitor progress) {
}


// todo if(userAcceptsAStartupCheck)
// I hope this is not too long...
FilterManager.filterWorkspace(progress);
if(Cst.OPTION_STARTUP_CHECK)
FilterManager.filterWorkspace(progress);

double startupEnd = Tools.getmsd();
Debug.info("ChangeEventHandler.deferedStartup() took (ms) " + (startupEnd - startupStart));
Expand Down

0 comments on commit 74b6c8b

Please sign in to comment.