From f1cba0b77752ab48511b19ee30f2ddab5d7a755f Mon Sep 17 00:00:00 2001 From: Martin Fleck Date: Wed, 19 Jun 2024 10:23:14 +0000 Subject: [PATCH] Improve customizability through more protected methods and fields (#236) --- .../example/workflow/WorkflowGLSPServer.java | 4 ++-- .../workflow/handler/LogActionHandler.java | 6 +++--- .../WorkflowRequestContextActionsHandler.java | 4 ++-- .../glsp/graph/gson/EMapTypeAdapter.java | 4 ++-- .../graph/gson/EObjectExclusionStrategy.java | 8 ++++---- .../glsp/graph/gson/EnumTypeAdapter.java | 10 +++++----- .../graph/gson/GModelElementTypeAdapter.java | 4 ++-- .../graph/impl/GModelChangeNotifierImpl.java | 14 ++++++------- .../glsp/graph/impl/GModelIndexImpl.java | 8 ++++---- .../glsp/server/emf/EMFModelStateImpl.java | 2 +- .../server/emf/EMFSourceModelStorage.java | 2 +- .../EMFChangeBoundsOperationHandler.java | 4 ++-- .../websocket/WebsocketServerLauncher.java | 2 +- .../RequestEditValidationHandler.java | 2 +- .../directediting/ValidationStatus.java | 2 +- .../navigation/JsonOpenerOptions.java | 2 +- .../ResolveNavigationTargetActionHandler.java | 2 +- .../sourcemodelwatcher/FileWatcher.java | 20 +++++++++---------- .../undoredo/UndoRedoActionHandler.java | 2 +- .../validation/RequestMarkersHandler.java | 2 +- .../GModelChangeBoundsOperationHandler.java | 2 +- .../gmodel/GModelDeleteOperationHandler.java | 2 +- .../gmodel/GModelPasteOperationHandler.java | 2 +- .../glsp/server/gmodel/GModelStorage.java | 2 +- .../actions/DefaultActionDispatcher.java | 6 +++--- .../commandstack/GModelCommandStack.java | 2 +- .../commandstack/GModelRecordingCommand.java | 2 +- .../server/internal/util/ReflectionUtil.java | 2 +- .../eclipse/glsp/server/launch/CLIParser.java | 2 +- .../server/launch/GLSPServerLauncher.java | 2 +- .../launch/SocketGLSPServerLauncher.java | 2 +- .../server/protocol/DefaultGLSPServer.java | 2 +- .../eclipse/glsp/server/utils/Debouncer.java | 16 +++++++-------- .../eclipse/glsp/server/utils/LaunchUtil.java | 2 +- .../glsp/server/utils/MessageActionUtil.java | 6 +++--- 35 files changed, 78 insertions(+), 78 deletions(-) diff --git a/examples/org.eclipse.glsp.example.workflow/src/org/eclipse/glsp/example/workflow/WorkflowGLSPServer.java b/examples/org.eclipse.glsp.example.workflow/src/org/eclipse/glsp/example/workflow/WorkflowGLSPServer.java index c0e1bcd1..3bbea9cc 100644 --- a/examples/org.eclipse.glsp.example.workflow/src/org/eclipse/glsp/example/workflow/WorkflowGLSPServer.java +++ b/examples/org.eclipse.glsp.example.workflow/src/org/eclipse/glsp/example/workflow/WorkflowGLSPServer.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2019-2022 EclipseSource and others. + * Copyright (c) 2019-2024 EclipseSource and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -27,7 +27,7 @@ import org.eclipse.glsp.server.utils.MapUtil; public class WorkflowGLSPServer extends DefaultGLSPServer { - private static final Logger LOGGER = LogManager.getLogger(WorkflowGLSPServer.class); + protected static final Logger LOGGER = LogManager.getLogger(WorkflowGLSPServer.class); private static final String MESSAGE_KEY = "message"; private static final String TIMESTAMP_KEY = "timestamp"; diff --git a/examples/org.eclipse.glsp.example.workflow/src/org/eclipse/glsp/example/workflow/handler/LogActionHandler.java b/examples/org.eclipse.glsp.example.workflow/src/org/eclipse/glsp/example/workflow/handler/LogActionHandler.java index fdca1505..4d53b213 100644 --- a/examples/org.eclipse.glsp.example.workflow/src/org/eclipse/glsp/example/workflow/handler/LogActionHandler.java +++ b/examples/org.eclipse.glsp.example.workflow/src/org/eclipse/glsp/example/workflow/handler/LogActionHandler.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2020-2022 EclipseSource and others. + * Copyright (c) 2020-2024 EclipseSource and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -27,7 +27,7 @@ import org.eclipse.glsp.server.types.Severity; public class LogActionHandler extends AbstractActionHandler { - private static Logger LOGGER = LogManager.getLogger(LogActionHandler.class); + protected static Logger LOGGER = LogManager.getLogger(LogActionHandler.class); @Override protected List executeAction(final LogAction action) { @@ -35,7 +35,7 @@ protected List executeAction(final LogAction action) { return Collections.emptyList(); } - private static Level toLevel(final Severity severity) { + public static Level toLevel(final Severity severity) { return Level.toLevel(severity.toString(), Level.DEBUG); } diff --git a/examples/org.eclipse.glsp.example.workflow/src/org/eclipse/glsp/example/workflow/handler/WorkflowRequestContextActionsHandler.java b/examples/org.eclipse.glsp.example.workflow/src/org/eclipse/glsp/example/workflow/handler/WorkflowRequestContextActionsHandler.java index 1b045fb8..bcba6801 100644 --- a/examples/org.eclipse.glsp.example.workflow/src/org/eclipse/glsp/example/workflow/handler/WorkflowRequestContextActionsHandler.java +++ b/examples/org.eclipse.glsp.example.workflow/src/org/eclipse/glsp/example/workflow/handler/WorkflowRequestContextActionsHandler.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2020-2021 EclipseSource and others. + * Copyright (c) 2020-2024 EclipseSource and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -37,7 +37,7 @@ public List executeAction(final RequestContextActions action) { return actions; } - private LogAction createLogAction(final RequestContextActions request, final SetContextActions response) { + protected LogAction createLogAction(final RequestContextActions request, final SetContextActions response) { return new LogAction(Severity.OK, "create " + response.getActions().size() + " server actions for " + request.getContextId() + "."); } diff --git a/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/gson/EMapTypeAdapter.java b/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/gson/EMapTypeAdapter.java index ef57bf6d..9e5d0ed2 100644 --- a/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/gson/EMapTypeAdapter.java +++ b/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/gson/EMapTypeAdapter.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2019 EclipseSource and others. + * Copyright (c) 2019-2024 EclipseSource and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -35,7 +35,7 @@ */ public class EMapTypeAdapter extends TypeAdapter> { - private final Gson gson; + protected final Gson gson; public static class Factory implements TypeAdapterFactory { diff --git a/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/gson/EObjectExclusionStrategy.java b/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/gson/EObjectExclusionStrategy.java index b9fe6268..3d52cce2 100644 --- a/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/gson/EObjectExclusionStrategy.java +++ b/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/gson/EObjectExclusionStrategy.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2019-2023 EclipseSource and others. + * Copyright (c) 2019-2024 EclipseSource and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -57,15 +57,15 @@ public static boolean excludeField(final Field field) { return new EObjectExclusionStrategy().shouldSkipField(attributes); } - private static boolean isInnerClass(final Class clazz) { + protected static boolean isInnerClass(final Class clazz) { return clazz.isMemberClass() && !isStatic(clazz); } - private static boolean isStatic(final Class clazz) { + protected static boolean isStatic(final Class clazz) { return (clazz.getModifiers() & Modifier.STATIC) != 0; } - private static boolean isAnonymousOrNonStaticLocal(final Class clazz) { + protected static boolean isAnonymousOrNonStaticLocal(final Class clazz) { return !Enum.class.isAssignableFrom(clazz) && !isStatic(clazz) && (clazz.isAnonymousClass() || clazz.isLocalClass()); } diff --git a/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/gson/EnumTypeAdapter.java b/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/gson/EnumTypeAdapter.java index 03ee6e23..1de9604c 100644 --- a/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/gson/EnumTypeAdapter.java +++ b/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/gson/EnumTypeAdapter.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2019 EclipseSource and others. + * Copyright (c) 2019-2024 EclipseSource and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -54,11 +54,11 @@ public TypeAdapter create(final Gson gson, final TypeToken typeToken) } - private static String VALUE_FIELD_NAME = "value"; + protected static String VALUE_FIELD_NAME = "value"; - private final Map nameToConstant = new HashMap<>(); - private final Map valueToConstant = new HashMap<>(); - private final Map constantToValue = new HashMap<>(); + protected final Map nameToConstant = new HashMap<>(); + protected final Map valueToConstant = new HashMap<>(); + protected final Map constantToValue = new HashMap<>(); EnumTypeAdapter(final Class classOfT) throws IllegalAccessException { try { diff --git a/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/gson/GModelElementTypeAdapter.java b/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/gson/GModelElementTypeAdapter.java index 43a94669..a76d559e 100644 --- a/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/gson/GModelElementTypeAdapter.java +++ b/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/gson/GModelElementTypeAdapter.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2019-2023 EclipseSource and others. + * Copyright (c) 2019-2024 EclipseSource and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -44,7 +44,7 @@ public class GModelElementTypeAdapter extends PropertyBasedTypeAdapter { - private static final Logger LOGGER = LogManager.getLogger(GModelElementTypeAdapter.class); + protected static final Logger LOGGER = LogManager.getLogger(GModelElementTypeAdapter.class); private final Gson gson; private final Map typeMap; diff --git a/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/impl/GModelChangeNotifierImpl.java b/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/impl/GModelChangeNotifierImpl.java index ac35d837..006097be 100644 --- a/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/impl/GModelChangeNotifierImpl.java +++ b/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/impl/GModelChangeNotifierImpl.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2019 EclipseSource and others. + * Copyright (c) 2019-2024 EclipseSource and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -26,30 +26,30 @@ public class GModelChangeNotifierImpl extends EContentAdapter implements GModelChangeNotifier { - private List listeners = new CopyOnWriteArrayList<>(); + protected List listeners = new CopyOnWriteArrayList<>(); - public GModelChangeNotifierImpl(EObject target) { + public GModelChangeNotifierImpl(final EObject target) { target.eAdapters().add(this); } @Override - public void notifyChanged(Notification notification) { + public void notifyChanged(final Notification notification) { super.notifyChanged(notification); listeners.forEach(listener -> listener.notifyChanged(notification)); } @Override - public void addListener(GModelListener listener) { + public void addListener(final GModelListener listener) { listeners.add(listener); } @Override - public void removeListener(GModelListener listener) { + public void removeListener(final GModelListener listener) { listeners.remove(listener); } @Override - public boolean isAdapterForType(Object type) { + public boolean isAdapterForType(final Object type) { return GModelChangeNotifierImpl.class.equals(type); } diff --git a/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/impl/GModelIndexImpl.java b/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/impl/GModelIndexImpl.java index be5f646e..d7060e33 100644 --- a/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/impl/GModelIndexImpl.java +++ b/plugins/org.eclipse.glsp.graph/src/org/eclipse/glsp/graph/impl/GModelIndexImpl.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2019-2021 EclipseSource and others. + * Copyright (c) 2019-2024 EclipseSource and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -49,9 +49,9 @@ */ public class GModelIndexImpl extends ECrossReferenceAdapter implements GModelIndex { - private final Map idToElement = new HashMap<>(); - private final Map> typeToElements = new HashMap<>(); - private final GModelElement root; + protected final Map idToElement = new HashMap<>(); + protected final Map> typeToElements = new HashMap<>(); + protected final GModelElement root; public GModelIndexImpl(final EObject target) { Preconditions.checkArgument(target instanceof GModelElement); diff --git a/plugins/org.eclipse.glsp.server.emf/src/org/eclipse/glsp/server/emf/EMFModelStateImpl.java b/plugins/org.eclipse.glsp.server.emf/src/org/eclipse/glsp/server/emf/EMFModelStateImpl.java index 0cfb1097..89e49df4 100644 --- a/plugins/org.eclipse.glsp.server.emf/src/org/eclipse/glsp/server/emf/EMFModelStateImpl.java +++ b/plugins/org.eclipse.glsp.server.emf/src/org/eclipse/glsp/server/emf/EMFModelStateImpl.java @@ -45,7 +45,7 @@ @Singleton public class EMFModelStateImpl extends DefaultGModelState implements EMFModelState, ClientSessionListener { - private static Logger LOGGER = LogManager.getLogger(EMFModelStateImpl.class.getSimpleName()); + protected static Logger LOGGER = LogManager.getLogger(EMFModelStateImpl.class.getSimpleName()); @Inject protected ClientSessionManager clientSessionManager; diff --git a/plugins/org.eclipse.glsp.server.emf/src/org/eclipse/glsp/server/emf/EMFSourceModelStorage.java b/plugins/org.eclipse.glsp.server.emf/src/org/eclipse/glsp/server/emf/EMFSourceModelStorage.java index 5b24f3cf..e2085f93 100644 --- a/plugins/org.eclipse.glsp.server.emf/src/org/eclipse/glsp/server/emf/EMFSourceModelStorage.java +++ b/plugins/org.eclipse.glsp.server.emf/src/org/eclipse/glsp/server/emf/EMFSourceModelStorage.java @@ -42,7 +42,7 @@ */ public class EMFSourceModelStorage implements SourceModelStorage { - private static Logger LOGGER = LogManager.getLogger(EMFSourceModelStorage.class.getSimpleName()); + protected static Logger LOGGER = LogManager.getLogger(EMFSourceModelStorage.class.getSimpleName()); @Inject protected EMFModelState modelState; diff --git a/plugins/org.eclipse.glsp.server.emf/src/org/eclipse/glsp/server/emf/notation/EMFChangeBoundsOperationHandler.java b/plugins/org.eclipse.glsp.server.emf/src/org/eclipse/glsp/server/emf/notation/EMFChangeBoundsOperationHandler.java index dac04575..75143ec5 100644 --- a/plugins/org.eclipse.glsp.server.emf/src/org/eclipse/glsp/server/emf/notation/EMFChangeBoundsOperationHandler.java +++ b/plugins/org.eclipse.glsp.server.emf/src/org/eclipse/glsp/server/emf/notation/EMFChangeBoundsOperationHandler.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2022 EclipseSource and others. + * Copyright (c) 2022-2024 EclipseSource and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -54,7 +54,7 @@ public Optional createCommand(final ChangeBoundsOperation operation) { return compoundCommand.getCommandList().isEmpty() ? Optional.empty() : Optional.of(compoundCommand); } - private List updateShape(final EditingDomain editingDomain, final Shape shape, + protected List updateShape(final EditingDomain editingDomain, final Shape shape, final ElementAndBounds elementAndBounds) { List commands = new ArrayList<>(); if (elementAndBounds.getNewPosition() != null) { diff --git a/plugins/org.eclipse.glsp.server.websocket/src/org/eclipse/glsp/server/websocket/WebsocketServerLauncher.java b/plugins/org.eclipse.glsp.server.websocket/src/org/eclipse/glsp/server/websocket/WebsocketServerLauncher.java index 66e654e8..5db3e28c 100644 --- a/plugins/org.eclipse.glsp.server.websocket/src/org/eclipse/glsp/server/websocket/WebsocketServerLauncher.java +++ b/plugins/org.eclipse.glsp.server.websocket/src/org/eclipse/glsp/server/websocket/WebsocketServerLauncher.java @@ -33,7 +33,7 @@ public class WebsocketServerLauncher extends GLSPServerLauncher { public static final String START_UP_COMPLETE_MSG = "[GLSP-Server]:Startup completed. Accepting requests on port:"; - private static Logger LOGGER = LogManager.getLogger(WebsocketServerLauncher.class); + protected static Logger LOGGER = LogManager.getLogger(WebsocketServerLauncher.class); protected Server server; protected final String endpointPath; protected final Level websocketLogLevel; diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/directediting/RequestEditValidationHandler.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/directediting/RequestEditValidationHandler.java index 546b76d7..34efbad9 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/directediting/RequestEditValidationHandler.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/directediting/RequestEditValidationHandler.java @@ -27,7 +27,7 @@ public class RequestEditValidationHandler extends AbstractActionHandler { - private static Logger LOGGER = LogManager.getLogger(RequestEditValidationHandler.class); + protected static Logger LOGGER = LogManager.getLogger(RequestEditValidationHandler.class); @Inject protected ContextEditValidatorRegistry contextEditValidatorRegistry; diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/directediting/ValidationStatus.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/directediting/ValidationStatus.java index 4091d506..5f453ab6 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/directediting/ValidationStatus.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/directediting/ValidationStatus.java @@ -69,7 +69,7 @@ public static ValidationStatus error(final String message, final Throwable throw return new ValidationStatus(Severity.ERROR, message, throwable); } - private static ResponseError toError(final Throwable throwable) { + public static ResponseError toError(final Throwable throwable) { return throwable == null ? null : RemoteEndpoint.DEFAULT_EXCEPTION_HANDLER.apply(throwable); } } diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/navigation/JsonOpenerOptions.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/navigation/JsonOpenerOptions.java index dfbc3f68..5cc3a92e 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/navigation/JsonOpenerOptions.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/navigation/JsonOpenerOptions.java @@ -24,7 +24,7 @@ import com.google.gson.JsonSyntaxException; public class JsonOpenerOptions { - private static final Logger LOGGER = LogManager.getLogger(JsonOpenerOptions.class); + protected static final Logger LOGGER = LogManager.getLogger(JsonOpenerOptions.class); private TextSelection selection; diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/navigation/ResolveNavigationTargetActionHandler.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/navigation/ResolveNavigationTargetActionHandler.java index c8e33d1c..2b0ab233 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/navigation/ResolveNavigationTargetActionHandler.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/navigation/ResolveNavigationTargetActionHandler.java @@ -27,7 +27,7 @@ public class ResolveNavigationTargetActionHandler extends AbstractActionHandler { - private static final Logger LOGGER = LogManager.getLogger(ResolveNavigationTargetActionHandler.class); + protected static final Logger LOGGER = LogManager.getLogger(ResolveNavigationTargetActionHandler.class); @Inject protected Optional navigationTargetResolver; diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/sourcemodelwatcher/FileWatcher.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/sourcemodelwatcher/FileWatcher.java index 9a08838b..fca9255a 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/sourcemodelwatcher/FileWatcher.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/sourcemodelwatcher/FileWatcher.java @@ -144,14 +144,14 @@ protected void notifyClient(final ClientNotification clientNotification) { actionDispatcher.dispatch(new SourceModelChangedAction(clientNotification.modelSourceName)); } - class FileWatchWorker extends Thread { + protected class FileWatchWorker extends Thread { - private boolean stopped; - private boolean paused; + protected boolean stopped; + protected boolean paused; - private final String clientId; - private final Path filePath; - private WatchKey key; + protected final String clientId; + protected final Path filePath; + protected WatchKey key; FileWatchWorker(final String clientId, final Path filePath) { super(); @@ -180,7 +180,7 @@ public void run() { } } - private void pollEventsAndNotifyClient(final Path directory) + protected void pollEventsAndNotifyClient(final Path directory) throws IOException { for (final WatchEvent event : key.pollEvents()) { if (!paused && !stopped && Files.isSameFile(directory.resolve((Path) event.context()), filePath)) { @@ -209,8 +209,8 @@ public void continueNotifications() { protected class ClientNotification { - private final String clientId; - private final String modelSourceName; + protected final String clientId; + protected final String modelSourceName; ClientNotification(final String clientId, final String modelSourceName) { super(); @@ -242,7 +242,7 @@ public boolean equals(final Object obj) { return Objects.equals(clientId, other.clientId) && Objects.equals(modelSourceName, other.modelSourceName); } - private FileWatcher getEnclosingInstance() { return FileWatcher.this; } + protected FileWatcher getEnclosingInstance() { return FileWatcher.this; } } diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/undoredo/UndoRedoActionHandler.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/undoredo/UndoRedoActionHandler.java index fd203908..5d7fc38a 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/undoredo/UndoRedoActionHandler.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/undoredo/UndoRedoActionHandler.java @@ -29,7 +29,7 @@ import com.google.inject.Inject; public class UndoRedoActionHandler implements ActionHandler { - private static final Logger LOGGER = LogManager.getLogger(UndoRedoActionHandler.class); + protected static final Logger LOGGER = LogManager.getLogger(UndoRedoActionHandler.class); @Inject protected ModelSubmissionHandler modelSubmissionHandler; diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/validation/RequestMarkersHandler.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/validation/RequestMarkersHandler.java index 32f086de..68451a5f 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/validation/RequestMarkersHandler.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/features/validation/RequestMarkersHandler.java @@ -31,7 +31,7 @@ public class RequestMarkersHandler extends AbstractActionHandler { - private static final Logger LOGGER = LogManager.getLogger(RequestMarkersHandler.class); + protected static final Logger LOGGER = LogManager.getLogger(RequestMarkersHandler.class); @Inject protected Optional validator; diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/gmodel/GModelChangeBoundsOperationHandler.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/gmodel/GModelChangeBoundsOperationHandler.java index e10b4635..203f3f7f 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/gmodel/GModelChangeBoundsOperationHandler.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/gmodel/GModelChangeBoundsOperationHandler.java @@ -39,7 +39,7 @@ */ public class GModelChangeBoundsOperationHandler extends GModelOperationHandler { - private static Logger LOGGER = LogManager.getLogger(GModelChangeBoundsOperationHandler.class); + protected static Logger LOGGER = LogManager.getLogger(GModelChangeBoundsOperationHandler.class); @Override public Optional createCommand(final ChangeBoundsOperation operation) { diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/gmodel/GModelDeleteOperationHandler.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/gmodel/GModelDeleteOperationHandler.java index 1bb93144..2d884b59 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/gmodel/GModelDeleteOperationHandler.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/gmodel/GModelDeleteOperationHandler.java @@ -38,7 +38,7 @@ * Applies {@link DeleteOperation} directly to the GModel. */ public class GModelDeleteOperationHandler extends GModelOperationHandler { - private static Logger LOGGER = LogManager.getLogger(GModelDeleteOperationHandler.class); + protected static Logger LOGGER = LogManager.getLogger(GModelDeleteOperationHandler.class); protected Set allDependantsIds; @Override diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/gmodel/GModelPasteOperationHandler.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/gmodel/GModelPasteOperationHandler.java index 9e8fc87a..55216ddc 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/gmodel/GModelPasteOperationHandler.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/gmodel/GModelPasteOperationHandler.java @@ -50,7 +50,7 @@ */ public class GModelPasteOperationHandler extends GModelOperationHandler { - private static final int DEFAULT_OFFSET = 20; + protected static final int DEFAULT_OFFSET = 20; protected final Gson gson; diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/gmodel/GModelStorage.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/gmodel/GModelStorage.java index 6de71d6c..bf054bcf 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/gmodel/GModelStorage.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/gmodel/GModelStorage.java @@ -51,7 +51,7 @@ */ public class GModelStorage implements SourceModelStorage { - private static Logger LOGGER = LogManager.getLogger(GModelStorage.class); + protected static Logger LOGGER = LogManager.getLogger(GModelStorage.class); public static final String EMPTY_ROOT_ID = "glsp-graph"; @Inject diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/actions/DefaultActionDispatcher.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/actions/DefaultActionDispatcher.java index a877ffa2..3b7ab73b 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/actions/DefaultActionDispatcher.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/actions/DefaultActionDispatcher.java @@ -55,7 +55,7 @@ */ public class DefaultActionDispatcher extends Disposable implements ActionDispatcher, ActionHandler { - private static final Logger LOGGER = LogManager.getLogger(DefaultActionDispatcher.class); + protected static final Logger LOGGER = LogManager.getLogger(DefaultActionDispatcher.class); private static final AtomicInteger COUNT = new AtomicInteger(0); @@ -156,7 +156,7 @@ protected void addToQueue(final Action action) { } } - private void runThread() { + protected void runThread() { while (true) { try { handleNextAction(); @@ -169,7 +169,7 @@ private void runThread() { LOGGER.info("Terminating DefaultActionDispatcher"); } - private void handleNextAction() + protected void handleNextAction() throws InterruptedException { final Action action = actionsQueue.take(); if (action != null) { diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/gmodel/commandstack/GModelCommandStack.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/gmodel/commandstack/GModelCommandStack.java index 0f33ceae..e2211073 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/gmodel/commandstack/GModelCommandStack.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/gmodel/commandstack/GModelCommandStack.java @@ -21,7 +21,7 @@ public class GModelCommandStack extends BasicCommandStack { - private static Logger LOGGER = LogManager.getLogger(GModelCommandStack.class); + protected static Logger LOGGER = LogManager.getLogger(GModelCommandStack.class); @Override protected void handleError(final Exception exception) { diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/gmodel/commandstack/GModelRecordingCommand.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/gmodel/commandstack/GModelRecordingCommand.java index 1fb83f31..ac811c07 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/gmodel/commandstack/GModelRecordingCommand.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/gmodel/commandstack/GModelRecordingCommand.java @@ -63,7 +63,7 @@ public void redo() { applyChanges(); } - private void applyChanges() { + protected void applyChanges() { GModelChangeRecorder recorder = new GModelChangeRecorder(modelRoot).beginRecording(); try { change.apply(); diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/util/ReflectionUtil.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/util/ReflectionUtil.java index 0775e7e1..db4f0991 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/util/ReflectionUtil.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/util/ReflectionUtil.java @@ -26,7 +26,7 @@ import org.apache.logging.log4j.Logger; public final class ReflectionUtil { - private static Logger LOGGER = LogManager.getLogger(ReflectionUtil.class); + protected static Logger LOGGER = LogManager.getLogger(ReflectionUtil.class); private ReflectionUtil() {} diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/launch/CLIParser.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/launch/CLIParser.java index b29e8a71..b9d1872d 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/launch/CLIParser.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/launch/CLIParser.java @@ -26,7 +26,7 @@ import org.eclipse.glsp.server.utils.LaunchUtil; public abstract class CLIParser { - private static final Logger LOGGER = LogManager.getLogger(CLIParser.class); + protected static final Logger LOGGER = LogManager.getLogger(CLIParser.class); protected static final String INVALID_ARGUMENT_MESSAGE = "%s' is not a valid argument for option '--%s'! The default value '%s' is used."; protected final CommandLine cmd; diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/launch/GLSPServerLauncher.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/launch/GLSPServerLauncher.java index fa747049..0f71c128 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/launch/GLSPServerLauncher.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/launch/GLSPServerLauncher.java @@ -32,7 +32,7 @@ public abstract class GLSPServerLauncher { - private static Logger LOGGER = LogManager.getLogger(GLSPServerLauncher.class); + protected static Logger LOGGER = LogManager.getLogger(GLSPServerLauncher.class); protected final List modules; public GLSPServerLauncher(final ServerModule serverModule, final Module... additionalModules) { diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/launch/SocketGLSPServerLauncher.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/launch/SocketGLSPServerLauncher.java index e6a091f5..2af80510 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/launch/SocketGLSPServerLauncher.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/launch/SocketGLSPServerLauncher.java @@ -46,7 +46,7 @@ public class SocketGLSPServerLauncher extends GLSPServerLauncher { public static final String START_UP_COMPLETE_MSG = "[GLSP-Server]:Startup completed. Accepting requests on port:"; - private static Logger LOGGER = LogManager.getLogger(SocketGLSPServerLauncher.class); + protected static Logger LOGGER = LogManager.getLogger(SocketGLSPServerLauncher.class); protected ExecutorService threadPool; protected AsynchronousServerSocketChannel serverSocket; diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/protocol/DefaultGLSPServer.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/protocol/DefaultGLSPServer.java index e6a25ab6..fc096777 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/protocol/DefaultGLSPServer.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/protocol/DefaultGLSPServer.java @@ -39,7 +39,7 @@ import com.google.inject.Inject; public class DefaultGLSPServer implements GLSPServer { - private static Logger LOGGER = LogManager.getLogger(DefaultGLSPServer.class); + protected static Logger LOGGER = LogManager.getLogger(DefaultGLSPServer.class); public static final String PROTOCOL_VERSION = "1.0.0"; @Inject diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/utils/Debouncer.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/utils/Debouncer.java index 0b33d56f..7d2ed128 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/utils/Debouncer.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/utils/Debouncer.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2020 EclipseSource and others. + * Copyright (c) 2020-2024 EclipseSource and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -26,11 +26,11 @@ import org.eclipse.glsp.server.disposable.IDisposable; public class Debouncer implements Consumer, IDisposable { - private final ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(); - private final Map> scheduledExecutions = new ConcurrentHashMap<>(); - private final Consumer consumer; - private final long delay; - private final TimeUnit timeUnit; + protected final ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(); + protected final Map> scheduledExecutions = new ConcurrentHashMap<>(); + protected final Consumer consumer; + protected final long delay; + protected final TimeUnit timeUnit; public Debouncer(final Consumer consumer, final long delay, final TimeUnit timeUnit) { this.consumer = consumer; @@ -43,7 +43,7 @@ public void accept(final T argument) { scheduledExecutions.compute(argument, this::scheduleExecution); } - private ScheduledFuture scheduleExecution(final T argument, final ScheduledFuture previousExecution) { + protected ScheduledFuture scheduleExecution(final T argument, final ScheduledFuture previousExecution) { if (previousExecution != null) { previousExecution.cancel(true); } @@ -52,7 +52,7 @@ private ScheduledFuture scheduleExecution(final T argument, final ScheduledFu : null; } - private void execute(final T argument) { + protected void execute(final T argument) { scheduledExecutions.remove(argument); consumer.accept(argument); } diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/utils/LaunchUtil.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/utils/LaunchUtil.java index fb0540a5..e97b4743 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/utils/LaunchUtil.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/utils/LaunchUtil.java @@ -43,7 +43,7 @@ @SuppressWarnings("rawtypes") public final class LaunchUtil { - private static Logger LOGGER = LogManager.getLogger(LaunchUtil.class); + protected static Logger LOGGER = LogManager.getLogger(LaunchUtil.class); private LaunchUtil() {} diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/utils/MessageActionUtil.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/utils/MessageActionUtil.java index 0972b681..02988486 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/utils/MessageActionUtil.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/utils/MessageActionUtil.java @@ -25,7 +25,7 @@ import org.eclipse.glsp.server.types.Severity; public final class MessageActionUtil { - private static Logger LOGGER = LogManager.getLogger(MessageActionUtil.class); + protected static Logger LOGGER = LogManager.getLogger(MessageActionUtil.class); private MessageActionUtil() {} @@ -61,7 +61,7 @@ public static MessageAction clear() { return new MessageAction(Severity.NONE, ""); } - private static String getDetails(final Throwable throwable) { + public static String getDetails(final Throwable throwable) { if (throwable == null) { return null; } @@ -82,7 +82,7 @@ private static String getDetails(final Throwable throwable) { return result.toString(); } - private static String getMessage(final Exception e) { + public static String getMessage(final Exception e) { if (e == null) { return ""; }