Class AbstractLaunchShortcut
- java.lang.Object
-
- com._1c.g5.v8.dt.debug.ui.launchconfigurations.shortcuts.AbstractLaunchShortcut
-
- All Implemented Interfaces:
org.eclipse.debug.ui.ILaunchShortcut
,org.eclipse.debug.ui.ILaunchShortcut2
- Direct Known Subclasses:
AbstractMobileLaunchShortcut
,RemoteMobileApplicationLaunchShortcut
,RemoteRuntimeDebugLaunchShortcut
public abstract class AbstractLaunchShortcut extends Object implements org.eclipse.debug.ui.ILaunchShortcut2
Abstract launch shortcut. Uses project from the current selected context. Shortcut locates V8 configuration project from selection, locates run or debug configuration (or creates new), validates and launches it.If this configuration is not valid, launch configuration dialog will be shown.
-
-
Field Summary
Fields Modifier and Type Field Description protected IApplicationManager
applicationManager
protected IProcessEncodingProvider
processEncodingProvider
protected IResolvableRuntimeInstallationManager
resolvableRuntimeInstallationManager
protected IRuntimeVersionSupport
runtimeVersionSupport
protected IV8ProjectManager
v8projectManager
-
Constructor Summary
Constructors Constructor Description AbstractLaunchShortcut()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected org.eclipse.debug.core.ILaunchConfigurationWorkingCopy
createLaunchConfiguration(org.eclipse.core.resources.IProject project, org.eclipse.emf.ecore.EObject object, String mode)
Creates a launch configuration for the given project.protected Collection<org.eclipse.core.resources.IProject>
getConfigurationProjects()
Returns a collection of all workspace V8 configuration projects.protected org.eclipse.core.resources.IProject
getLaunchableResource()
Returns project to launch without any context.org.eclipse.core.resources.IProject
getLaunchableResource(ISelection selection)
org.eclipse.core.resources.IProject
getLaunchableResource(org.eclipse.ui.IEditorPart editorpart)
protected org.eclipse.debug.core.ILaunchConfiguration
getLaunchConfiguration(org.eclipse.core.resources.IProject project, IApplication application, org.eclipse.emf.ecore.EObject object, String mode)
Returns launch configuration for project.protected org.eclipse.debug.core.ILaunchConfiguration[]
getLaunchConfigurations(org.eclipse.core.resources.IProject project, IApplication application, org.eclipse.emf.ecore.EObject object, boolean forLaunch)
Returns an array of existingILaunchConfiguration
s that could be used to launch the given project.org.eclipse.debug.core.ILaunchConfiguration[]
getLaunchConfigurations(ISelection selection)
org.eclipse.debug.core.ILaunchConfiguration[]
getLaunchConfigurations(org.eclipse.ui.IEditorPart editor)
protected abstract String
getLaunchConfigurationSelectionTitle()
Returns existing launch configuration selection dialog title message.protected org.eclipse.debug.core.ILaunchConfigurationType
getLaunchConfigurationType()
Returns the launch shortcut configuration type.protected abstract String
getLaunchConfigurationTypeId()
Returns the launch shortcut configuration type identifier.protected String
getNameSuffix()
Returns the name suffix for newly created launch configuration, will be appended to the generated name ornull
if suffix not needed.protected boolean
isApplicationValid(org.eclipse.debug.core.ILaunchConfiguration configuration, String mode)
Returns whether the application launch attributes are valid.protected boolean
isValid(org.eclipse.debug.core.ILaunchConfiguration configuration, String mode)
Validates the given launch configuration.protected void
launch(org.eclipse.core.resources.IProject project, IApplication application, org.eclipse.emf.ecore.EObject object, String mode)
Launches an application with given project in the specified mode.void
launch(ISelection selection, String mode)
void
launch(org.eclipse.ui.IEditorPart editor, String mode)
protected boolean
matches(org.eclipse.core.resources.IProject project, IApplication application, org.eclipse.emf.ecore.EObject object, org.eclipse.debug.core.ILaunchConfiguration candidate, boolean forLaunch)
Returns whether the given launch configuration candidate of the shortcut type mathces with the given project for launch purposes.protected org.eclipse.debug.core.ILaunchConfigurationWorkingCopy
prepareConfiguration(org.eclipse.debug.core.ILaunchConfiguration launchConfiguration, IApplication application)
Prepares launch configuration to use with this type of shortcut.protected void
setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy configuration, org.eclipse.core.resources.IProject project)
Sets default attributes for the provided launch configuration.protected boolean
shouldSave(org.eclipse.debug.core.ILaunchConfiguration configuration, String mode)
Returns whether need to save the given configuration before or after execution.protected void
showNoProjectsInfo()
Shows information to user that no appropriate projects was found.
-
-
-
Field Detail
-
processEncodingProvider
@Inject protected IProcessEncodingProvider processEncodingProvider
-
v8projectManager
@Inject protected IV8ProjectManager v8projectManager
-
resolvableRuntimeInstallationManager
@Inject protected IResolvableRuntimeInstallationManager resolvableRuntimeInstallationManager
-
runtimeVersionSupport
@Inject protected IRuntimeVersionSupport runtimeVersionSupport
-
applicationManager
@Inject protected IApplicationManager applicationManager
-
-
Method Detail
-
launch
public void launch(ISelection selection, String mode)
- Specified by:
launch
in interfaceorg.eclipse.debug.ui.ILaunchShortcut
-
launch
public void launch(org.eclipse.ui.IEditorPart editor, String mode)
- Specified by:
launch
in interfaceorg.eclipse.debug.ui.ILaunchShortcut
-
getLaunchConfigurations
public org.eclipse.debug.core.ILaunchConfiguration[] getLaunchConfigurations(ISelection selection)
- Specified by:
getLaunchConfigurations
in interfaceorg.eclipse.debug.ui.ILaunchShortcut2
-
getLaunchConfigurations
public org.eclipse.debug.core.ILaunchConfiguration[] getLaunchConfigurations(org.eclipse.ui.IEditorPart editor)
- Specified by:
getLaunchConfigurations
in interfaceorg.eclipse.debug.ui.ILaunchShortcut2
-
getLaunchableResource
public org.eclipse.core.resources.IProject getLaunchableResource(ISelection selection)
- Specified by:
getLaunchableResource
in interfaceorg.eclipse.debug.ui.ILaunchShortcut2
-
getLaunchableResource
public org.eclipse.core.resources.IProject getLaunchableResource(org.eclipse.ui.IEditorPart editorpart)
- Specified by:
getLaunchableResource
in interfaceorg.eclipse.debug.ui.ILaunchShortcut2
-
launch
protected void launch(org.eclipse.core.resources.IProject project, IApplication application, org.eclipse.emf.ecore.EObject object, String mode)
Launches an application with given project in the specified mode.- Parameters:
project
- the project to launch, cannot benull
application
- the application to use launch ornull
if noneobject
- the object to launch ornull
if nonemode
- one of the launch modes defined by the launch manager, cannot benull
-
getLaunchableResource
protected org.eclipse.core.resources.IProject getLaunchableResource()
Returns project to launch without any context. Method will search for existing projects and returns one if found exact one project. If found more than1
, selection dialog will be opened.Can return
null
than no project is needed to launch.- Returns:
- project to launch, or
null
if none projects is needed to launch
-
getLaunchConfiguration
protected org.eclipse.debug.core.ILaunchConfiguration getLaunchConfiguration(org.eclipse.core.resources.IProject project, IApplication application, org.eclipse.emf.ecore.EObject object, String mode) throws org.eclipse.core.runtime.CoreException
Returns launch configuration for project. Method will search for existing launch configurations, then if not found, create new. If found more than1
, selection dialog will be opened.Can return
null
than no launch configuration is needed to launch.- Parameters:
project
- the project to get launch configuration for, cannot benull
application
- the application to use launch ornull
if noneobject
- the object to get launch configuration for ornull
if nonemode
- one of the launch modes defined by the launch manager, cannot benull
- Returns:
- launch configuration for given project to launch, or
null
if none launch configuration is needed to launch - Throws:
org.eclipse.core.runtime.CoreException
- if getting fails
-
showNoProjectsInfo
protected void showNoProjectsInfo()
Shows information to user that no appropriate projects was found.
-
prepareConfiguration
protected org.eclipse.debug.core.ILaunchConfigurationWorkingCopy prepareConfiguration(org.eclipse.debug.core.ILaunchConfiguration launchConfiguration, IApplication application) throws org.eclipse.core.runtime.CoreException
Prepares launch configuration to use with this type of shortcut. Default implementation does nothing and returnd the given configuration working copy.- Parameters:
launchConfiguration
- the launch configuration to prepare, cannot benull
application
- the application to use launch ornull
if none- Returns:
- working copy of the launch configuration configured to launch this type of shortcut, never
null
- Throws:
org.eclipse.core.runtime.CoreException
- if preparing fails
-
isValid
protected boolean isValid(org.eclipse.debug.core.ILaunchConfiguration configuration, String mode) throws org.eclipse.core.runtime.CoreException
Validates the given launch configuration. Returns whether launch configuration has valid and ready-to-launch attributes.- Parameters:
configuration
- launch configuration to validate, cannot benull
mode
- one of the launch modes defined by the launch manager, cannot benull
- Returns:
- whether launch configuration has valid and ready-to-launch values
- Throws:
org.eclipse.core.runtime.CoreException
- if validation fails
-
isApplicationValid
protected boolean isApplicationValid(org.eclipse.debug.core.ILaunchConfiguration configuration, String mode) throws org.eclipse.core.runtime.CoreException
Returns whether the application launch attributes are valid.- Parameters:
configuration
- launch configuration to validate, cannot benull
mode
- one of the launch modes defined by the launch manager, cannot benull
- Returns:
- whether the application launch attributes are valid
- Throws:
org.eclipse.core.runtime.CoreException
- if validation fails
-
shouldSave
protected boolean shouldSave(org.eclipse.debug.core.ILaunchConfiguration configuration, String mode) throws org.eclipse.core.runtime.CoreException
Returns whether need to save the given configuration before or after execution. Default implementation always returnstrue
.- Parameters:
configuration
- launch configuration to check, cannot benull
mode
- one of the launch modes defined by the launch manager, cannot benull
- Returns:
- whether need to save the given configuration before or after execution
- Throws:
org.eclipse.core.runtime.CoreException
- if check fails
-
createLaunchConfiguration
protected org.eclipse.debug.core.ILaunchConfigurationWorkingCopy createLaunchConfiguration(org.eclipse.core.resources.IProject project, org.eclipse.emf.ecore.EObject object, String mode) throws org.eclipse.core.runtime.CoreException
Creates a launch configuration for the given project. Launch configuration will be configured with default attributes for this project.- Parameters:
project
- the project to create launch configuration for, cannot benull
object
- the object to create launch configuration for ornull
if nonemode
- one of the launch modes defined by the launch manager, cannot benull
- Returns:
- launch configuration copy or
null
if cannot create - Throws:
org.eclipse.core.runtime.CoreException
- if creation fails
-
setDefaults
protected void setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy configuration, org.eclipse.core.resources.IProject project) throws org.eclipse.core.runtime.CoreException
Sets default attributes for the provided launch configuration.- Parameters:
configuration
- the launch configuration, cannot benull
project
- the launcning project, cannot benull
- Throws:
org.eclipse.core.runtime.CoreException
- if request fails
-
getLaunchConfigurations
protected org.eclipse.debug.core.ILaunchConfiguration[] getLaunchConfigurations(org.eclipse.core.resources.IProject project, IApplication application, org.eclipse.emf.ecore.EObject object, boolean forLaunch)
Returns an array of existingILaunchConfiguration
s that could be used to launch the given project.Default implementation returns all project launch configuration of this type.
- Parameters:
project
- the project to find candidates for, cannot benull
application
- the launching application ornull
if noneobject
- the object to find candidates for ornull
if noneforLaunch
- iftrue
then launch configuration will be filetered for launch purposes, iffalse
then launch configuration will be filetered for selection launch configuration listing- Returns:
- an array of existing
ILaunchConfiguration
s that could be used to launch the given project, an empty array if one could be created but does not exist, nevernull
-
matches
protected boolean matches(org.eclipse.core.resources.IProject project, IApplication application, org.eclipse.emf.ecore.EObject object, org.eclipse.debug.core.ILaunchConfiguration candidate, boolean forLaunch)
Returns whether the given launch configuration candidate of the shortcut type mathces with the given project for launch purposes.Default implementation returns
true
if project default attribute matches with the given project.- Parameters:
project
- the project to get candidates for, cannot benull
application
- the launching application ornull
if noneobject
- the object to find candidates for ornull
if nonecandidate
- the candidate launch configuration, cannot benull
forLaunch
- iftrue
then launch configuration will be filetered for launch purposes, iffalse
then launch configuration will be filetered for selection launch configuration listing- Returns:
- whether the given launch configuration candidate of the shortcut type mathces with the given project for launch purposes
-
getLaunchConfigurationType
protected org.eclipse.debug.core.ILaunchConfigurationType getLaunchConfigurationType()
Returns the launch shortcut configuration type.- Returns:
- the launch shortcut configuration type, never
null
-
getConfigurationProjects
protected Collection<org.eclipse.core.resources.IProject> getConfigurationProjects()
Returns a collection of all workspace V8 configuration projects.- Returns:
- a collection of all workspace V8 configuration projects, never
null
-
getNameSuffix
protected String getNameSuffix()
Returns the name suffix for newly created launch configuration, will be appended to the generated name ornull
if suffix not needed. Default implementation returnsnull
.- Returns:
- the name suffix for newly created launch configuration, or
null
if suffix not needed
-
getLaunchConfigurationTypeId
protected abstract String getLaunchConfigurationTypeId()
Returns the launch shortcut configuration type identifier.- Returns:
- the launch shortcut configuration type identifier, never
null
-
getLaunchConfigurationSelectionTitle
protected abstract String getLaunchConfigurationSelectionTitle()
Returns existing launch configuration selection dialog title message.- Returns:
- existing launch configuration selection dialog title message, never
null
-
-