Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: d466ec70c4e0cc4e23b4ed5411bc980d2e8c7329 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/***************************************************************************
 * Copyright (c) 2004-2007 Eike Stepper, Germany.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *    Eike Stepper - initial API and implementation
 **************************************************************************/
package org.eclipse.net4j.internal.ui.wizards;

import org.eclipse.net4j.IPluginTransportContainer;
import org.eclipse.net4j.ITransportContainer;
import org.eclipse.net4j.internal.ui.wizards.steps.NewAcceptorStep;
import org.eclipse.net4j.ui.wizards.Step;
import org.eclipse.net4j.ui.wizards.SteppingNewWizard;

import org.eclipse.core.runtime.IProgressMonitor;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Eike Stepper
 */
public class NewAcceptorWizard extends SteppingNewWizard
{
  public NewAcceptorWizard(Map<String, Object> context)
  {
    super(context);
  }

  public NewAcceptorWizard(String type, String description)
  {
    super(createContext(type, description));
  }

  public NewAcceptorWizard()
  {
  }

  @Override
  protected Step createRootStep()
  {
    return new NewAcceptorStep(getTransportContainer());
  }

  @Override
  protected void doFinish(IProgressMonitor monitor) throws Exception
  {
    NewAcceptorStep step = (NewAcceptorStep)getRootStep();
    ITransportContainer transportContainer = getTransportContainer();
    transportContainer.getAcceptor(step.getAcceptorType(), step.getAcceptorDescription());
  }

  protected ITransportContainer getTransportContainer()
  {
    return IPluginTransportContainer.INSTANCE;
  }

  private static Map<String, Object> createContext(String type, String description)
  {
    Map<String, Object> context = new HashMap();
    if (type != null)
    {
      context.put(NewAcceptorStep.KEY_TYPE, type);
    }

    if (description != null)
    {
      context.put(NewAcceptorStep.KEY_DESCRIPTION, description);
    }

    return context;
  }
}

Back to the top