From 1fa87c22bb373959171925dcd87699e023b0452b Mon Sep 17 00:00:00 2001 From: "Torkild U. Resheim" Date: Tue, 10 Sep 2019 10:17:19 +0200 Subject: [PATCH 1/4] Add missing vendor string --- net.resheim.eclipse.timekeeper.db/META-INF/MANIFEST.MF | 1 + 1 file changed, 1 insertion(+) diff --git a/net.resheim.eclipse.timekeeper.db/META-INF/MANIFEST.MF b/net.resheim.eclipse.timekeeper.db/META-INF/MANIFEST.MF index 4ba0b0d..f032a18 100644 --- a/net.resheim.eclipse.timekeeper.db/META-INF/MANIFEST.MF +++ b/net.resheim.eclipse.timekeeper.db/META-INF/MANIFEST.MF @@ -66,3 +66,4 @@ Bundle-ClassPath: lib/h2-1.4.194.jar, . Bundle-ActivationPolicy: lazy Bundle-Activator: net.resheim.eclipse.timekeeper.db.TimekeeperPlugin +Bundle-Vendor: Torkild U. Resheim From ce48cd527f5345a0ae7d1e2f9ac67e0d425966bf Mon Sep 17 00:00:00 2001 From: "Torkild U. Resheim" Date: Wed, 2 Oct 2019 14:40:43 +0200 Subject: [PATCH 2/4] Use standard code formatting --- .../eclipse/timekeeper/db/Activity.java | 68 +++--- .../timekeeper/db/DatabaseChangeListener.java | 2 +- .../timekeeper/db/PreferenceInitializer.java | 18 +- .../timekeeper/db/TimekeeperPlugin.java | 212 +++++++++--------- .../eclipse/timekeeper/db/TrackedTask.java | 85 ++++--- .../eclipse/timekeeper/db/TrackedTaskId.java | 14 +- .../internal/idle/MacIdleTimeDetector.java | 28 ++- .../idle/WindowsIdleTimeDetector.java | 28 +-- .../internal/idle/X11IdleTimeDetector.java | 34 ++- .../timekeeper/ui/TimekeeperUiPlugin.java | 15 +- .../DefaultTemplateToClipboardHandler.java | 2 +- .../ui/export/TemplateExportMenu.java | 10 +- 12 files changed, 252 insertions(+), 264 deletions(-) diff --git a/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/Activity.java b/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/Activity.java index 793a18c..47e40f3 100644 --- a/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/Activity.java +++ b/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/Activity.java @@ -33,42 +33,44 @@ * however that should typically not be the case. Multiple activities can be * assign to the same {@link TrackedTask}, on the same day. * - * TODO: Consolidate activities so they never span dates. It will make several operations much easier. + * TODO: Consolidate activities so they never span dates. It will make several + * operations much easier. * * @author Torkild U. Resheim */ @Entity(name = "ACTIVITY") @UuidGenerator(name = "uuid") -public class Activity implements Comparable{ - +public class Activity implements Comparable { + @Id - @GeneratedValue(generator="uuid") + @GeneratedValue(generator = "uuid") @Column(name = "ID") private String id; - + /** The time the activity was started */ @Column(name = "START_TIME") @Convert(converter = LocalDateTimeAttributeConverter.class) private LocalDateTime start = null; - + /** The time the activity was stopped */ @Column(name = "END_TIME") @Convert(converter = LocalDateTimeAttributeConverter.class) private LocalDateTime end = null; - + /** Whether or not activity properties have been manually adjusted or created */ @Column(name = "ADJUSTED") private boolean manual = false; /** The task the activity is associated with */ - @ManyToOne + @ManyToOne private TrackedTask trackedtask; - + /** A short summary of the activity */ @Column private String summary; - - protected Activity() {} + + protected Activity() { + } public Activity(TrackedTask trackedtask, LocalDateTime start) { this.trackedtask = trackedtask; @@ -89,31 +91,28 @@ public Activity(TrackedTask trackedtask, LocalDateTime start) { public Duration getDuration() { return Duration.between(getStart(), getEnd()); } - + /** * Returns the duration of work on the given date if any. * - * @param date - * the date to calculate for + * @param date the date to calculate for * @return the amount of work occuring on the given date */ public Duration getDuration(LocalDate date) { return getDuration(date, date.plusDays(1)); } - + /** * Returns the duration of the activity between the given dates. * - * @param start - * the start date - * @param end - * the end date + * @param start the start date + * @param end the end date * @return the duration of work between the two days */ public Duration getDuration(LocalDate start, LocalDate end) { - LocalDateTime min = LocalDateTime.of(start,LocalTime.MIN); - LocalDateTime max = LocalDateTime.of(end,LocalTime.MIN); - + LocalDateTime min = LocalDateTime.of(start, LocalTime.MIN); + LocalDateTime max = LocalDateTime.of(end, LocalTime.MIN); + LocalDateTime s = getStart(); LocalDateTime e = getEnd(); @@ -122,7 +121,7 @@ public Duration getDuration(LocalDate start, LocalDate end) { if (e == null) { e = LocalDateTime.now(); } - + if (s.isAfter(max) || e.isBefore(min)) { return Duration.ZERO; } @@ -132,24 +131,23 @@ public Duration getDuration(LocalDate start, LocalDate end) { d = d.minus(Duration.between(s, min)); } if (e.isAfter(max)) { - d = d.minus(Duration.between(max,e)); + d = d.minus(Duration.between(max, e)); } return d; } - + /** - * Specifies the duration of the activity by modifying the end time. Also - * sets the manual flag indicating that this activity was manually - * created or edited. + * Specifies the duration of the activity by modifying the end time. Also sets + * the manual flag indicating that this activity was manually created or + * edited. * - * @param duration - * the duration + * @param duration the duration */ public void setDuration(Duration duration) { end = start.plus(duration); manual = true; } - + public LocalDateTime getEnd() { return end; } @@ -169,10 +167,10 @@ public void setStart(LocalDateTime start) { public boolean isEdited() { return manual; } - - public TrackedTask getTrackedTask() { - return trackedtask; - } + + public TrackedTask getTrackedTask() { + return trackedtask; + } public String getSummary() { return summary; diff --git a/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/DatabaseChangeListener.java b/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/DatabaseChangeListener.java index 8bca191..376f7e3 100644 --- a/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/DatabaseChangeListener.java +++ b/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/DatabaseChangeListener.java @@ -13,5 +13,5 @@ public interface DatabaseChangeListener { public void databaseStateChanged(); - + } diff --git a/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/PreferenceInitializer.java b/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/PreferenceInitializer.java index 73d9b48..2961a0e 100644 --- a/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/PreferenceInitializer.java +++ b/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/PreferenceInitializer.java @@ -31,7 +31,7 @@ import net.resheim.eclipse.timekeeper.db.report.ReportTemplate; /** - * Specifies default values for the core Timekeeper preferences. + * Specifies default values for the core Timekeeper preferences. */ public class PreferenceInitializer extends AbstractPreferenceInitializer { @@ -40,15 +40,18 @@ public void initializeDefaultPreferences() { IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, TimekeeperPlugin.BUNDLE_ID); try { store.setDefault(TimekeeperPlugin.PREF_DATABASE_LOCATION, TimekeeperPlugin.PREF_DATABASE_LOCATION_SHARED); - store.setDefault(TimekeeperPlugin.PREF_DATABASE_LOCATION_URL, TimekeeperPlugin.getDefault().getSharedLocation()); - // read from the "templates" directory and create a list of templates – all files stored there - // will be registered. + store.setDefault(TimekeeperPlugin.PREF_DATABASE_LOCATION_URL, + TimekeeperPlugin.getDefault().getSharedLocation()); + // read from the "templates" directory and create a list of templates – all + // files stored there + // will be registered. Bundle bundle = TimekeeperPlugin.getDefault().getBundle(); Enumeration findEntries = bundle.findEntries("templates", "*", true); List templates = new ArrayList<>(); while (findEntries.hasMoreElements()) { URL url = findEntries.nextElement(); - // open stream directly instead of resolving the URI, which would barf on spaces in path + // open stream directly instead of resolving the URI, which would barf on spaces + // in path InputStream is = url.openStream(); BufferedReader br = new BufferedReader(new InputStreamReader(is, Charset.forName("utf-8"))); StringBuilder sb = new StringBuilder(); @@ -67,10 +70,11 @@ public void initializeDefaultPreferences() { } else if (url.getFile().endsWith(".rtf")) { type = ReportTemplate.Type.RTF; } - templates.add(new ReportTemplate(name,type, sb.toString())); + templates.add(new ReportTemplate(name, type, sb.toString())); } // serialize the list of templates to a string and store it in the preferences - try (ByteArrayOutputStream out = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(out)){ + try (ByteArrayOutputStream out = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(out)) { oos.writeObject(templates); String encoded = Base64.getEncoder().encodeToString(out.toByteArray()); store.setDefault(TimekeeperPlugin.PREF_REPORT_TEMPLATES, encoded); diff --git a/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/TimekeeperPlugin.java b/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/TimekeeperPlugin.java index b20bcff..778f3b7 100644 --- a/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/TimekeeperPlugin.java +++ b/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/TimekeeperPlugin.java @@ -75,6 +75,8 @@ @SuppressWarnings("restriction") public class TimekeeperPlugin extends Plugin { + public static final String BUNDLE_ID = "net.resheim.eclipse.timekeeper.db"; //$NON-NLS-1$ + /* Preferences */ public static final String PREF_DATABASE_URL = "database-url"; public static final String PREF_DATABASE_LOCATION = "database-location"; @@ -84,18 +86,17 @@ public class TimekeeperPlugin extends Plugin { public static final String PREF_REPORT_TEMPLATES = "report-templates"; public static final String PREF_DEFAULT_TEMPLATE = "default-template"; + /** Identifier used when storing Timekeeper data in the Mylyn Task */ public static final String KEY_VALUELIST_ID = "net.resheim.eclipse.timekeeper"; //$NON-NLS-1$ - - public static final String BUNDLE_ID = "net.resheim.eclipse.timekeeper.db"; //$NON-NLS-1$ private static TimekeeperPlugin instance; private static EntityManager entityManager = null; - + private static Job saveDatabaseJob; - private static final ListenerList listeners = new ListenerList<>(); + /** Task repository kind identifier for Bugzilla. */ public static final String KIND_BUGZILLA = "bugzilla"; //$NON-NLS-1$ /** Task repository kind identifier for GitHub. */ @@ -106,21 +107,21 @@ public class TimekeeperPlugin extends Plugin { public static final String KIND_LOCAL = "local"; //$NON-NLS-1$ /** Repository attribute ID for custom grouping field. */ public static final String ATTR_GROUPING = KEY_VALUELIST_ID + ".grouping"; //$NON-NLS-1$ - - public void addListener(DatabaseChangeListener listener){ + + public void addListener(DatabaseChangeListener listener) { listeners.add(listener); } - - public void removeListener(DatabaseChangeListener listener){ + + public void removeListener(DatabaseChangeListener listener) { listeners.remove(listener); } - - private void notifyListeners(){ + + private void notifyListeners() { for (DatabaseChangeListener databaseChangeListener : listeners) { - SafeRunner.run(new ISafeRunnable() { + SafeRunner.run(new ISafeRunnable() { @Override public void run() throws Exception { - databaseChangeListener.databaseStateChanged(); + databaseChangeListener.databaseStateChanged(); } @Override @@ -130,7 +131,9 @@ public void handleException(Throwable exception) { }); } } - + + // synchronized appears to fix issue with this method being called out of + // order for some strange reason. private void connectToDatabase() { Job connectDatabaseJob = new Job("Connecting to Timekeeper database") { @@ -140,20 +143,19 @@ protected IStatus run(IProgressMonitor monitor) { // default, default location String jdbc_url = "jdbc:h2:~/.timekeeper/h2db"; try { - - String location = Platform.getPreferencesService() - .getString(BUNDLE_ID, PREF_DATABASE_LOCATION, PREF_DATABASE_LOCATION_SHARED, new - IScopeContext[] { InstanceScope.INSTANCE }); - switch (location){ - case PREF_DATABASE_LOCATION_SHARED: - jdbc_url = getSharedLocation(); - // Fix https://github.com/turesheim/eclipse-timekeeper/issues/107 - System.setProperty("h2.bindAddress", "localhost"); + + String location = Platform.getPreferencesService().getString(BUNDLE_ID, PREF_DATABASE_LOCATION, + PREF_DATABASE_LOCATION_SHARED, new IScopeContext[] { InstanceScope.INSTANCE }); + switch (location) { + case PREF_DATABASE_LOCATION_SHARED: + jdbc_url = getSharedLocation(); + // Fix https://github.com/turesheim/eclipse-timekeeper/issues/107 + System.setProperty("h2.bindAddress", "localhost"); break; - case PREF_DATABASE_LOCATION_WORKSPACE: - jdbc_url = getWorkspaceLocation(); + case PREF_DATABASE_LOCATION_WORKSPACE: + jdbc_url = getWorkspaceLocation(); break; - case PREF_DATABASE_LOCATION_URL: + case PREF_DATABASE_LOCATION_URL: jdbc_url = getSpecifiedLocation(); break; } @@ -164,37 +166,39 @@ protected IStatus run(IProgressMonitor monitor) { monitor.subTask(String.format("Using database at %1$s", jdbc_url)); // baseline the database - Flyway flyway = new Flyway(); - flyway.setDataSource(jdbc_url, "sa", ""); - flyway.setLocations("classpath:/db/"); - flyway.setBaselineOnMigrate(true); - flyway.migrate(); + Flyway flyway = new Flyway(); + flyway.setDataSource(jdbc_url, "sa", ""); + flyway.setLocations("classpath:/db/"); + flyway.setBaselineOnMigrate(true); + flyway.migrate(); // https://www.eclipse.org/forums/index.php?t=msg&goto=541155& props.put(PersistenceUnitProperties.CLASSLOADER, TimekeeperPlugin.class.getClassLoader()); - + props.put(PersistenceUnitProperties.JDBC_URL, jdbc_url); props.put(PersistenceUnitProperties.JDBC_DRIVER, "org.h2.Driver"); props.put(PersistenceUnitProperties.JDBC_USER, "sa"); props.put(PersistenceUnitProperties.JDBC_PASSWORD, ""); props.put(PersistenceUnitProperties.LOGGING_LEVEL, "fine"); - // we want Flyway to create the database, it gives us better control over migrating + // we want Flyway to create the database, it gives us better control over + // migrating props.put(PersistenceUnitProperties.DDL_GENERATION, "none"); - entityManager = new PersistenceProvider() - .createEntityManagerFactory("net.resheim.eclipse.timekeeper.db", props) - .createEntityManager(); + entityManager = new PersistenceProvider() + .createEntityManagerFactory("net.resheim.eclipse.timekeeper.db", props) + .createEntityManager(); } catch (Exception e) { return new Status(IStatus.ERROR, BUNDLE_ID, "Could not connect to Timekeeper database at " + jdbc_url, e); } - cleanTaskActivities(); + cleanTaskActivities(); notifyListeners(); - return Status.OK_STATUS; } + return Status.OK_STATUS; + } }; connectDatabaseJob.setSystem(false); connectDatabaseJob.schedule(); - } - + } + public class WorkspaceSaveParticipant implements ISaveParticipant { @Override @@ -213,7 +217,7 @@ public void rollback(ISaveContext context) { public void saving(ISaveContext context) throws CoreException { saveDatabaseJob.setSystem(true); saveDatabaseJob.schedule(); - } + } } /** @@ -234,24 +238,23 @@ public void start(BundleContext context) throws Exception { connectToDatabase(); createSaveJob(); ISaveParticipant saveParticipant = new WorkspaceSaveParticipant(); - ResourcesPlugin.getWorkspace().addSaveParticipant(BUNDLE_ID, saveParticipant); + ResourcesPlugin.getWorkspace().addSaveParticipant(BUNDLE_ID, saveParticipant); } /** * In some cases the Mylyn task can be deactivated without the tracked task - * being properly updated. This can happen for instance when the workbench - * is closed before the database has been updated. In this case some - * guesswork is applied using data from Mylyn. + * being properly updated. This can happen for instance when the workbench is + * closed before the database has been updated. In this case some guesswork is + * applied using data from Mylyn. */ private void cleanTaskActivities() { - //long ps = System.currentTimeMillis(); TypedQuery createQuery = entityManager.createQuery("SELECT tt FROM TRACKEDTASK tt", TrackedTask.class); List resultList = createQuery.getResultList(); for (TrackedTask trackedTask : resultList) { if (trackedTask.getCurrentActivity().isPresent()) { - ITask task = trackedTask.getTask() == null ? - TimekeeperPlugin.getDefault().getTask(trackedTask) : trackedTask.getTask(); + ITask task = trackedTask.getTask() == null ? TimekeeperPlugin.getDefault().getTask(trackedTask) + : trackedTask.getTask(); // note that the ITask may not exist in this workspace if (task != null && !task.isActive()) { // try to figure out when it was last active @@ -275,7 +278,7 @@ private void cleanTaskActivities() { } } } - } + } } @Override @@ -285,13 +288,12 @@ public void stop(BundleContext context) throws Exception { } super.stop(context); } - + /** - * Returns the {@link TrackedTask} associated with the given Mylyn task. If - * no such task exists it will be created. + * Returns the {@link TrackedTask} associated with the given Mylyn task. If no + * such task exists it will be created. * - * @param task - * the Mylyn task + * @param task the Mylyn task * @return a {@link TrackedTask} associated with the Mylyn task */ public TrackedTask getTask(ITask task) { @@ -308,39 +310,35 @@ public TrackedTask getTask(ITask task) { return tt; } else { return found; - } + } } - + /** - * Returns the {@link ITask} associated with the given {@link TrackedTask} task. If - * no such task exists null will be returned + * Returns the {@link ITask} associated with the given {@link TrackedTask} task. + * If no such task exists null will be returned * - * @param task - * the time tracked task + * @param task the time tracked task * @return a Mylyn task or null */ - public ITask getTask(TrackedTask task) { + public ITask getTask(TrackedTask task) { // get the repository then find the task. Seems like the Mylyn API is // a bit limited in this area as I could not find something more usable - Optional tr = TasksUi.getRepositoryManager().getAllRepositories() - .stream() - .filter(r -> r.getRepositoryUrl().equals(task.getRepositoryUrl())) - .findFirst(); + Optional tr = TasksUi.getRepositoryManager().getAllRepositories().stream() + .filter(r -> r.getRepositoryUrl().equals(task.getRepositoryUrl())).findFirst(); if (tr.isPresent()) { return TasksUi.getRepositoryModel().getTask(tr.get(), task.getTaskId()); } - return null; + return null; } - + /** * Exports Timekeeper related data to two separate CSV files. One for - * {@link TrackedTask}, another for {@link Activity} instances and yet - * another for the relations between these two. + * {@link TrackedTask}, another for {@link Activity} instances and yet another + * for the relations between these two. * * TODO: Compress into zip * - * @param path - * the path to the directory + * @param path the path to the directory * @throws IOException */ public int exportTo(Path path) throws IOException { @@ -353,15 +351,12 @@ public int exportTo(Path path) throws IOException { EntityTransaction transaction = entityManager.getTransaction(); transaction.begin(); int tasksExported = entityManager - .createNativeQuery("CALL CSVWRITE('"+tasks+"', 'SELECT * FROM TRACKEDTASK');") - .executeUpdate(); + .createNativeQuery("CALL CSVWRITE('" + tasks + "', 'SELECT * FROM TRACKEDTASK');").executeUpdate(); int activitiesExported = entityManager - .createNativeQuery("CALL CSVWRITE('"+activities+"', 'SELECT * FROM ACTIVITY');") - .executeUpdate(); + .createNativeQuery("CALL CSVWRITE('" + activities + "', 'SELECT * FROM ACTIVITY');").executeUpdate(); // relations are not automatically created, so we do this the easy way - entityManager - .createNativeQuery("CALL CSVWRITE('"+relations+"', 'SELECT * FROM TRACKEDTASK_ACTIVITY');") - .executeUpdate(); + entityManager.createNativeQuery("CALL CSVWRITE('" + relations + "', 'SELECT * FROM TRACKEDTASK_ACTIVITY');") + .executeUpdate(); transaction.commit(); return tasksExported + activitiesExported; } @@ -369,7 +364,7 @@ public int exportTo(Path path) throws IOException { /** * Import and merge records from the specified location. * - * @param path root location of the + * @param path root location of the * @return * @throws IOException */ @@ -377,42 +372,40 @@ public int importFrom(Path path) throws IOException { Path tasks = path.resolve("trackedtask.csv"); Path activities = path.resolve("activity.csv"); Path relations = path.resolve("trackedtask_activity.csv"); - if (!tasks.toFile().exists()){ + if (!tasks.toFile().exists()) { throw new IOException("'trackedtask.csv' does not exist in the specified location."); } - if (!activities.toFile().exists()){ + if (!activities.toFile().exists()) { throw new IOException("'activity.csv' does not exist in the specified location."); } - if (!relations.toFile().exists()){ + if (!relations.toFile().exists()) { throw new IOException("'trackedtask_activity.csv' does not exist in the specified location."); } EntityTransaction transaction = entityManager.getTransaction(); try { - transaction.begin(); + transaction.begin(); entityManager.createNativeQuery("SET REFERENTIAL_INTEGRITY FALSE;").executeUpdate(); int tasksImported = entityManager - .createNativeQuery("MERGE INTO TRACKEDTASK (SELECT * FROM CSVREAD('"+tasks+"'));") + .createNativeQuery("MERGE INTO TRACKEDTASK (SELECT * FROM CSVREAD('" + tasks + "'));") .executeUpdate(); int activitiesImported = entityManager - .createNativeQuery("MERGE INTO ACTIVITY (SELECT * FROM CSVREAD('"+activities+"'));") + .createNativeQuery("MERGE INTO ACTIVITY (SELECT * FROM CSVREAD('" + activities + "'));") .executeUpdate(); entityManager - .createNativeQuery("MERGE INTO TRACKEDTASK_ACTIVITY (SELECT * FROM CSVREAD('"+relations+"'));") - .executeUpdate(); - entityManager - .createNativeQuery("SET REFERENTIAL_INTEGRITY TRUE;") - .executeUpdate(); + .createNativeQuery("MERGE INTO TRACKEDTASK_ACTIVITY (SELECT * FROM CSVREAD('" + relations + "'));") + .executeUpdate(); + entityManager.createNativeQuery("SET REFERENTIAL_INTEGRITY TRUE;").executeUpdate(); transaction.commit(); - // update all instances with potentially new content + // update all instances with potentially new content TypedQuery createQuery = entityManager.createQuery("SELECT tt FROM TRACKEDTASK tt", TrackedTask.class); List resultList = createQuery.getResultList(); for (TrackedTask trackedTask : resultList) { entityManager.refresh(trackedTask); } - return tasksImported+activitiesImported; - } catch (PersistenceException e){ - transaction.rollback(); + return tasksImported + activitiesImported; + } catch (PersistenceException e) { + transaction.rollback(); throw new IOException(e.getMessage()); } } @@ -428,13 +421,12 @@ public int importFrom(Path path) throws IOException { * switches to the 'file' method. *

*

- * If the lock file exists, and the lock method is 'socket', then the - * process checks if the port is in use. If the original process is still - * running, the port is in use and this process throws an exception - * (database is in use). If the original process died (for example due to a - * power failure, or abnormal termination of the virtual machine), then the - * port was released. The new process deletes the lock file and starts - * again. + * If the lock file exists, and the lock method is 'socket', then the process + * checks if the port is in use. If the original process is still running, the + * port is in use and this process throws an exception (database is in use). If + * the original process died (for example due to a power failure, or abnormal + * termination of the virtual machine), then the port was released. The new + * process deletes the lock file and starts again. *

* * @return a connection URL string for the shared location @@ -456,7 +448,7 @@ public String getWorkspaceLocation() throws IOException { public String getSpecifiedLocation() { String jdbc_url; - jdbc_url = Platform.getPreferencesService().getString(BUNDLE_ID, PREF_DATABASE_URL, + jdbc_url = Platform.getPreferencesService().getString(BUNDLE_ID, PREF_DATABASE_URL, "jdbc:h2:tcp://localhost/~/.timekeeper/h2db", // note use server location per default new IScopeContext[] { InstanceScope.INSTANCE }); return jdbc_url; @@ -484,12 +476,11 @@ protected IStatus run(IProgressMonitor monitor) { }; } - + /** * Returns the name of the container holding the supplied task. * - * @param task - * task to find the name for + * @param task task to find the name for * @return the name of the task */ public static String getParentContainerSummary(AbstractTask task) { @@ -504,8 +495,7 @@ public static String getParentContainerSummary(AbstractTask task) { /** * Returns the project name for the task if it can be determined. * - * @param task - * the task to get the project name for + * @param task the task to get the project name for * @return the project name or "<undetermined>" */ public static String getProjectName(ITask task) { @@ -515,8 +505,8 @@ public static String getProjectName(ITask task) { case KIND_GITHUB: case KIND_LOCAL: return getParentContainerSummary((AbstractTask) task); - // Bugzilla and JIRA users may want to group on different - // values. + // Bugzilla and JIRA users may want to group on different + // values. case KIND_BUGZILLA: case KIND_JIRA: TaskData taskData = TasksUi.getTaskDataManager().getTaskData(task); @@ -543,7 +533,7 @@ public static String getProjectName(ITask task) { } return ""; } - + /** * Provides means of setting the {@link EntityManager} of the plug-in. This * method should only be used for testing. @@ -552,10 +542,10 @@ public static String getProjectName(ITask task) { * @see #start(BundleContext) * @see #connectToDatabase() */ - static void setEntityManager(EntityManager entityManager) { + static void setEntityManager(EntityManager entityManager) { TimekeeperPlugin.entityManager = entityManager; } - + /** * Returns a list of all report templates stored in the preferences. * diff --git a/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/TrackedTask.java b/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/TrackedTask.java index 0791776..e23899e 100644 --- a/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/TrackedTask.java +++ b/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/TrackedTask.java @@ -77,23 +77,22 @@ public class TrackedTask implements Serializable { @Convert(converter = LocalDateTimeAttributeConverter.class) @Column(name = "TICK") private LocalDateTime tick; - + @OneToMany(cascade = javax.persistence.CascadeType.ALL) private List activities; - + @Transient private ITask task; - + protected TrackedTask() { activities = new ArrayList<>(); } /** - * Creates a new tracked task and associates the instance with the given - * Mylyn task. + * Creates a new tracked task and associates the instance with the given Mylyn + * task. * - * @param task - * the associated Mylyn task + * @param task the associated Mylyn task */ public TrackedTask(ITask task) { this(); @@ -125,23 +124,23 @@ public void endActivity() { /** * Ends the current activity. * - * @param time - * the date and time the activity was ended + * @param time the date and time the activity was ended * @return the current activity * @see #startActivity() * @see #endActivity() */ public void endActivity(LocalDateTime time) { - if (currentActivity !=null) { + if (currentActivity != null) { synchronized (currentActivity) { currentActivity.setEnd(LocalDateTime.now()); currentActivity = null; } } } + /** - * Returns a list of all activities associated with this task. These may - * span over several days, months or be concentrated to one single day. + * Returns a list of all activities associated with this task. These may span + * over several days, months or be concentrated to one single day. * * @return */ @@ -160,27 +159,23 @@ public Optional getCurrentActivity() { /** * Returns the duration of work on this task at the given date. This is - * accumulated from all the recorded activities between 00:00 and 23:59 on - * that day. + * accumulated from all the recorded activities between 00:00 and 23:59 on that + * day. * - * @param date - * the date to get duration for + * @param date the date to get duration for * @return the total duration of work on the date */ public Duration getDuration(LocalDate date) { Duration total = Duration.ZERO; // sum up the duration - return getActivities() - .stream() - .map(a -> a.getDuration(date)) - .reduce(total, new BinaryOperator() { - @Override - public Duration apply(Duration t, Duration u) { - return t.plus(u); - } + return getActivities().stream().map(a -> a.getDuration(date)).reduce(total, new BinaryOperator() { + @Override + public Duration apply(Duration t, Duration u) { + return t.plus(u); + } }); } - + /** * Returns the last time the task was active and not idle * @@ -191,9 +186,9 @@ public LocalDateTime getTick() { } /** - * Migrates time tracking data from the Mylyn key-value store to the - * database. A new {@link TrackedTask} will be created and {@link Activity} - * instances for each of the days work has been done on the task. + * Migrates time tracking data from the Mylyn key-value store to the database. A + * new {@link TrackedTask} will be created and {@link Activity} instances for + * each of the days work has been done on the task. */ public void migrate() { ITask task = (this.task) == null ? TimekeeperPlugin.getDefault().getTask(this) : this.task; @@ -220,8 +215,7 @@ public void migrate() { /** * Associates given Mylyn Task with this instance. * - * @param task - * the Mylyn task + * @param task the Mylyn task */ void setTask(ITask task) { // associate this tracked task with the Mylyn task @@ -229,7 +223,7 @@ void setTask(ITask task) { taskId = task.getTaskId(); repositoryUrl = getRepositoryUrl(task); - // we have an old fashioned value here. migrate the old data + // we have an old fashioned value here. migrate the old data if (task.getAttribute(TimekeeperPlugin.KEY_VALUELIST_ID) != null) { try { migrate(); @@ -240,37 +234,36 @@ void setTask(ITask task) { } /** - * This method will return the repository URL for tasks in repositories that - * are not local. If the task is in a local repository, the Timekeeper - * repository identifier is returned if it exists. If it does not exist, it - * will be created, associated with the repository and returned. + * This method will return the repository URL for tasks in repositories that are + * not local. If the task is in a local repository, the Timekeeper repository + * identifier is returned if it exists. If it does not exist, it will be + * created, associated with the repository and returned. * - * @param task - * the task to get the repository URL for + * @param task the task to get the repository URL for * @return the repository URL or {@link UUID} */ public static String getRepositoryUrl(ITask task) { String url = task.getRepositoryUrl(); - if (LOCAL_REPO_ID.equals(task.getRepositoryUrl())){ + if (LOCAL_REPO_ID.equals(task.getRepositoryUrl())) { IRepositoryManager repositoryManager = TasksUi.getRepositoryManager(); if (repositoryManager == null) { // may happen during testing return LOCAL_REPO_ID; - } - TaskRepository repository = repositoryManager.getRepository(task.getConnectorKind(), task.getRepositoryUrl()); + } + TaskRepository repository = repositoryManager.getRepository(task.getConnectorKind(), + task.getRepositoryUrl()); String id = repository.getProperty(LOCAL_REPO_KEY_ID); if (id == null) { - id = TaskRepositoryManager.PREFIX_LOCAL+UUID.randomUUID().toString(); + id = TaskRepositoryManager.PREFIX_LOCAL + UUID.randomUUID().toString(); repository.setProperty(LOCAL_REPO_KEY_ID, id); } url = id; } return url; } - /** * Sets the last time the task was active while the user was not idle. - + * * @param tick the tick time */ public void setTick(LocalDateTime tick) { @@ -319,9 +312,9 @@ public String getTaskId() { } /** - * Returns the referenced {@link ITask} if available. If not, it can be - * obtained from {@link TimekeeperPlugin#getTask(TrackedTask)} which will - * examine the Mylyn task repository. + * Returns the referenced {@link ITask} if available. If not, it can be obtained + * from {@link TimekeeperPlugin#getTask(TrackedTask)} which will examine the + * Mylyn task repository. * * @return the {@link ITask} or null */ diff --git a/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/TrackedTaskId.java b/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/TrackedTaskId.java index 9457d53..495595e 100644 --- a/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/TrackedTaskId.java +++ b/net.resheim.eclipse.timekeeper.db/src/net/resheim/eclipse/timekeeper/db/TrackedTaskId.java @@ -25,8 +25,9 @@ public class TrackedTaskId implements Serializable { @Column(name = "TASK_ID") private String taskId; - - public TrackedTaskId(){} + + public TrackedTaskId() { + } public TrackedTaskId(String repositoryUrl, String taskId) { super(); @@ -40,14 +41,14 @@ public int hashCode() { int result = 1; result = result * prime + repositoryUrl.hashCode(); result = result * prime + taskId.hashCode(); - return result; + return result; } @Override public boolean equals(Object obj) { - if (obj instanceof TrackedTaskId){ - TrackedTaskId other = (TrackedTaskId)obj; - return other.getRepositoryUrl().equals(getRepositoryUrl()) && other.getTaskId().equals(getTaskId()); + if (obj instanceof TrackedTaskId) { + TrackedTaskId other = (TrackedTaskId) obj; + return other.getRepositoryUrl().equals(getRepositoryUrl()) && other.getTaskId().equals(getTaskId()); } return false; } @@ -56,7 +57,6 @@ public String getRepositoryUrl() { return repositoryUrl; } - public String getTaskId() { return taskId; } diff --git a/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/internal/idle/MacIdleTimeDetector.java b/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/internal/idle/MacIdleTimeDetector.java index 1f6adac..68f591d 100644 --- a/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/internal/idle/MacIdleTimeDetector.java +++ b/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/internal/idle/MacIdleTimeDetector.java @@ -23,19 +23,19 @@ /** * Instances of this class provide the computer idle time on a Mac system. + * * @author Laurent Cohen */ -public class MacIdleTimeDetector implements IdleTimeDetector -{ +public class MacIdleTimeDetector implements IdleTimeDetector { /** * Wraps the interactions with the native library. */ - public interface ApplicationServices extends Library - { + public interface ApplicationServices extends Library { /** * Wrapper for the native library. */ - ApplicationServices INSTANCE = (ApplicationServices) Native.loadLibrary("ApplicationServices", ApplicationServices.class); + ApplicationServices INSTANCE = (ApplicationServices) Native.loadLibrary("ApplicationServices", + ApplicationServices.class); /** * The type for any mouse or keyboard input event. */ @@ -54,9 +54,15 @@ public interface ApplicationServices extends Library int KCG_EVENT_SOURCE_STATE_COMBINED_SESSION_STATE = 0; /** - * Returns the elapsed time since the last event for a Quartz event source. - * @param sourceStateId the source state to access. - * @param eventType the event type to access. To get the elapsed time since the previous input event: keyboard, mouse, or tablet, specify KCG_ANY_INPUT_EVENT_TYPE. + * Returns the elapsed time since the last event for a Quartz event + * source. + * + * @param sourceStateId + * the source state to access. + * @param eventType + * the event type to access. To get the elapsed time since + * the previous input event: keyboard, mouse, or tablet, + * specify KCG_ANY_INPUT_EVENT_TYPE. * @return the elapsed seconds since the last input event. * @see http://developer.apple.com/mac/library/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html#//apple_ref/c/func/CGEventSourceSecondsSinceLastEventType */ @@ -67,10 +73,10 @@ public interface ApplicationServices extends Library * {@inheritDoc} */ @Override - public long getIdleTimeMillis() - { + public long getIdleTimeMillis() { double idleTimeSeconds = ApplicationServices.INSTANCE.CGEventSourceSecondsSinceLastEventType( - ApplicationServices.KCG_EVENT_SOURCE_STATE_COMBINED_SESSION_STATE, ApplicationServices.KCG_ANY_INPUT_EVENT_TYPE); + ApplicationServices.KCG_EVENT_SOURCE_STATE_COMBINED_SESSION_STATE, + ApplicationServices.KCG_ANY_INPUT_EVENT_TYPE); return (long) (idleTimeSeconds * 1000); } } diff --git a/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/internal/idle/WindowsIdleTimeDetector.java b/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/internal/idle/WindowsIdleTimeDetector.java index 59e51e2..9f72286 100644 --- a/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/internal/idle/WindowsIdleTimeDetector.java +++ b/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/internal/idle/WindowsIdleTimeDetector.java @@ -27,15 +27,14 @@ /** * Instances of this class provide the computer idle time on a Windows system. + * * @author Laurent Cohen */ -public class WindowsIdleTimeDetector implements IdleTimeDetector -{ +public class WindowsIdleTimeDetector implements IdleTimeDetector { /** * LastInputInfo structure definition. */ - public static class LastInputInfo extends Structure - { + public static class LastInputInfo extends Structure { /** * The size of this structure. */ @@ -55,15 +54,17 @@ protected List getFieldOrder() { /** * Wrapper for JNI calls to the user32 Windows library. */ - public interface User32 extends Library - { + public interface User32 extends Library { /** * Instance of the User32 library bindings. */ User32 INSTANCE = (User32) Native.loadLibrary("user32", User32.class); + /** * Query the time of last activity. - * @param info the structure in which the last activity time is stored. + * + * @param info + * the structure in which the last activity time is stored. * @return BOOL return code. */ int GetLastInputInfo(LastInputInfo info); @@ -72,17 +73,19 @@ public interface User32 extends Library /** * Wrapper for JNI calls to the kernel32 Windows library. */ - public interface Kernel32 extends Library - { + public interface Kernel32 extends Library { /** * Wrapper for the native library. */ Kernel32 INSTANCE = (Kernel32) Native.loadLibrary("kernel32", Kernel32.class); /** - * Retrieves the number of milliseconds that have elapsed since the system was started. + * Retrieves the number of milliseconds that have elapsed since the + * system was started. + * * @see http://msdn2.microsoft.com/en-us/library/ms724408.aspx - * @return number of milliseconds that have elapsed since the system was started. + * @return number of milliseconds that have elapsed since the system was + * started. */ int GetTickCount(); } @@ -91,8 +94,7 @@ public interface Kernel32 extends Library * {@inheritDoc} */ @Override - public long getIdleTimeMillis() - { + public long getIdleTimeMillis() { LastInputInfo lastInputInfo = new LastInputInfo(); User32.INSTANCE.GetLastInputInfo(lastInputInfo); return Kernel32.INSTANCE.GetTickCount() - lastInputInfo.dwTime; diff --git a/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/internal/idle/X11IdleTimeDetector.java b/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/internal/idle/X11IdleTimeDetector.java index da7c50d..60bda4c 100644 --- a/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/internal/idle/X11IdleTimeDetector.java +++ b/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/internal/idle/X11IdleTimeDetector.java @@ -37,13 +37,11 @@ * @author Laurent Cohen * @author Torkild U. Resheim - minor adjustments to suit Eclipse Timekeeper */ -public class X11IdleTimeDetector implements IdleTimeDetector -{ +public class X11IdleTimeDetector implements IdleTimeDetector { /** * Structure providing info on the XScreensaver. */ - public static class XScreenSaverInfo extends Structure - { + public static class XScreenSaverInfo extends Structure { /** * screen saver window */ @@ -79,8 +77,7 @@ protected List getFieldOrder() { /** * Definition (incomplete) of the Xext library. */ - public interface Xss extends Library - { + public interface Xss extends Library { /** * Instance of the Xext library bindings. */ @@ -88,30 +85,33 @@ public interface Xss extends Library /** * Allocate a XScreensaver information structure. + * * @return a {@link XScreenSaverInfo} instance. */ XScreenSaverInfo XScreenSaverAllocInfo(); /** * Query the XScreensaver. - * @param display the display. - * @param drawable a {@link Drawable} structure. - * @param saver_info a previously allocated {@link XScreenSaverInfo} instance. + * + * @param display + * the display. + * @param drawable + * a {@link Drawable} structure. + * @param saver_info + * a previously allocated {@link XScreenSaverInfo} instance. * @return an int return code. */ int XScreenSaverQueryInfo(Display display, Drawable drawable, XScreenSaverInfo saver_info); } @Override - public long getIdleTimeMillis() - { + public long getIdleTimeMillis() { X11.Window window = null; XScreenSaverInfo info = null; Display display = null; long idleMillis = 0L; - try - { + try { display = X11.INSTANCE.XOpenDisplay(null); if (display == null) { display = X11.INSTANCE.XOpenDisplay(":0.0"); @@ -123,13 +123,9 @@ public long getIdleTimeMillis() info = new XScreenSaverInfo(); Xss.INSTANCE.XScreenSaverQueryInfo(display, window, info); idleMillis = info.idle.longValue(); - } - catch(UnsatisfiedLinkError e) - { + } catch (UnsatisfiedLinkError e) { throw new RuntimeException(e.getMessage(), e); - } - finally - { + } finally { info = null; if (display != null) { X11.INSTANCE.XCloseDisplay(display); diff --git a/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/ui/TimekeeperUiPlugin.java b/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/ui/TimekeeperUiPlugin.java index 4c33112..ceb7f43 100644 --- a/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/ui/TimekeeperUiPlugin.java +++ b/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/ui/TimekeeperUiPlugin.java @@ -82,10 +82,10 @@ public static TimekeeperUiPlugin getDefault() { @Override protected void initializeImageRegistry(ImageRegistry reg) { - reg.put(OBJ_ACTIVITY, ImageDescriptor - .createFromURL(BundleUtility.find(getBundle(), "icons/full/eview/activity_obj.png"))); - reg.put(IMG_TOOL_CURRENT, ImageDescriptor - .createFromURL(BundleUtility.find(getBundle(), "icons/full/elcl/cur_nav.png"))); + reg.put(OBJ_ACTIVITY, + ImageDescriptor.createFromURL(BundleUtility.find(getBundle(), "icons/full/eview/activity_obj.png"))); + reg.put(IMG_TOOL_CURRENT, + ImageDescriptor.createFromURL(BundleUtility.find(getBundle(), "icons/full/elcl/cur_nav.png"))); } /** Platform specific idle time detector. */ @@ -180,7 +180,8 @@ private void handleReactivation(long idleTimeMillis) { "Disregard idle time?", null, MessageFormat.format( "The computer has been idle since {0}, more than {1}. Stop current activity and set end time to last active time? A new activity will be started from now.", - lastActive.format(DateTimeFormatter.ofPattern("EEE e, HH:mm:ss", Locale.US)), time), + lastActive.format(DateTimeFormatter.ofPattern("EEE e, HH:mm:ss", Locale.US)), + time), MessageDialog.QUESTION, new String[] { "No", "Yes" }, 1); int open = md.open(); dialogIsOpen = false; @@ -201,8 +202,8 @@ private void handleReactivation(long idleTimeMillis) { "Activity automatically stopped", MessageFormat.format( "You have been away for too long ({0}) and tracking of the current activity was automatically ended on {1}.", - duration, - lastActive.format(DateTimeFormatter.ofPattern("EEE e, HH:mm:ss", Locale.US)))); + duration, lastActive.format( + DateTimeFormatter.ofPattern("EEE e, HH:mm:ss", Locale.US)))); } } } diff --git a/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/ui/commands/DefaultTemplateToClipboardHandler.java b/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/ui/commands/DefaultTemplateToClipboardHandler.java index 532d1f2..6a32187 100644 --- a/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/ui/commands/DefaultTemplateToClipboardHandler.java +++ b/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/ui/commands/DefaultTemplateToClipboardHandler.java @@ -71,7 +71,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException { * {@link TextTransfer}. * * @param template - * the report template + * the report template * @return the transfer type */ private ByteArrayTransfer getTransfer(ReportTemplate template) { diff --git a/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/ui/export/TemplateExportMenu.java b/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/ui/export/TemplateExportMenu.java index 74dacb7..33601d1 100644 --- a/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/ui/export/TemplateExportMenu.java +++ b/net.resheim.eclipse.timekeeper.ui/src/net/resheim/eclipse/timekeeper/ui/export/TemplateExportMenu.java @@ -30,7 +30,7 @@ * Creates a menu for exporting data from the currently week to various formats * determined by the actual templates available. There are two sub-menus, one * for saving to a file and another for copying to the paste buffer. - * + * * @author Torkild U. Resheim */ public class TemplateExportMenu extends ExtensionContributionFactory { @@ -58,11 +58,9 @@ private void addToMenu(IServiceLocator serviceLocator, IMenuManager menu, String Map parameters = new HashMap<>(); parameters.put(TemplateExportHandler.COMMAND_PARAMETER_TEMPLATE_NAME, name); parameters.put(TemplateExportHandler.COMMAND_PARAMETER_FILE, Boolean.toString(file)); - CommandContributionItemParameter contributionParameters = - new CommandContributionItemParameter(serviceLocator, null, - COMMAND_ID, - parameters, null, null, null, name, null, null, - CommandContributionItem.STYLE_PUSH, null, false); + CommandContributionItemParameter contributionParameters = new CommandContributionItemParameter(serviceLocator, + null, COMMAND_ID, parameters, null, null, null, name, null, null, CommandContributionItem.STYLE_PUSH, + null, false); menu.add(new CommandContributionItem(contributionParameters)); } From 8a6504ef7dd17402e7ce74f8a8abc20ad0867f53 Mon Sep 17 00:00:00 2001 From: "Torkild U. Resheim" Date: Wed, 2 Oct 2019 15:28:28 +0200 Subject: [PATCH 3/4] Update target platform --- default.target | 28 ++++++++++++++-------------- default.tpd | 14 +++++++------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/default.target b/default.target index f6edd83..1f4d742 100644 --- a/default.target +++ b/default.target @@ -1,19 +1,19 @@ - - + + - - - - + + + + - + - + @@ -30,7 +30,7 @@ - + @@ -40,22 +40,22 @@ - - - + + + - + - + diff --git a/default.tpd b/default.tpd index 831fc28..1aa61cb 100644 --- a/default.tpd +++ b/default.tpd @@ -1,7 +1,7 @@ target "Eclipse Timekeeper Target Platform" with source requirements // Base dependencies -location "http://download.eclipse.org/releases/2019-06/" { +location "http://download.eclipse.org/releases/2019-09/" { org.eclipse.equinox.p2.sdk.feature.group org.eclipse.sdk.feature.group org.eclipse.pde.core @@ -22,8 +22,8 @@ location "http://download.eclipse.org/technology/swtbot/releases/2.8.0/" { org.hamcrest.core } -// Mylyn bits, 2019-6-28 release for Eclipse 4.11 and 4.12 -location "https://download.eclipse.org/mylyn/releases/3.25/" { +// Mylyn bits +location "https://download.eclipse.org/mylyn/releases/latest/" { org.eclipse.mylyn.tasks.core org.eclipse.mylyn.tasks.ui org.apache.commons.lang @@ -39,7 +39,7 @@ location "http://update.atlassian.com/atlassian-eclipse-plugin/rest/e3.7/" { } // EclipseLink for persistence -// 2.7.3 appears to be broken, +// 2.7.3 appears to be broken so the nightly builds are used location "https://download.eclipse.org/rt/eclipselink/nightly-updates/" { javax.persistence javax.activation @@ -50,11 +50,11 @@ location "https://download.eclipse.org/rt/eclipselink/nightly-updates/" { org.eclipse.persistence.asm [6.2.0,7.0.0) } -location "https://download.eclipse.org/gemini/jpa/updates/1.2.0-M1" { - org.eclipse.gemini.jpa +location "https://download.eclipse.org/gemini/jpa/updates/" { + org.eclipse.gemini.jpa [1.2.0,2.0.0) } -location "http://download.eclipse.org/tools/orbit/downloads/drops/I20190602181010/repository" { +location "https://download.eclipse.org/tools/orbit/downloads/drops/R20190827152740/repository" { org.slf4j.api ch.qos.logback.slf4j ch.qos.logback.classic From 284e671a80b70ad4b82099005a65ac5b197a9f0e Mon Sep 17 00:00:00 2001 From: "Torkild U. Resheim" Date: Wed, 2 Oct 2019 15:40:27 +0200 Subject: [PATCH 4/4] Fix #143: Configure project for Sonar Cloud Task-Url: https://github.com/turesheim/eclipse-timekeeper/issues/143 --- .settings/org.eclipse.core.resources.prefs | 2 ++ .travis.yml | 14 ++++++++-- net.resheim.eclipse.timekeeper-site/pom.xml | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 2 ++ pom.xml | 6 ++--- sonar-project.properties | 27 +++++++++++++++++++ 6 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 .settings/org.eclipse.core.resources.prefs create mode 100644 sonar-project.properties diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/.travis.yml b/.travis.yml index 7f6294a..2e7b109 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,21 @@ language: java -sudo: false -script: mvn clean verify -Pskip-ui-tests +dist: trusty +sudo: required + +# UI-tests will only run on macOS, so we skip these here +script: + - mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent verify -Pskip-ui-tests -Dtycho.localArtifacts=ignore + - sonar-scanner jdk: - openjdk8 cache: directories: - $HOME/.m2 +addons: + sonarcloud: + organization: "turesheim-github" + token: + secure: "ASUilEjJT5fYjMN6Cy5gVeY1fuKiIwEKLX9sxPltAowFABpzzimgLy+Ytbvh1GLsqnCXtVOYSkcClpNHezkuJwVMopj/IQiVl3cB9Qm3BySCgsQVPWHy2+DZ/sMMVMoVdtiQaycP3a8GY3tbi6Wofbb090vmPHNcn13AWEWXOBA=" deploy: # Deploy to GitHub releases if the master branch has been tagged provider: releases diff --git a/net.resheim.eclipse.timekeeper-site/pom.xml b/net.resheim.eclipse.timekeeper-site/pom.xml index 68a27aa..b24992e 100644 --- a/net.resheim.eclipse.timekeeper-site/pom.xml +++ b/net.resheim.eclipse.timekeeper-site/pom.xml @@ -11,7 +11,7 @@ net.resheim.eclipse.timekeeper-site - Eclipse Timekeeper p2 Repository + Timekeeper for Eclipse p2 Repository eclipse-repository diff --git a/net.resheim.eclipse.timekeeper.db/.settings/org.eclipse.jdt.core.prefs b/net.resheim.eclipse.timekeeper.db/.settings/org.eclipse.jdt.core.prefs index 91ca62e..8b5c4dc 100644 --- a/net.resheim.eclipse.timekeeper.db/.settings/org.eclipse.jdt.core.prefs +++ b/net.resheim.eclipse.timekeeper.db/.settings/org.eclipse.jdt.core.prefs @@ -8,7 +8,9 @@ org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore org.eclipse.jdt.core.compiler.release=disabled org.eclipse.jdt.core.compiler.source=1.8 diff --git a/pom.xml b/pom.xml index 0568b17..576619a 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,6 @@