Package org.locationtech.udig.project.internal

Examples of org.locationtech.udig.project.internal.ProjectElement


    public boolean accept() {
       
        Collection<ProjectElement> elements = new HashSet<ProjectElement>(toProjectElements());
       
        for( Iterator<ProjectElement> iterator = elements.iterator(); iterator.hasNext(); ) {
            ProjectElement projectElement = iterator.next();
            if( getDestination().equals(projectElement.getProject())){
                iterator.remove();
            }
        }
       
        if (elements == null || elements.isEmpty())
View Full Code Here


        return true;
    }

    private Collection<ProjectElement> toProjectElements() {
        if (getData() instanceof ProjectElement) {
            ProjectElement element = (ProjectElement) getData();
            return Collections.singleton(element);
        }

        if (getData() instanceof EObject) {
            EObject eobj = (EObject) getData();
            while( eobj != null && !(eobj instanceof ProjectElement) )
                eobj = eobj.eContainer();

            if (eobj instanceof ProjectElement)
                return Collections.singleton((ProjectElement) eobj);

            return null;
        }

        Object[] array = null;
        if (getData() instanceof Collection< ? >) {
            Collection< ? > data = (Collection< ? >) getData();
            array=data.toArray();
        }
        if(getData().getClass().isArray()){
            array=(Object[]) getData();
        }
        if (array != null) {
            Collection<ProjectElement> elements = new HashSet<ProjectElement>();

            for( Object object : array ) {
                if (object instanceof ProjectElement) {
                    ProjectElement element = (ProjectElement) object;
                    elements.add(element);
                }

                if (object instanceof EObject) {
                    EObject eobj = (EObject) object;
View Full Code Here

        if (!(obj instanceof ProjectElement))
            throw new IllegalArgumentException(
                    Messages.ApplicationGIS_noProjectElement
                            + obj.getClass().getSimpleName());

        ProjectElement elem = (ProjectElement) obj;
        ((Project) project).getElementsInternal().add(elem);

        return elem;
    }
View Full Code Here

            if (result == null)
                result = defaultCase(theEObject);
            return result;
        }
        case ProjectPackage.PROJECT_ELEMENT: {
            ProjectElement projectElement = (ProjectElement) theEObject;
            T result = caseProjectElement(projectElement);
            if (result == null)
                result = caseIProjectElement(projectElement);
            if (result == null)
                result = caseIAdaptable(projectElement);
View Full Code Here

  /*
   * Test method for 'org.locationtech.udig.project.ui.internal.actions.Delete.operate(ProjectElement)'
   */
  @Test
  public void testOperateProjectElement() {
    ProjectElement element = project.getElementsInternal().get(0);
    Resource resource=element.eResource();
    DeleteAccessor deleteAction=new DeleteAccessor();
    deleteAction.runDoDelete(element, false, Window.OK);
   
    assertNull(element.getProject());
    assertNull(element.eResource());
   
    assertEquals(0, resource.getContents().size());
    assertFalse(resource.isLoaded());
  }
View Full Code Here

        // Limit the projects view to only show Maps and Pages (and not go any deeper)
        ViewerFilter[] filters = new ViewerFilter[1];
        filters[0] = new ViewerFilter(){
            public boolean select( Viewer viewer, Object parentElement, Object element ) {
                if (element instanceof ProjectElement && parentElement instanceof Project) {
                    ProjectElement mapElement = (ProjectElement) element;
                    Project projectElement = (Project) parentElement;

                    List<ProjectElement> elements = projectElement
                            .getElements(ProjectElement.class);
                    for( ProjectElement pElem : elements ) {
View Full Code Here

TOP

Related Classes of org.locationtech.udig.project.internal.ProjectElement

Copyright © 2018 www.massapicom. 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.