15
15
import org .eclipse .core .runtime .IProgressMonitor ;
16
16
import org .eclipse .core .runtime .IStatus ;
17
17
import org .eclipse .core .runtime .Platform ;
18
+ import org .eclipse .core .runtime .Plugin ;
18
19
import org .eclipse .core .runtime .Status ;
19
20
import org .eclipse .core .runtime .content .IContentType ;
20
21
import org .eclipse .core .runtime .content .IContentTypeManager ;
21
22
import org .eclipse .core .runtime .content .IContentTypeSettings ;
22
- import org .eclipse .core .runtime .jobs .IJobManager ;
23
23
import org .eclipse .core .runtime .jobs .Job ;
24
24
import org .eclipse .core .runtime .preferences .IEclipsePreferences ;
25
25
import org .eclipse .core .runtime .preferences .InstanceScope ;
26
- import org .eclipse .ui .plugin .AbstractUIPlugin ;
27
26
import org .osgi .framework .BundleContext ;
28
27
import org .osgi .service .prefs .BackingStoreException ;
29
28
import org .osgi .service .prefs .Preferences ;
38
37
import io .sloeber .core .listeners .IndexerListener ;
39
38
import io .sloeber .core .managers .InternalPackageManager ;
40
39
41
- abstract class FamilyJob extends Job {
42
- static final String MY_FAMILY = "myJobFamily" ; //$NON-NLS-1$
43
-
44
- public FamilyJob (String name ) {
45
- super (name );
46
- }
47
-
48
- @ Override
49
- public boolean belongsTo (Object family ) {
50
- return family == MY_FAMILY ;
51
- }
52
-
53
- }
54
40
55
41
/**
56
42
* generated code
57
43
*
58
44
* @author Jan Baeyens
59
45
*
60
46
*/
61
- @ SuppressWarnings ({ "nls" , "unused" })
62
- public class Activator extends AbstractUIPlugin {
47
+ @ SuppressWarnings ({ "nls" })
48
+ public class Activator extends Plugin {
63
49
// preference nodes
64
50
public static final String NODE_ARDUINO = "io.sloeber.arduino" ;
65
51
// TOFIX I think the fix below for unix users is no longer needed and we no
@@ -69,10 +55,7 @@ public class Activator extends AbstractUIPlugin {
69
55
70
56
// The shared instance
71
57
private static final String FLAG_START = "F" + "s" + "S" + "t" + "a" + "t" + "u" + "s" ;
72
- private static final String UPLOAD_FLAG = "F" + "u" + "S" + "t" + "a" + "t" + "u" + "s" ;
73
- private static final String BUILD_FLAG = "F" + "b" + "S" + "t" + "a" + "t" + "u" + "s" ;
74
- private static final String LOCAL_FLAG = "l" + FLAG_START ;
75
- private static final String HELP_LOC = "https://www.baeyens.it/eclipse/remind.php" ;
58
+
76
59
77
60
private static Activator instance ;
78
61
protected char [] uri = { 'h' , 't' , 't' , 'p' , 's' , ':' , '/' , '/' , 'b' , 'a' , 'e' , 'y' , 'e' , 'n' , 's' , '.' , 'i' , 't' ,
@@ -98,7 +81,6 @@ public void start(BundleContext context) throws Exception {
98
81
if (Const .isLinux && System .getProperty (ENV_KEY_GNU_SERIAL_PORTS ) == null ) {
99
82
System .setProperty (ENV_KEY_GNU_SERIAL_PORTS , ENV_VALUE_GNU_SERIAL_PORTS_LINUX );
100
83
}
101
- remind ();
102
84
103
85
}
104
86
@@ -271,9 +253,7 @@ protected IStatus run(IProgressMonitor monitor) {
271
253
*/
272
254
@ Override
273
255
public void stop (BundleContext context ) throws Exception {
274
- IJobManager jobMan = Job .getJobManager ();
275
- jobMan .cancel (FamilyJob .MY_FAMILY );
276
- jobMan .join (FamilyJob .MY_FAMILY , null );
256
+
277
257
instance = null ;
278
258
super .stop (context );
279
259
}
@@ -374,37 +354,6 @@ private static void addFileAssociations() {
374
354
375
355
}
376
356
377
- static void remind () {
378
-
379
- Job job = new FamilyJob ("pluginReminder" ) {
380
- @ Override
381
- protected IStatus run (IProgressMonitor monitor ) {
382
357
383
- IEclipsePreferences myScope = InstanceScope .INSTANCE .getNode (NODE_ARDUINO );
384
- int curFsStatus = myScope .getInt (FLAG_START , 0 );
385
- int curFuStatus = myScope .getInt (UPLOAD_FLAG , 0 );
386
- int curFbStatus = myScope .getInt (BUILD_FLAG , 0 );
387
- int curFsiStatus = curFsStatus + curFuStatus + curFbStatus ;
388
- int lastFsiStatus = myScope .getInt (LOCAL_FLAG , 0 );
389
- final int trigger = 30 ;
390
- if ((curFsiStatus - lastFsiStatus ) < 0 ) {
391
- lastFsiStatus = curFsiStatus - (trigger + 1 );
392
- }
393
- if ((curFsiStatus - lastFsiStatus ) >= trigger ) {
394
- myScope .putInt (LOCAL_FLAG , curFsiStatus );
395
- try {
396
- myScope .flush ();
397
- } catch (BackingStoreException e ) {
398
- // this should not happen
399
- }
400
- PleaseHelp .doHelp (HELP_LOC );
401
- }
402
- remind ();
403
- return Status .OK_STATUS ;
404
- }
405
- };
406
- job .setPriority (Job .DECORATE );
407
- job .schedule (60000 );
408
- }
409
358
410
359
}
0 commit comments