org.tizen.common.gom_2.0.0.201311012034

16:49:51.489 INFO  jd.cli.Main - Decompiling org.tizen.common.gom_2.0.0.201311012034.jar
package org.tizen.common.gom;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

public class GomPlugin
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "org.tizen.common.gom";
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    super.stop(context);
  }
  
  public static ImageDescriptor getImageDescriptorFromPlugin(String path)
  {
    return imageDescriptorFromPlugin("org.tizen.common.gom", path);
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.gom.GomPlugin
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.gom.launch;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutExtension;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tizen.common.launch.ITizenLaunchConfiguration;
import org.tizen.common.launch.ITizenNativeLaunchConfiguration;
import org.tizen.common.launch.ITizenWebLaunchConfiguration;
import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.SmartDevelopmentBridge;

public class GomLaunchData
{
  private Logger logger = LoggerFactory.getLogger(getClass());
  private IProject project;
  private ILaunchConfiguration launchConfiguration;
  private String launchConfigurationName;
  private String buildConfiguration;
  private String mode;
  private LaunchShortcutExtension ext;
  private IDevice device;
  
  public GomLaunchData(IProject project, String configurationName, String buildConfiguration, String mode, LaunchShortcutExtension ext, IDevice device)
  {
    this.project = project;
    launchConfiguration = null;
    launchConfigurationName = configurationName;
    this.buildConfiguration = buildConfiguration;
    this.mode = mode;
    this.ext = ext;
    this.device = device;
  }
  
  public GomLaunchData(ILaunch launch)
  {
    launchConfiguration = launch.getLaunchConfiguration();
    launchConfigurationName = launchConfiguration.getName();
    mode = launch.getLaunchMode();
    device = null;
    String config_device_id = null;
    try
    {
      config_device_id = launchConfiguration.getAttribute("org.tizen.common.launch.device.id", 
        "");
    }
    catch (CoreException e)
    {
      logger.error("Fail to get device id", e);
    }
    ITizenLaunchConfiguration launchConfigurationAdapter = null;
    if (!"".equals(config_device_id))
    {
      launchConfigurationAdapter = (ITizenNativeLaunchConfiguration)launchConfiguration.getAdapter(ITizenNativeLaunchConfiguration.class);
      IDevice[] devices = SmartDevelopmentBridge.getBridge().getDevices();
      device = ((ITizenNativeLaunchConfiguration)launchConfigurationAdapter).getDeviceFromLaunchConfiguration(devices);
    }
    else
    {
      launchConfigurationAdapter = (ITizenWebLaunchConfiguration)launchConfiguration.getAdapter(ITizenWebLaunchConfiguration.class);
    }
    project = launchConfigurationAdapter.getProject();
  }
  
  public IProject getProject()
  {
    return project;
  }
  
  public ILaunchConfiguration getLaunchConfiguration()
  {
    return launchConfiguration;
  }
  
  public String getLaunchConfigurationName()
  {
    return launchConfigurationName;
  }
  
  public String getDataInfo()
  {
    if (device != null) {
      return launchConfiguration.getName() + " on " + (device.isEmulator() ? device.getDeviceName() : device.getSerialNumber());
    }
    return launchConfiguration.getName();
  }
  
  public String getMode()
  {
    return mode;
  }
  
  public IDevice getDevice()
  {
    return device;
  }
  
  public LaunchShortcutExtension getExt()
  {
    return ext;
  }
  
  public String getBuildConfiguration()
  {
    return buildConfiguration;
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.gom.launch.GomLaunchData
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.gom.launch;

public abstract interface IGomSmartLaunchShortcut
{
  public abstract void smartLaunch(GomLaunchData paramGomLaunchData);
}

/* Location:
 * Qualified Name:     org.tizen.common.gom.launch.IGomSmartLaunchShortcut
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.gom.smartlaunch;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationListener;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.ILaunchesListener;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.ISelectionService;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.tizen.common.gom.launch.GomLaunchData;
import org.tizen.common.util.ViewUtil;

public class GomSmartLaunchManager
  implements ISelectionListener, ILaunchesListener, ILaunchConfigurationListener, IResourceChangeListener
{
  private static GomSmartLaunchManager launchManager = null;
  private HashMap<IProject, GomLaunchData> map = new HashMap();
  private List<GomLaunchData> launchList = new ArrayList();
  private int max = 10;
  
  public static GomSmartLaunchManager getDefault()
  {
    if (launchManager == null) {
      launchManager = new GomSmartLaunchManager();
    }
    return launchManager;
  }
  
  public void addListener()
  {
    IWorkbenchWindow workbenchWindow = ViewUtil.getWorkbenchWindow();
    if ((workbenchWindow != null) && (workbenchWindow.getSelectionService() != null)) {
      workbenchWindow.getSelectionService().addPostSelectionListener(this);
    }
    ResourcesPlugin.getWorkspace().addResourceChangeListener(this, 4);
    ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
    launchManager.addLaunchConfigurationListener(this);
    launchManager.addLaunchListener(this);
  }
  
  public void removeListener()
  {
    IWorkbenchWindow workbenchWindow = ViewUtil.getWorkbenchWindow();
    if ((workbenchWindow != null) && (workbenchWindow.getSelectionService() != null)) {
      workbenchWindow.getSelectionService().removePostSelectionListener(this);
    }
    ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
    ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
    launchManager.removeLaunchConfigurationListener(this);
    launchManager.removeLaunchListener(this);
  }
  
  public void selectionChanged(IWorkbenchPart part, ISelection selection)
  {
    if ((selection instanceof IStructuredSelection))
    {
      Object s = ((IStructuredSelection)selection).getFirstElement();
      if ((s instanceof IProject))
      {
        IProject project = (IProject)s;
        GomLaunchData data = (GomLaunchData)map.get(project);
        if (data != null)
        {
          IViewSite site = (IViewSite)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart().getSite();
          site.getActionBars().getStatusLineManager().setMessage(data.getDataInfo());
        }
      }
    }
  }
  
  public List<GomLaunchData> getLaunchList()
  {
    return launchList;
  }
  
  public void launchesRemoved(ILaunch[] launches) {}
  
  public void launchesAdded(ILaunch[] launches)
  {
    updateProjectLaunchData(launches[0]);
  }
  
  public void launchesChanged(ILaunch[] launches) {}
  
  public void resourceChanged(IResourceChangeEvent event)
  {
    IProject project = (IProject)event.getResource();
    removeLaunchHistory(project);
  }
  
  public void launchConfigurationAdded(ILaunchConfiguration configuration) {}
  
  public void launchConfigurationChanged(ILaunchConfiguration configuration) {}
  
  public void launchConfigurationRemoved(ILaunchConfiguration configuration) {}
  
  private void updateProjectLaunchData(ILaunch launch)
  {
    GomLaunchData launchData = new GomLaunchData(launch);
    map.put(launchData.getProject(), launchData);
    updateLaunchHistory(launchData);
  }
  
  public void updateLaunchHistory(GomLaunchData launchInfo)
  {
    Iterator<GomLaunchData> iter = launchList.iterator();
    while (iter.hasNext())
    {
      GomLaunchData info = (GomLaunchData)iter.next();
      if (launchInfo.getDataInfo().equals(info.getDataInfo())) {
        iter.remove();
      }
    }
    launchList.add(launchInfo);
    
    iter = launchList.iterator();
    while (iter.hasNext())
    {
      iter.next();
      if (launchList.size() <= max) {
        break;
      }
      iter.remove();
    }
  }
  
  private void removeLaunchHistory(Object obj)
  {
    Iterator<GomLaunchData> iter = launchList.iterator();
    while (iter.hasNext())
    {
      GomLaunchData item = (GomLaunchData)iter.next();
      if ((obj instanceof IProject))
      {
        IProject project = (IProject)obj;
        if (project.getName().equals(item.getProject().getName())) {
          iter.remove();
        }
      }
      else if ((obj instanceof ILaunchConfiguration))
      {
        ILaunchConfiguration configuration = (ILaunchConfiguration)obj;
        if (configuration.getName().equals(item.getLaunchConfiguration().getName())) {
          iter.remove();
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.gom.smartlaunch.GomSmartLaunchManager
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.gom.smartlaunch;

import org.eclipse.debug.ui.DebugUITools;
import org.tizen.common.gom.launch.GomLaunchData;

class GomSmartLauncher$1
  implements Runnable
{
  GomSmartLauncher$1(GomLaunchData paramGomLaunchData) {}
  
  public void run()
  {
    DebugUITools.launch(val$data.getLaunchConfiguration(), val$data.getMode());
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.gom.smartlaunch.GomSmartLauncher.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.gom.smartlaunch;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutExtension;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.IWorkbenchWindow;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tizen.common.connection.ConnectionPlugin;
import org.tizen.common.gom.launch.GomLaunchData;
import org.tizen.common.gom.launch.IGomSmartLaunchShortcut;
import org.tizen.common.gom.smartlaunch.messages.GomMessages;
import org.tizen.common.gom.smartlaunch.ui.GomDialog;
import org.tizen.common.util.ProjectUtil;
import org.tizen.common.util.SWTUtil;
import org.tizen.sdblib.IDevice;

public class GomSmartLauncher
{
  public static final String ATTR_CONFIG_DEVICE_ID = "org.tizen.common.launch.device.id";
  public static final String ATTR_CONFIG_DEVICE_IS_EMULATOR = "org.tizen.common.launch.device.emulator";
  public static final String ATTR_CONFIG_NO_DEVICE = "";
  private static GomDialog gomDialog = null;
  private static final Logger logger = LoggerFactory.getLogger(GomSmartLauncher.class);
  
  public static void smartLaunch(GomLaunchData data)
  {
    if (data.getLaunchConfiguration() == null)
    {
      IGomSmartLaunchShortcut shortcut = null;
      try
      {
        shortcut = (IGomSmartLaunchShortcut)data.getExt().getConfigurationElement().createExecutableExtension("class");
      }
      catch (CoreException localCoreException)
      {
        logger.error("SmartLaunch: Failed to get shortcut");
      }
      shortcut.smartLaunch(data);
    }
    else
    {
      SWTUtil.syncExec(new Runnable()
      {
        public void run()
        {
          DebugUITools.launch(getLaunchConfiguration(), getMode());
        }
      });
    }
  }
  
  public static void openDialog(IWorkbenchWindow window)
  {
    if (gomDialog == null) {
      if (existTizenProjectBeforeDialogOpen(window))
      {
        gomDialog = new GomDialog(window.getShell());
        if (gomDialog.open() == 0)
        {
          IProject project = gomDialog.getProject();
          if (existProjectAndDeviceBeforeLaunch(project, window)) {
            smartLaunch(getLaunchData(gomDialog));
          }
        }
        gomDialog = null;
      }
      else
      {
        MessageDialog.openError(window.getShell(), GomMessages.SMARTLAUNCH_FAIL, GomMessages.SMARTLAUNCH_NO_PROJECT);
      }
    }
  }
  
  private static GomLaunchData getLaunchData(GomDialog dialog)
  {
    GomLaunchData data = new GomLaunchData(dialog.getProject(), dialog.getConfigurationName(), dialog.getBuildConfiguration(), 
      dialog.getMode(), dialog.getLaunchShortcutExtension(), null);
    return data;
  }
  
  private static boolean existTizenProjectBeforeDialogOpen(IWorkbenchWindow window)
  {
    boolean result = false;
    if (window != null)
    {
      IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
      if (projects.length != 0)
      {
        IProject[] arrayOfIProject1;
        int j = (arrayOfIProject1 = projects).length;
        for (int i = 0; i < j; i++)
        {
          IProject project = arrayOfIProject1[i];
          if (ProjectUtil.isTizenProject(project))
          {
            result = true;
            break;
          }
        }
      }
    }
    return result;
  }
  
  public static boolean existProjectAndDeviceBeforeLaunch(IProject project, IWorkbenchWindow window)
  {
    boolean result = false;
    if (!project.exists())
    {
      MessageDialog.openError(window.getShell(), GomMessages.SMARTLAUNCH_FAIL, NLS.bind(GomMessages.SMARTLAUNCH_UNEXIST_PROJECT, project.getName()));
    }
    else if (ProjectUtil.isTizenNativeProject(project))
    {
      IDevice selectedDevice = ConnectionPlugin.getDefault().getCurrentDevice();
      if (selectedDevice != null) {
        result = true;
      } else {
        MessageDialog.openError(window.getShell(), GomMessages.SMARTLAUNCH_FAIL, GomMessages.SMARTLAUNCH_DISCONNECTED_DEVICE);
      }
    }
    else
    {
      result = true;
    }
    return result;
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.gom.smartlaunch.GomSmartLauncher
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.gom.smartlaunch.action;

import org.eclipse.debug.ui.actions.LaunchAction;
import org.tizen.common.gom.launch.GomLaunchData;

public class GomSmartLaunchAction
  extends LaunchAction
{
  public GomSmartLaunchAction(GomLaunchData data)
  {
    super(data.getLaunchConfiguration(), data.getMode());
    setText(data.getDataInfo());
    setToolTipText(data.toString());
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.gom.smartlaunch.action.GomSmartLaunchAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.gom.smartlaunch.action;

import org.eclipse.swt.events.MenuAdapter;
import org.eclipse.swt.events.MenuEvent;
import org.eclipse.swt.widgets.Menu;

class GomSmartLaunchToolbarAction$1
  extends MenuAdapter
{
  GomSmartLaunchToolbarAction$1(GomSmartLaunchToolbarAction paramGomSmartLaunchToolbarAction) {}
  
  public void menuShown(MenuEvent e)
  {
    this$0.fillMenu((Menu)widget);
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.gom.smartlaunch.action.GomSmartLaunchToolbarAction.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.gom.smartlaunch.action;

import org.eclipse.jface.action.Action;
import org.tizen.common.gom.smartlaunch.GomSmartLauncher;

class GomSmartLaunchToolbarAction$2
  extends Action
{
  GomSmartLaunchToolbarAction$2(GomSmartLaunchToolbarAction paramGomSmartLaunchToolbarAction) {}
  
  public void run()
  {
    GomSmartLauncher.openDialog(GomSmartLaunchToolbarAction.access$0(this$0));
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.gom.smartlaunch.action.GomSmartLaunchToolbarAction.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.gom.smartlaunch.action;

import java.util.List;
import org.eclipse.debug.ui.actions.LaunchAction;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.events.MenuAdapter;
import org.eclipse.swt.events.MenuEvent;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowPulldownDelegate2;
import org.tizen.common.gom.launch.GomLaunchData;
import org.tizen.common.gom.smartlaunch.GomSmartLaunchManager;
import org.tizen.common.gom.smartlaunch.GomSmartLauncher;
import org.tizen.common.gom.smartlaunch.messages.GomMessages;

public class GomSmartLaunchToolbarAction
  implements IWorkbenchWindowPulldownDelegate2
{
  private IWorkbenchWindow window;
  
  public Menu getMenu(Control parent)
  {
    Menu menu = new Menu(parent);
    addMenuListener(menu);
    return menu;
  }
  
  public void dispose()
  {
    GomSmartLaunchManager.getDefault().removeListener();
  }
  
  public void init(IWorkbenchWindow window)
  {
    this.window = window;
    GomSmartLaunchManager.getDefault().addListener();
  }
  
  public void run(IAction action)
  {
    List<GomLaunchData> list = GomSmartLaunchManager.getDefault().getLaunchList();
    int recentIndex = list.size() - 1;
    if (recentIndex > -1)
    {
      GomLaunchData data = (GomLaunchData)list.get(recentIndex);
      if (GomSmartLauncher.existProjectAndDeviceBeforeLaunch(data.getProject(), window)) {
        new GomSmartLaunchAction(data).run();
      }
    }
    else
    {
      GomSmartLauncher.openDialog(window);
    }
  }
  
  public void selectionChanged(IAction action, ISelection selection) {}
  
  public Menu getMenu(Menu parent)
  {
    Menu menu = new Menu(parent);
    addMenuListener(menu);
    return menu;
  }
  
  private void addMenuListener(Menu menu)
  {
    menu.addMenuListener(new MenuAdapter()
    {
      public void menuShown(MenuEvent e)
      {
        fillMenu((Menu)widget);
      }
    });
  }
  
  protected void fillMenu(Menu menu)
  {
    List<GomLaunchData> list = GomSmartLaunchManager.getDefault().getLaunchList();
    
    int listCount = list.size();
    int accelerator = 1;
    for (int i = list.size() - 1; i >= 0; i--)
    {
      GomLaunchData data = (GomLaunchData)list.get(i);
      LaunchAction action = new GomSmartLaunchAction(data);
      addToMenu(menu, action, accelerator);
      accelerator++;
    }
    if (listCount > 0) {
      new MenuItem(menu, 2);
    }
    Action addAction = new Action()
    {
      public void run()
      {
        GomSmartLauncher.openDialog(window);
      }
    };
    addAction.setText(GomMessages.SMARTLAUNCH_NEW);
    addToMenu(menu, addAction, accelerator);
  }
  
  protected void addToMenu(Menu menu, IAction action, int accelerator)
  {
    StringBuffer label = new StringBuffer();
    if ((accelerator >= 0) && (accelerator < 10))
    {
      label.append('&');
      label.append(accelerator);
      label.append(' ');
    }
    label.append(action.getText());
    action.setText(label.toString());
    ActionContributionItem item = new ActionContributionItem(action);
    item.fill(menu, -1);
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.gom.smartlaunch.action.GomSmartLaunchToolbarAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.gom.smartlaunch.handler;

import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.widgets.Shell;

class GomSmartLaunchCycleHandler$1
  implements FocusListener
{
  GomSmartLaunchCycleHandler$1(GomSmartLaunchCycleHandler paramGomSmartLaunchCycleHandler, Shell paramShell) {}
  
  public void focusGained(FocusEvent e) {}
  
  public void focusLost(FocusEvent e)
  {
    GomSmartLaunchCycleHandler.access$0(this$0, val$dialog);
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.gom.smartlaunch.handler.GomSmartLaunchCycleHandler.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.gom.smartlaunch.handler;

import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;

class GomSmartLaunchCycleHandler$2
  implements MouseMoveListener
{
  TableItem lastItem = null;
  
  GomSmartLaunchCycleHandler$2(GomSmartLaunchCycleHandler paramGomSmartLaunchCycleHandler, Table paramTable) {}
  
  public void mouseMove(MouseEvent e)
  {
    if (val$table.equals(e.getSource()))
    {
      Object o = val$table.getItem(new Point(x, y));
      if (((lastItem == null ? 1 : 0) ^ (o == null ? 1 : 0)) != 0) {
        val$table.setCursor(o == null ? null : val$table.getDisplay().getSystemCursor(
          21));
      }
      if ((o instanceof TableItem))
      {
        if (!o.equals(lastItem))
        {
          lastItem = ((TableItem)o);
          val$table.setSelection(new TableItem[] { lastItem });
        }
      }
      else if (o == null) {
        lastItem = null;
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.gom.smartlaunch.handler.GomSmartLaunchCycleHandler.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.gom.smartlaunch.handler;

import java.util.List;
import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.ParameterizedCommand;
import org.eclipse.core.resources.IProject;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.internal.CycleBaseHandler;
import org.eclipse.ui.internal.WorkbenchPage;
import org.tizen.common.gom.launch.GomLaunchData;
import org.tizen.common.gom.smartlaunch.GomSmartLaunchManager;
import org.tizen.common.gom.smartlaunch.GomSmartLauncher;
import org.tizen.common.gom.smartlaunch.messages.GomMessages;
import org.tizen.sdblib.IDevice;

public class GomSmartLaunchCycleHandler
  extends CycleBaseHandler
{
  private final String TIZEN_SMART_LAUNCH_DOWN_ID = "org.tizen.common.gom.smartlaunch.ui.tizensmartlauncher.down";
  private final String TIZEN_SMART_LAUNCH_UP_ID = "org.tizen.common.gom.smartlaunch.ui.tizensmartlauncher.up";
  private String[] sampleColumns = { "Profile", "ProjectProject", "LaunchConfigurationLaunchConfiguration", "emulator-xxxxx" };
  private String[] columns = { GomMessages.SMARTLAUNCH_CYCLE_COLUMNS_1, GomMessages.SMARTLAUNCH_CYCLE_COLUMNS_2, GomMessages.SMARTLAUNCH_CYCLE_COLUMNS_3, GomMessages.SMARTLAUNCH_CYCLE_COLUMNS_4 };
  
  protected void addItems(Table table, WorkbenchPage page)
  {
    List<GomLaunchData> list = GomSmartLaunchManager.getDefault().getLaunchList();
    setTable(table, list);
  }
  
  protected ParameterizedCommand getBackwardCommand()
  {
    ICommandService commandService = (ICommandService)window
      .getWorkbench().getService(ICommandService.class);
    Command command = commandService
      .getCommand("org.tizen.common.gom.smartlaunch.ui.tizensmartlauncher.up");
    ParameterizedCommand commandBack = new ParameterizedCommand(command, 
      null);
    return commandBack;
  }
  
  protected ParameterizedCommand getForwardCommand()
  {
    ICommandService commandService = (ICommandService)window
      .getWorkbench().getService(ICommandService.class);
    Command command = commandService
      .getCommand("org.tizen.common.gom.smartlaunch.ui.tizensmartlauncher.down");
    ParameterizedCommand commandForward = new ParameterizedCommand(command, null);
    return commandForward;
  }
  
  protected String getTableHeader(IWorkbenchPart activePart)
  {
    return null;
  }
  
  /* Error */
  protected void openDialog(WorkbenchPage page, IWorkbenchPart activePart)
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_3
    //   2: aload_2
    //   3: ifnull +15 -> 18
    //   6: aload_2
    //   7: invokeinterface 124 1 0
    //   12: invokeinterface 130 1 0
    //   17: astore_3
    //   18: aload_3
    //   19: ifnonnull +13 -> 32
    //   22: aload_0
    //   23: getfield 83	org/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler:window	Lorg/eclipse/ui/IWorkbenchWindow;
    //   26: invokeinterface 136 1 0
    //   31: astore_3
    //   32: new 137	org/eclipse/swt/widgets/Shell
    //   35: dup
    //   36: aload_3
    //   37: iconst_0
    //   38: invokespecial 139	org/eclipse/swt/widgets/Shell:<init>	(Lorg/eclipse/swt/widgets/Shell;I)V
    //   41: astore 4
    //   43: aload 4
    //   45: invokevirtual 142	org/eclipse/swt/widgets/Shell:getDisplay	()Lorg/eclipse/swt/widgets/Display;
    //   48: astore 5
    //   50: aload 4
    //   52: new 146	org/eclipse/swt/layout/FillLayout
    //   55: dup
    //   56: invokespecial 148	org/eclipse/swt/layout/FillLayout:<init>	()V
    //   59: invokevirtual 149	org/eclipse/swt/widgets/Shell:setLayout	(Lorg/eclipse/swt/widgets/Layout;)V
    //   62: new 153	org/eclipse/swt/widgets/Table
    //   65: dup
    //   66: aload 4
    //   68: ldc -101
    //   70: invokespecial 156	org/eclipse/swt/widgets/Table:<init>	(Lorg/eclipse/swt/widgets/Composite;I)V
    //   73: astore 6
    //   75: aload 6
    //   77: iconst_1
    //   78: invokevirtual 159	org/eclipse/swt/widgets/Table:setHeaderVisible	(Z)V
    //   81: aload 6
    //   83: iconst_1
    //   84: invokevirtual 163	org/eclipse/swt/widgets/Table:setLinesVisible	(Z)V
    //   87: iconst_0
    //   88: istore 7
    //   90: goto +27 -> 117
    //   93: aload_0
    //   94: aload 6
    //   96: aload_0
    //   97: getfield 47	org/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler:sampleColumns	[Ljava/lang/String;
    //   100: iload 7
    //   102: aaload
    //   103: aload_0
    //   104: getfield 37	org/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler:columns	[Ljava/lang/String;
    //   107: iload 7
    //   109: aaload
    //   110: invokespecial 166	org/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler:createTableColumn	(Lorg/eclipse/swt/widgets/Table;Ljava/lang/String;Ljava/lang/String;)Lorg/eclipse/swt/widgets/TableColumn;
    //   113: pop
    //   114: iinc 7 1
    //   117: iload 7
    //   119: aload_0
    //   120: getfield 37	org/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler:columns	[Ljava/lang/String;
    //   123: arraylength
    //   124: if_icmplt -31 -> 93
    //   127: aload_0
    //   128: aload 6
    //   130: aload_1
    //   131: invokevirtual 170	org/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler:addItems	(Lorg/eclipse/swt/widgets/Table;Lorg/eclipse/ui/internal/WorkbenchPage;)V
    //   134: aload 6
    //   136: invokevirtual 172	org/eclipse/swt/widgets/Table:getItemCount	()I
    //   139: istore 7
    //   141: iload 7
    //   143: tableswitch	default:+37->180, 0:+21->164, 1:+28->171
    //   164: aload_0
    //   165: aload 4
    //   167: invokevirtual 176	org/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler:cancel	(Lorg/eclipse/swt/widgets/Shell;)V
    //   170: return
    //   171: aload 6
    //   173: iconst_0
    //   174: invokevirtual 180	org/eclipse/swt/widgets/Table:setSelection	(I)V
    //   177: goto +57 -> 234
    //   180: aload_0
    //   181: getfield 184	org/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler:gotoDirection	Z
    //   184: ifeq +24 -> 208
    //   187: aload_0
    //   188: invokevirtual 188	org/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler:getCurrentItemIndex	()I
    //   191: iconst_1
    //   192: iadd
    //   193: istore 8
    //   195: iload 8
    //   197: iload 7
    //   199: if_icmplt +28 -> 227
    //   202: iconst_0
    //   203: istore 8
    //   205: goto +22 -> 227
    //   208: aload_0
    //   209: invokevirtual 188	org/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler:getCurrentItemIndex	()I
    //   212: iconst_1
    //   213: isub
    //   214: istore 8
    //   216: iload 8
    //   218: ifge +9 -> 227
    //   221: iload 7
    //   223: iconst_1
    //   224: isub
    //   225: istore 8
    //   227: aload 6
    //   229: iload 8
    //   231: invokevirtual 180	org/eclipse/swt/widgets/Table:setSelection	(I)V
    //   234: aload 6
    //   236: invokevirtual 191	org/eclipse/swt/widgets/Table:pack	()V
    //   239: aload 4
    //   241: invokevirtual 194	org/eclipse/swt/widgets/Shell:pack	()V
    //   244: aload 6
    //   246: invokevirtual 195	org/eclipse/swt/widgets/Table:getBounds	()Lorg/eclipse/swt/graphics/Rectangle;
    //   249: astore 8
    //   251: aload 8
    //   253: aload 8
    //   255: getfield 199	org/eclipse/swt/graphics/Rectangle:height	I
    //   258: aload 6
    //   260: invokevirtual 205	org/eclipse/swt/widgets/Table:getItemHeight	()I
    //   263: bipush 22
    //   265: imul
    //   266: invokestatic 208	java/lang/Math:min	(II)I
    //   269: putfield 199	org/eclipse/swt/graphics/Rectangle:height	I
    //   272: aload 6
    //   274: aload 8
    //   276: invokevirtual 214	org/eclipse/swt/widgets/Table:setBounds	(Lorg/eclipse/swt/graphics/Rectangle;)V
    //   279: aload 4
    //   281: aload 4
    //   283: aload 8
    //   285: getfield 218	org/eclipse/swt/graphics/Rectangle:x	I
    //   288: aload 8
    //   290: getfield 221	org/eclipse/swt/graphics/Rectangle:y	I
    //   293: aload 8
    //   295: getfield 224	org/eclipse/swt/graphics/Rectangle:width	I
    //   298: aload 8
    //   300: getfield 199	org/eclipse/swt/graphics/Rectangle:height	I
    //   303: invokevirtual 227	org/eclipse/swt/widgets/Shell:computeTrim	(IIII)Lorg/eclipse/swt/graphics/Rectangle;
    //   306: invokevirtual 231	org/eclipse/swt/widgets/Shell:setBounds	(Lorg/eclipse/swt/graphics/Rectangle;)V
    //   309: aload 6
    //   311: invokevirtual 232	org/eclipse/swt/widgets/Table:setFocus	()Z
    //   314: pop
    //   315: aload 6
    //   317: new 236	org/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler$1
    //   320: dup
    //   321: aload_0
    //   322: aload 4
    //   324: invokespecial 238	org/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler$1:<init>	(Lorg/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler;Lorg/eclipse/swt/widgets/Shell;)V
    //   327: invokevirtual 241	org/eclipse/swt/widgets/Table:addFocusListener	(Lorg/eclipse/swt/events/FocusListener;)V
    //   330: aload 6
    //   332: new 245	org/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler$2
    //   335: dup
    //   336: aload_0
    //   337: aload 6
    //   339: invokespecial 247	org/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler$2:<init>	(Lorg/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler;Lorg/eclipse/swt/widgets/Table;)V
    //   342: invokevirtual 250	org/eclipse/swt/widgets/Table:addMouseMoveListener	(Lorg/eclipse/swt/events/MouseMoveListener;)V
    //   345: aload_0
    //   346: aload 4
    //   348: aload_2
    //   349: invokevirtual 254	org/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler:setDialogLocation	(Lorg/eclipse/swt/widgets/Shell;Lorg/eclipse/ui/IWorkbenchPart;)V
    //   352: aload_0
    //   353: getfield 83	org/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler:window	Lorg/eclipse/ui/IWorkbenchWindow;
    //   356: invokeinterface 87 1 0
    //   361: ldc_w 258
    //   364: invokeinterface 95 2 0
    //   369: checkcast 258	org/eclipse/ui/contexts/IContextService
    //   372: astore 9
    //   374: aload 4
    //   376: invokevirtual 260	org/eclipse/swt/widgets/Shell:open	()V
    //   379: aload_0
    //   380: aload 6
    //   382: aload 4
    //   384: invokevirtual 263	org/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler:addMouseListener	(Lorg/eclipse/swt/widgets/Table;Lorg/eclipse/swt/widgets/Shell;)V
    //   387: aload 9
    //   389: aload 4
    //   391: iconst_1
    //   392: invokeinterface 267 3 0
    //   397: pop
    //   398: aload_0
    //   399: aload 6
    //   401: aload 4
    //   403: invokevirtual 271	org/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler:addKeyListener	(Lorg/eclipse/swt/widgets/Table;Lorg/eclipse/swt/widgets/Shell;)V
    //   406: aload_0
    //   407: aload 6
    //   409: invokevirtual 274	org/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler:addTraverseListener	(Lorg/eclipse/swt/widgets/Table;)V
    //   412: goto +17 -> 429
    //   415: aload 5
    //   417: invokevirtual 278	org/eclipse/swt/widgets/Display:readAndDispatch	()Z
    //   420: ifne +9 -> 429
    //   423: aload 5
    //   425: invokevirtual 283	org/eclipse/swt/widgets/Display:sleep	()Z
    //   428: pop
    //   429: aload 4
    //   431: invokevirtual 286	org/eclipse/swt/widgets/Shell:isDisposed	()Z
    //   434: ifeq -19 -> 415
    //   437: goto +32 -> 469
    //   440: astore 10
    //   442: aload 4
    //   444: invokevirtual 286	org/eclipse/swt/widgets/Shell:isDisposed	()Z
    //   447: ifne +9 -> 456
    //   450: aload_0
    //   451: aload 4
    //   453: invokevirtual 176	org/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler:cancel	(Lorg/eclipse/swt/widgets/Shell;)V
    //   456: aload 9
    //   458: aload 4
    //   460: invokeinterface 289 2 0
    //   465: pop
    //   466: aload 10
    //   468: athrow
    //   469: aload 4
    //   471: invokevirtual 286	org/eclipse/swt/widgets/Shell:isDisposed	()Z
    //   474: ifne +9 -> 483
    //   477: aload_0
    //   478: aload 4
    //   480: invokevirtual 176	org/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler:cancel	(Lorg/eclipse/swt/widgets/Shell;)V
    //   483: aload 9
    //   485: aload 4
    //   487: invokeinterface 289 2 0
    //   492: pop
    //   493: return
    // Line number table:
    //   Java source line #104	-> byte code offset #0
    //   Java source line #105	-> byte code offset #2
    //   Java source line #106	-> byte code offset #6
    //   Java source line #107	-> byte code offset #18
    //   Java source line #108	-> byte code offset #22
    //   Java source line #109	-> byte code offset #32
    //   Java source line #110	-> byte code offset #43
    //   Java source line #111	-> byte code offset #50
    //   Java source line #113	-> byte code offset #62
    //   Java source line #114	-> byte code offset #75
    //   Java source line #115	-> byte code offset #81
    //   Java source line #117	-> byte code offset #87
    //   Java source line #119	-> byte code offset #93
    //   Java source line #117	-> byte code offset #114
    //   Java source line #122	-> byte code offset #127
    //   Java source line #123	-> byte code offset #134
    //   Java source line #125	-> byte code offset #141
    //   Java source line #127	-> byte code offset #164
    //   Java source line #128	-> byte code offset #170
    //   Java source line #130	-> byte code offset #171
    //   Java source line #131	-> byte code offset #177
    //   Java source line #134	-> byte code offset #180
    //   Java source line #135	-> byte code offset #187
    //   Java source line #136	-> byte code offset #195
    //   Java source line #137	-> byte code offset #202
    //   Java source line #139	-> byte code offset #208
    //   Java source line #140	-> byte code offset #216
    //   Java source line #141	-> byte code offset #221
    //   Java source line #143	-> byte code offset #227
    //   Java source line #146	-> byte code offset #234
    //   Java source line #147	-> byte code offset #239
    //   Java source line #149	-> byte code offset #244
    //   Java source line #150	-> byte code offset #251
    //   Java source line #151	-> byte code offset #263
    //   Java source line #150	-> byte code offset #266
    //   Java source line #152	-> byte code offset #272
    //   Java source line #154	-> byte code offset #279
    //   Java source line #155	-> byte code offset #293
    //   Java source line #154	-> byte code offset #303
    //   Java source line #157	-> byte code offset #309
    //   Java source line #158	-> byte code offset #315
    //   Java source line #168	-> byte code offset #330
    //   Java source line #190	-> byte code offset #345
    //   Java source line #192	-> byte code offset #352
    //   Java source line #193	-> byte code offset #356
    //   Java source line #192	-> byte code offset #369
    //   Java source line #195	-> byte code offset #374
    //   Java source line #196	-> byte code offset #379
    //   Java source line #197	-> byte code offset #387
    //   Java source line #198	-> byte code offset #398
    //   Java source line #199	-> byte code offset #406
    //   Java source line #201	-> byte code offset #412
    //   Java source line #202	-> byte code offset #415
    //   Java source line #203	-> byte code offset #423
    //   Java source line #201	-> byte code offset #429
    //   Java source line #206	-> byte code offset #440
    //   Java source line #207	-> byte code offset #442
    //   Java source line #208	-> byte code offset #450
    //   Java source line #210	-> byte code offset #456
    //   Java source line #211	-> byte code offset #466
    //   Java source line #207	-> byte code offset #469
    //   Java source line #208	-> byte code offset #477
    //   Java source line #210	-> byte code offset #483
    //   Java source line #212	-> byte code offset #493
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	494	0	this	GomSmartLaunchCycleHandler
    //   0	494	1	page	WorkbenchPage
    //   0	494	2	activePart	IWorkbenchPart
    //   1	36	3	shell	Shell
    //   41	445	4	dialog	Shell
    //   48	376	5	display	Display
    //   73	335	6	table	Table
    //   88	30	7	i	int
    //   139	83	7	tableItemCount	int
    //   193	11	8	i	int
    //   214	16	8	i	int
    //   249	50	8	tableBounds	org.eclipse.swt.graphics.Rectangle
    //   372	112	9	contextService	org.eclipse.ui.contexts.IContextService
    //   440	27	10	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   374	440	440	finall
1 2

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd