Class AbstractRemoteInfobaseHandler
java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.core.commands.AbstractHandler
com._1c.g5.v8.dt.internal.platform.services.ui.infobases.commands.AbstractRemoteInfobaseHandler
- All Implemented Interfaces:
org.eclipse.core.commands.IHandler
,org.eclipse.core.commands.IHandler2
- Direct Known Subclasses:
DumpRemoteInfobaseHandler
,ExportConfigurationRemoteInfobaseHandler
,ImportConfigurationRemoteInfobaseHandler
,ImportExtensionsRemoteInfobaseHandler
,LaunchDesignerRemoteInfobaseHandler
,RestoreRemoteInfobaseHandler
public abstract class AbstractRemoteInfobaseHandler
extends org.eclipse.core.commands.AbstractHandler
Abstract handler for actions on selected server applications.
It is expected that a single item is selected.
It should be adaptable to project, infobase and application.
Usually, that is the case for selecting module (standalone server application) in applications view.
Child can define actual implementation in
executeWithRemoteInfobase(org.eclipse.swt.widgets.Shell, org.eclipse.core.resources.IProject, com._1c.g5.v8.dt.platform.services.model.InfobaseReference, com._1c.g5.v8.dt.platform.services.core.runtimes.environments.IResolvableRuntimeInstallation)
.
Before it is called, the infobase connection is established strating the server if necessary.
This can be overriden with ensureRemoteInfobaseConnected(org.eclipse.swt.widgets.Shell, com.e1c.g5.dt.applications.IApplication, com._1c.g5.v8.dt.platform.services.model.InfobaseReference, org.eclipse.core.resources.IProject)
which by default uses application manager to prepare
the application
in a non-UI thread using cancellable progress dialog (because preparing application
infrastructure for a large configuration could take really long time).
However, once application is prepared, the action is executed synchronously in the current thread.
Child class should itself decide if it want to continue in the current (possibly UI thread),
spawn a job, show progress dialog or some other modal window.
Upon encountering an error, the handler will display it, log to journal and exit normally to avoid
duplicate processing of this error.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractRemoteInfobaseHandler
(String description) Creates new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.eclipse.core.runtime.IStatus
ensureRemoteInfobaseConnected
(org.eclipse.swt.widgets.Shell shell, IApplication application, InfobaseReference infobase, org.eclipse.core.resources.IProject project) Connects remote infobase.execute
(org.eclipse.core.commands.ExecutionEvent event) protected abstract org.eclipse.core.runtime.IStatus
executeWithRemoteInfobase
(org.eclipse.swt.widgets.Shell shell, org.eclipse.core.resources.IProject project, InfobaseReference infobase, IResolvableRuntimeInstallation installation) Executes the command action with the provided shell, infobase and 1C:Enterprise platform.Methods inherited from class org.eclipse.core.commands.AbstractHandler
addHandlerListener, dispose, fireHandlerChanged, hasListeners, isEnabled, isHandled, removeHandlerListener, setBaseEnabled, setEnabled
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
-
Constructor Details
-
AbstractRemoteInfobaseHandler
Creates new instance.- Parameters:
description
- Description of this operation that would be presented to user when necessary. Should not benull
.
-
-
Method Details
-
execute
public Object execute(org.eclipse.core.commands.ExecutionEvent event) throws org.eclipse.core.commands.ExecutionException - Throws:
org.eclipse.core.commands.ExecutionException
-
executeWithRemoteInfobase
protected abstract org.eclipse.core.runtime.IStatus executeWithRemoteInfobase(org.eclipse.swt.widgets.Shell shell, org.eclipse.core.resources.IProject project, InfobaseReference infobase, IResolvableRuntimeInstallation installation) Executes the command action with the provided shell, infobase and 1C:Enterprise platform.- Parameters:
shell
- the shell to use, cannot benull
project
- the project to use, cannot benull
infobase
- the infobase to use, cannot benull
installation
- 1C:Enterprise platform, cannot benull
- Returns:
IStatus.isOK()
if operation has completed successfully.IStatus.CANCEL
if user has cancelled operation.IStatus.ERROR
with optionalIStatus.getMessage()
andIStatus.getException()
if an error has occured.
-
ensureRemoteInfobaseConnected
protected org.eclipse.core.runtime.IStatus ensureRemoteInfobaseConnected(org.eclipse.swt.widgets.Shell shell, IApplication application, InfobaseReference infobase, org.eclipse.core.resources.IProject project) Connects remote infobase. Default implementation displays progress dialog and starts the application. Childrens might want to override this if they need not application to be started and infobase connected.- Parameters:
shell
- Shell to use. Could benull
if shell is not available.application
- Application on which action was invoked. Nevernull
.infobase
- Infobase related to the application on which action was invoked. Nevernull
.project
- Project related to the application on which action was invoked. Nevernull
.- Returns:
IStatus.OK
if connection should have been successfull and operation should be proceeded.IStatus.CANCEL
if operation has been cancelled by user.IStatus.ERROR
if infobase cannot be connected due to an error. Must not benull
.
-