org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/deployment/DeploymentTargetTypeDescriptor.java
changeset 468 a05c6e5cc7d9
parent 463 aea4c83725d8
equal deleted inserted replaced
467:5a2901872fcf 468:a05c6e5cc7d9
    24 import org.eclipse.core.runtime.CoreException;
    24 import org.eclipse.core.runtime.CoreException;
    25 import org.eclipse.core.runtime.IConfigurationElement;
    25 import org.eclipse.core.runtime.IConfigurationElement;
    26 import org.eclipse.core.runtime.IProgressMonitor;
    26 import org.eclipse.core.runtime.IProgressMonitor;
    27 import org.eclipse.core.runtime.jobs.ISchedulingRule;
    27 import org.eclipse.core.runtime.jobs.ISchedulingRule;
    28 import org.eclipse.jface.resource.ImageDescriptor;
    28 import org.eclipse.jface.resource.ImageDescriptor;
    29 import org.symbian.tools.tmw.core.projects.IMTWProject;
    29 import org.symbian.tools.tmw.core.projects.ITMWProject;
    30 import org.symbian.tools.tmw.ui.TMWCoreUI;
    30 import org.symbian.tools.tmw.ui.TMWCoreUI;
    31 import org.symbian.tools.tmw.ui.deployment.IDeploymentTarget;
    31 import org.symbian.tools.tmw.ui.deployment.IDeploymentTarget;
    32 import org.symbian.tools.tmw.ui.deployment.IDeploymentTargetType;
    32 import org.symbian.tools.tmw.ui.deployment.IDeploymentTargetType;
    33 
    33 
    34 public final class DeploymentTargetTypeDescriptor implements IDeploymentTargetType {
    34 public final class DeploymentTargetTypeDescriptor implements IDeploymentTargetType {
    35     public class NullProvider implements IDeploymentTargetType {
    35     public class NullProvider implements IDeploymentTargetType {
    36         public IDeploymentTarget[] getTargets(IMTWProject project) {
    36         public IDeploymentTarget[] getTargets(ITMWProject project) {
    37             return null;
    37             return null;
    38         }
    38         }
    39 
    39 
    40         public void discoverTargets(IProgressMonitor monitor) throws CoreException {
    40         public void discoverTargets(IProgressMonitor monitor) throws CoreException {
    41             // Do nothing
    41             // Do nothing
    42         }
    42         }
    43 
    43 
    44         public IDeploymentTarget findTarget(IMTWProject project, String id) {
    44         public IDeploymentTarget findTarget(ITMWProject project, String id) {
    45             return null;
    45             return null;
    46         }
    46         }
    47 
    47 
    48         public boolean targetsDiscovered() {
    48         public boolean targetsDiscovered() {
    49             return true;
    49             return true;
    62 
    62 
    63     public DeploymentTargetTypeDescriptor(IConfigurationElement element) {
    63     public DeploymentTargetTypeDescriptor(IConfigurationElement element) {
    64         this.element = element;
    64         this.element = element;
    65     }
    65     }
    66 
    66 
    67     public boolean supports(IMTWProject project) {
    67     public boolean supports(ITMWProject project) {
    68         // We will support more declarative filtering later
    68         // We will support more declarative filtering later
    69         return true;
    69         return true;
    70     }
    70     }
    71 
    71 
    72     public DeploymentTargetWrapper[] getTargets(IMTWProject project) {
    72     public DeploymentTargetWrapper[] getTargets(ITMWProject project) {
    73         final DeploymentTargetWrapper[] targets = wrap(getProvider().getTargets(project));
    73         final DeploymentTargetWrapper[] targets = wrap(getProvider().getTargets(project));
    74         return targets != null ? targets : NO_TARGETS;
    74         return targets != null ? targets : NO_TARGETS;
    75     }
    75     }
    76 
    76 
    77     private DeploymentTargetWrapper[] wrap(IDeploymentTarget[] targets) {
    77     private DeploymentTargetWrapper[] wrap(IDeploymentTarget[] targets) {
    97 
    97 
    98     public void discoverTargets(IProgressMonitor monitor) throws CoreException {
    98     public void discoverTargets(IProgressMonitor monitor) throws CoreException {
    99         getProvider().discoverTargets(monitor);
    99         getProvider().discoverTargets(monitor);
   100     }
   100     }
   101 
   101 
   102     public IDeploymentTarget findTarget(IMTWProject project, String id) {
   102     public IDeploymentTarget findTarget(ITMWProject project, String id) {
   103         return wrap(getProvider().findTarget(project, id));
   103         return wrap(getProvider().findTarget(project, id));
   104     }
   104     }
   105 
   105 
   106     private synchronized IDeploymentTargetType getProvider() {
   106     private synchronized IDeploymentTargetType getProvider() {
   107         if (type == null) {
   107         if (type == null) {