/** * The Method will be called if detected some error. * @param text text message * @param error error object * * @since 1.0 */ @Weight (Weight.Unit.LIGHT) void onDetectedError (@Nullable String text, @Nonnull Throwable error); }
@Weight(Weight.Unit.NORMAL) @Nonnull TabTitle getTabTitle();
@Weight(Weight.Unit.LIGHT) @Nonnull JComponent getMainComponent();
/** * Cancel all defer actions globally. * * @since 1.0 */ @Weight(Weight.Unit.NORMAL) public static void cancelAllDeferredActionsGlobally() { final List<Deferred> list = REGISTRY.get(); list.clear(); REGISTRY.remove(); }
/** * Get the stack call depth for the caller. * @return the caller method stack depth. * @since 1.0 */ @Weight (Weight.Unit.VARIABLE) public static int stackDepth () { return Thread.currentThread().getStackTrace().length - 1; } }
@Weight(Weight.Unit.NORMAL) void onDeleteTopic(@Nonnull final MindMapPanel panel, @Nonnull final Topic topic);
/** * Just suspend the current thread for defined interval in milliseconds. * @param milliseconds milliseconds to sleep * @return false if the sleep has been interrupted by InterruptedException, true otherwise. * @see Thread#sleep(long) * @since 1.0 */ @Weight(Weight.Unit.VARIABLE) public static boolean silentSleep(final long milliseconds) { boolean result = true; try{ Thread.sleep(milliseconds); }catch(InterruptedException ex){ result = false; } return result; }
/** * Interface for any object to be informed about time alerts. * * @since 1.0 */ @ThreadSafe @Weight(Weight.Unit.EXTRALIGHT) public interface TimeAlertListener extends Serializable { /** * Process time. * * @param detectedTimeDelayInMilliseconds detected time delay in milliseconds * @param timeData data container contains initial parameters. * @since 1.0 */ void onTimeAlert(long detectedTimeDelayInMilliseconds, @Nonnull TimeData timeData); }
/** * Cancel all time watchers and time points globally for the current thread. * * @see #cancel() * @since 1.0 */ @Weight(Weight.Unit.NORMAL) public static void cancelAll() { final List<TimeData> list = REGISTRY.get(); list.clear(); REGISTRY.remove(); }
/** * Get the stack element of the method caller. * @return the stack trace element for the calling method. * @since 1.0 */ @Weight (Weight.Unit.VARIABLE) @Nonnull public static StackTraceElement stackElement () { final StackTraceElement[] allElements = Thread.currentThread().getStackTrace(); return allElements[2]; }
/** * Check that the thread local for the current thread contains time points or watchers. * * @return true if the thread local storage is empty, false otherwise */ @Weight(value = Weight.Unit.NORMAL, comment = "May create list in thread local storage") public static boolean isEmpty() { final boolean result = REGISTRY.get().isEmpty(); if (result) { REGISTRY.remove(); } return result; } }
/** * Auxiliary interface describing disposable object. * * @since 1.0 */ @ThreadSafe @Weight (Weight.Unit.VARIABLE) public interface Disposable { /** * Check that the object is disposed. * @return true if the object is disposed * @since 1.0 */ boolean isDisposed (); /** * Dispose object. * @since 1.0 */ void dispose (); }
/** * Check that presented defer actions for the current thread. * * @return true if presented, false otherwise * @since 1.0 */ @Weight(Weight.Unit.NORMAL) public static boolean isEmpty() { final boolean result = REGISTRY.get().isEmpty(); if (result) { REGISTRY.remove(); } return result; } }
/** * Defer some action. * * @param deferred action to be defer. * @return the same object from arguments * @since 1.0 */ @Weight(Weight.Unit.NORMAL) public static Deferred defer(@Nonnull final Deferred deferred) { REGISTRY.get().add(assertNotNull(deferred)); return deferred; }
@Weight(Weight.Unit.VARIABLE) public abstract static class Deferred implements Serializable {
@Weight(Weight.Unit.LIGHT) @Nullable JMenuItem makeMenuItem( @Nonnull MindMapPanel panel, @Nonnull DialogProvider dialogProvider, @Nullable Topic topic, @Nullable @MustNotContainNull Topic[] selectedTopics, @Nullable CustomJob customProcessor);
/** * Send notifications to all listeners. * @param text message text * @param error error object * @since 1.0 */ @Weight(Weight.Unit.VARIABLE) public static void fireError (@Nonnull final String text, @Nonnull final Throwable error) { for(final MetaErrorListener p : ERROR_LISTENERS){ p.onDetectedError(text, error); } } }
/** * The Constructor. * * @since 1.0 */ @Weight(value = Weight.Unit.VARIABLE, comment = "Depends on the current call stack depth@") public Deferred() { this.stackDepth = ThreadUtils.stackDepth() - 1; }
/** * Get name of attribute key associated with the plug-in. * * @return the array of language names (case sensitive) */ @Nonnull @MustNotContainNull @Weight(Weight.Unit.EXTRALIGHT) String[] getProcessingLanguageNames(); }
/** * Closing quetly any closeable object. Any exception will be caught (but global error listeners will be notified) * * @param closeable object to be closed quetly * @return the same object provided in args * @since 1.0 */ @Weight(Weight.Unit.LIGHT) @Nullable public static Closeable closeQuetly(@Nullable final Closeable closeable) { if (closeable != null) { try { closeable.close(); } catch (Exception ex) { MetaErrorListeners.fireError("Exception in closeQuetly", ex); } } return closeable; } }