Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: d7e2d52bfc25fea6aca95dde91e6311ff053d0d6 (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
/*
 * Copyright (c) 2014 Eike Stepper (Loehne, Germany) and others.
 * 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.oomph.setup.presentation.handlers;

import org.eclipse.oomph.setup.presentation.SetupEditorPlugin;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;

/**
 * @author Eike Stepper
 */
public abstract class AbstractDropdownItemHandler extends AbstractHandler implements Runnable
{
  private final String imageKey;

  private final String text;

  public AbstractDropdownItemHandler(String imageKey, String text)
  {
    this.imageKey = imageKey;
    this.text = text;
  }

  public ImageDescriptor getImageDescriptor()
  {
    return AbstractUIPlugin.imageDescriptorFromPlugin(SetupEditorPlugin.PLUGIN_ID, imageKey);
  }

  public String getText()
  {
    return text;
  }

  public final Object execute(ExecutionEvent event) throws ExecutionException
  {
    // PerformDropdownHandler.setAction(PerformDropdownHandler.COMMAND_ID, getImageDescriptor(), text, this);

    run();
    return null;
  }
}

Back to the top