Examples of IResolve


Examples of org.locationtech.udig.catalog.IResolve

     * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
     */
    public Object getParent( Object element ) {
        if (!(element instanceof IResolve))
            return null;
        IResolve resolve = (IResolve) element;
        try {
            // assume find parent is cheap
            if (element instanceof IService) {
                if (list != null && list.contains(resolve))
                    return list;
View Full Code Here

Examples of org.locationtech.udig.catalog.IResolve

                        } catch (IOException e) {
                            CatalogUIPlugin.log(null, e);
                        }
                    }
                }
                IResolve service = (IResolve) parentElement;
                List<IResolve> children = getGeoResources(service, true);
                if( children.isEmpty() ){
                    if( parentElement instanceof IService ){
                        grayedElements.add(service);
                        if( service.getStatus()==Status.BROKEN ){
                            if( service.getMessage()!=null ) {
                                String string = Messages.ResourceSelectionPage_brokenReportError+service.getMessage().getLocalizedMessage();
                                grayedElements.add(string);
                                return new String[]{string};
                            } else{
                                String string = Messages.ResourceSelectionPage_brokenUnknown;
                                grayedElements.add(string);
                                return new String[]{string};
                            }
                        }
                        if( service.getStatus()==Status.RESTRICTED_ACCESS ){
                            String string = Messages.ResourceSelectionPage_noPermission;
                            grayedElements.add(string);
                            return new String[]{string};
                        }
                        if( service.getStatus()==Status.CONNECTED ){
                            String string = Messages.ResourceSelectionPage_connectedButNoResources;
                            grayedElements.add(string);
                            return new String[]{string};
                        }
                    }else{
View Full Code Here

Examples of org.locationtech.udig.catalog.IResolve

        return;
      }
        if ( event.getType() != IResolveChangeEvent.Type.POST_CHANGE) {
            return;
        }
        IResolve resolve = event.getResolve();
        if (threadFarm.containsKey(resolve)) {
            update(resolve);
        }
    }
View Full Code Here

Examples of org.locationtech.udig.catalog.IResolve

            return new String[]{Messages.ResourceSelectionPage_noServices};
        }

        public Object getParent( Object element ) {
            if (element instanceof IResolve) {
                IResolve resource = (IResolve) element;
                try {
                    return resource.parent(new  NullProgressMonitor());
                } catch (IOException e) {
                    CatalogUIPlugin.log(null, e);
                }
            }
            return null;
View Full Code Here

Examples of org.locationtech.udig.catalog.IResolve

        }

        @Override
        public String getText( Object element ) {
            if (element instanceof IResolve) {
                IResolve resolver = (IResolve) element;
                return resolver.getIdentifier().toString();
            }
            return null;
        }
View Full Code Here

Examples of org.locationtech.udig.catalog.IResolve

        if( selection instanceof IStructuredSelection ){
            IStructuredSelection sel=(IStructuredSelection) selection;
            if( sel.size()==1 ){
                Object obj=sel.getFirstElement();
                if (obj instanceof IResolve) {
                    IResolve resolve = (IResolve) obj;
                    if( resolve.getStatus()==Status.BROKEN ){
                        if (null == resolve.getMessage()) {
                            messageBoard.putMessage(Messages.CatalogTreeViewer_broken, IMessageBoard.Type.ERROR);
                        } else {
                            messageBoard.putMessage(resolve.getMessage().getLocalizedMessage(), IMessageBoard.Type.ERROR);  
                        }
                    }else if( resolve.getStatus()==Status.RESTRICTED_ACCESS ){
                        messageBoard.putMessage(Messages.CatalogTreeViewer_permission, IMessageBoard.Type.ERROR);
                    }else{
                        messageBoard.putMessage(null, IMessageBoard.Type.NORMAL);
                    }
View Full Code Here

Examples of org.locationtech.udig.catalog.IResolve

    if (services.isEmpty()) {
      return null;
    }
    for (IService service : services) {
      IResolve resolve;
      IGeoResource geoR;
      try {
        resolve = service.members(null).get(0);
        geoR = resolve.resolve(IGeoResource.class, new NullProgressMonitor());
        return geoR;
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
View Full Code Here

Examples of org.locationtech.udig.catalog.IResolve

                else if (element instanceof IGeoResource ){
                    IGeoResource resource = (IGeoResource) element;
                    return toServiceSelection(resource);
                }
                else if (element instanceof IResolve ){
                    IResolve resolve = (IResolve) element;
                    if( resolve.canResolve( IService.class)){
                        try {
                            IService service = resolve.resolve( IService.class, new NullProgressMonitor() );
                            return new StructuredSelection( service );
                        } catch (IOException e) {
                            return StructuredSelection.EMPTY;
                        }
                    }
                }
                // check IAdaptable incase ILayer or another selection wants to play
                if( element instanceof IAdaptable ){
                    IAdaptable adaptable = (IAdaptable) element;
                    IService service = (IService) adaptable.getAdapter(IService.class);
                    if( service != null ){
                        return new StructuredSelection( service );
                    }
                    IGeoResource resource = (IGeoResource) adaptable.getAdapter(IGeoResource.class);
                    if( resource != null ){
                        return toServiceSelection(resource);
                    }
                    IResolve resolve = (IResolve) adaptable.getAdapter(IResolve.class);
                    if( resolve != null ){
                        if( resolve.canResolve( IService.class)){
                            try {
                                service = resolve.resolve( IService.class, new NullProgressMonitor() );
                                return new StructuredSelection( service );
                            } catch (IOException e) {
                                return StructuredSelection.EMPTY;
                            }
                        }                       
View Full Code Here

Examples of org.locationtech.udig.catalog.IResolve

     */
    public void changed( final IResolveChangeEvent event ) {
        if (event.getType() != IResolveChangeEvent.Type.POST_CHANGE)
            return;

        final IResolve resolve = event.getResolve();
        if (resolve == null)
            return;

        Display.getDefault().asyncExec(new Runnable(){
            public void run() {
View Full Code Here

Examples of org.locationtech.udig.catalog.IResolve

     * @param element
     * @return label based on IResolve.getIdentifier
     */
    public String getText( Object element ) {
        if (element instanceof IResolve) {
            IResolve resolve = (IResolve) element;
            try {
                if (resolve instanceof IGeoResource) {
                    IGeoResource resource = (IGeoResource) resolve;
                    String title = resource.getTitle();
// This provider should be non-blocking                   
//                    if (title == null) {
//                        IGeoResourceInfo info = resource.getInfo(new NullProgressMonitor());
//                        if(info != null) {
//                          title = info.getTitle();
//                        }
//                    }
                    ID id = resource.getID();
                    if(title == null) {
                      title = id.labelResource();
                    }
                    return title;

                } else if (resolve instanceof IService) {
                    IService service = (IService) resolve;
                    ID id = service.getID();

                    String title = service.getTitle();
//                    if (title == null) {
//                        IServiceInfo info = service.getInfo(new NullProgressMonitor());
//                        if (info != null) {
//                            title = info.getTitle();
//                        }
//                    }
                    if (title == null) {
                        // we are going to fake something here
                        String name = id.toString();
                        name = name.replace('_', ' ');
                        name = name.replace("%20", " "); //$NON-NLS-1$ //$NON-NLS-2$
                        return name;
                    }
                    if (id.getTypeQualifier() != null) {
                        return title + "(" + id.getTypeQualifier() + ")";
                    } else {
                        return title;
                    }
                } else if (resolve instanceof IProcess) {
                    IProcess proc = (IProcess) element;
                    return proc.getInfo(new NullProgressMonitor()).getTitle();
                } else if (resolve instanceof ISearch) {
                    ISearch search = (ISearch) element;
                    return search.getInfo(new NullProgressMonitor()).getTitle();
                } else if (resolve instanceof IResolveFolder) {
                    IResolveFolder folder = (IResolveFolder) element;
                    return folder.getID().toString();
                } else {
                    return resolve.getID().toString();
                }
            } catch (IOException e) {
                CatalogUIPlugin.trace("Error fetching the Title for the resource", e); //$NON-NLS-1$
            }
        }
View Full Code Here
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.