Package org.eclipse.swtbot.eclipse.finder.widgets.helpers

Source Code of org.eclipse.swtbot.eclipse.finder.widgets.helpers.PackageExplorerView

/*******************************************************************************
* Copyright (c) 2008 Ketan Padegaonkar 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:
*     Ketan Padegaonkar - initial API and implementation
*******************************************************************************/
package org.eclipse.swtbot.eclipse.finder.widgets.helpers;

import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;

import org.eclipse.swt.widgets.Button;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;

/**
* Screen object that represents the operations that can be performed on the package explorer view.
*
* @author Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com>
* @version $Id$
*/
public class PackageExplorerView {

  private SWTWorkbenchBot  bot  = new SWTWorkbenchBot();

  public void deleteProject(String projectName) throws Exception {
    SWTBotTree tree = tree();
    tree.setFocus();
    tree.select(projectName);
    bot.menu("Edit").menu("Delete").click();
    SWTBotShell shell = bot.shell("Delete Resources");
    shell.activate();
    Button button = bot.widget(widgetOfType(Button.class), shell.widget);
    new SWTBotCheckBox(button).select();
    bot.button("OK").click();
    bot.waitUntil(Conditions.shellCloses(shell));
  }

  /**
   * @return
   * @throws WidgetNotFoundException
   */
  private SWTBotTree tree() throws WidgetNotFoundException {
    return view().bot().tree();
  }

  /**
   * @return
   * @throws WidgetNotFoundException
   */
  private SWTBotView view() throws WidgetNotFoundException {
    return bot.viewByTitle("Package Explorer");
  }

}
TOP

Related Classes of org.eclipse.swtbot.eclipse.finder.widgets.helpers.PackageExplorerView

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.