Package de.innovationgate.eclipse.editors.design.wizards

Source Code of de.innovationgate.eclipse.editors.design.wizards.NewWGAPortletFolderSelectionPage

/*******************************************************************************
* Copyright (c) 2009, 2010 Innovation Gate GmbH.
* 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:
*     Innovation Gate GmbH - initial API and implementation
******************************************************************************/
package de.innovationgate.eclipse.editors.design.wizards;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.core.resources.IContainer;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.IStructuredSelection;

import de.innovationgate.eclipse.editors.Plugin;
import de.innovationgate.eclipse.editors.helpers.TMLModulFolderSelectionViewFilter;
import de.innovationgate.eclipse.utils.FolderSelectionViewFilter;
import de.innovationgate.eclipse.utils.ui.DesignResourceSelectionPage;
import de.innovationgate.eclipse.utils.wga.WGADesignStructureHelper;

public class NewWGAPortletFolderSelectionPage extends DesignResourceSelectionPage {
 
  public NewWGAPortletFolderSelectionPage(String title, String description, IStructuredSelection preSelection) {
    super(title, description, preSelection);
    setTitle(title);
  }

  @Override
  public List<IStatus> validate() {
    List<IStatus> list = new ArrayList<IStatus>();
    if (getTreeViewer().getTree().getSelectionCount() > 0) {
      IContainer treeSelection = (IContainer) getTreeViewer().getTree().getSelection()[0].getData();
      if (!WGADesignStructureHelper.isValidPortletLocation(treeSelection)) {
        list.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "You cannot create a portlet here. Please select a folder below the tml folder."));
      }
    } else {
      list.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "There is no designfolder in workspace."));
    }
    return list;
  }

  @Override
  protected FolderSelectionViewFilter getFilter() {
    return new TMLModulFolderSelectionViewFilter();
  }

  @Override
  protected String getPathNameUnderDesign() {
    return "tml";
  }
}
TOP

Related Classes of de.innovationgate.eclipse.editors.design.wizards.NewWGAPortletFolderSelectionPage

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.