Package org.locationtech.udig.catalog

Examples of org.locationtech.udig.catalog.IService


        }

        if (prop instanceof Filter || prop instanceof Query) {
            try {
                IGeoResource geoResource = layer.findGeoResource(FeatureSource.class);
                IService service = geoResource.service(ProgressManager.instance().get());
               
                if (service != null) {
                    DataStore ds = service.resolve(DataStore.class,
                            ProgressManager.instance().get());
                    if (ds == null){
                        return resource; // not a datastore give up!
                    }
                    String typeName = resource.getSchema().getTypeName();
View Full Code Here


     */
    public Image decorateImage( Image image, Object element ) {
        if (!(element instanceof IService)) {
            return null;
        }
        IService service = (IService) element;
        if (image == null) {
            image = baseIcon(service);
        }
        switch( service.getStatus() ) {
        case CONNECTED:
            return overlayCache.applyStatus(image, CatalogUIPlugin.getDefault()
                    .getImageDescriptor(ImageConstants.CONNECTED_OVR));

        case NOTCONNECTED:
View Full Code Here

            IGeoResource resource = (IGeoResource) resolve;
            boolean isFeature = resource.canResolve(FeatureSource.class);
            String iconId = iconInternalResource( resource.getID(), isFeature );
            return CatalogUIPlugin.getDefault().getImage( iconId );
        } else if (resolve instanceof IService) {
            IService service = (IService) resolve;
            boolean isFeature = service.canResolve(DataStore.class);
           
            String iconId = iconInternalService( service.getID(), isFeature );
            return CatalogUIPlugin.getDefault().getImage( iconId );
        } else if (resolve instanceof ICatalog) {
            return CatalogUIPlugin.getDefault().getImage(ISharedImages.CATALOG_OBJ);
        }
        return CatalogUIPlugin.getDefault().getImage(ISharedImages.RESOURCE_OBJ);
View Full Code Here

    @Ignore
    @Test
    public void testSwitchStyle() throws Exception {
        LayerImpl layer = MapTests.createLayer(null, new RendererCreatorTestObjForSingleRenderer(), null);
        layer.setName("Layer1"); //$NON-NLS-1$
        IService createService = DummyService.createService(new URL("http://dummy77"), Collections.emptyList(), //$NON-NLS-1$
                        Collections.singletonList(Arrays.asList(new Object[]{new RendererCreatorTestObjForMulitRenderer()})));
        layer.getGeoResources().add(createService.resources(null).get(0));
       
        StyleBlackboard bb = layer.getStyleBlackboard();
       
        bb.put(SingleRendererStyleContent.ID, new SingleRendererStyleContent());
       
View Full Code Here

                        URL url = URLIterator.next();

                        try {
                            availableServices = catalog.constructServices(url, monitor);
                            if (!availableServices.isEmpty()) {
                                IService service = availableServices.iterator().next();
                                resourceIds.add(service.getIdentifier());
                                services.add(service);// add the first service
                            }
                        } catch (IOException e) {
                            throw (RuntimeException) new RuntimeException().initCause(e);
                        } finally {
                            List<IService> members = catalog.checkMembers(availableServices);

                            for( Iterator<IService> iterator = members.iterator(); iterator
                                    .hasNext(); ) {
                                IService service = iterator.next();

                                if (service.equals(service)) continue;

                                service.dispose(new SubProgressMonitor(monitor, 10));
                            }
                            monitor.done();
                        }

                    }
View Full Code Here

                }
                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 ){
View Full Code Here

            }
            return StructuredSelection.EMPTY; // no dice!
        }
        private ISelection toServiceSelection(IGeoResource resource) {
            try {
                IService service = resource.service( new NullProgressMonitor() );
                return new StructuredSelection( service );
            } catch (IOException e) {
                return StructuredSelection.EMPTY;
            }
        }
View Full Code Here

                      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();
//                        }
View Full Code Here

            ListViewer listViewer = new ListViewer(root);
            listViewer.setLabelProvider(new LabelProvider(){
                @Override
                public String getText( Object element ) {
                    IService service = (IService) element;
                    return service.getIdentifier().toString();
                }
            });
            listViewer.setContentProvider(new ArrayContentProvider());
            listViewer.setInput(errors.keySet().toArray());

            final Text text = new Text(root, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL
                    | SWT.SCROLL_LINE);

            FormData layoutData = new FormData();
            layoutData.top = new FormAttachment(0);
            layoutData.left = new FormAttachment(0);
            label.setLayoutData(layoutData);

            layoutData = new FormData();
            layoutData.top = new FormAttachment(label, 2, SWT.BOTTOM);
            layoutData.left = new FormAttachment(0);
            layoutData.right = new FormAttachment(100);
            layoutData.bottom = new FormAttachment(50);
            listViewer.getList().setLayoutData(layoutData);

            layoutData = new FormData();
            layoutData.top = new FormAttachment(listViewer.getList(), 2, SWT.BOTTOM);
            layoutData.left = new FormAttachment(0);
            layoutData.right = new FormAttachment(100);
            layoutData.bottom = new FormAttachment(100);
            text.setLayoutData(layoutData);

            listViewer.addSelectionChangedListener(new ISelectionChangedListener(){

                public void selectionChanged( SelectionChangedEvent event ) {
                    IStructuredSelection selection = (IStructuredSelection) event.getSelection();
                    if (selection == null || selection.isEmpty())
                        return;

                    IService service = (IService) selection.getFirstElement();
                    Throwable t = errors.get(service);

                    ByteArrayOutputStream out = new ByteArrayOutputStream();
                    t.printStackTrace(new PrintStream(out));
                    text.setText(new String(out.toByteArray()));
View Full Code Here

                CatalogUIPlugin.trace("Reset service " + original.getIdentifier()); //$NON-NLS-1$

                Map<java.lang.String, java.io.Serializable>
                    connectionParams = original.getConnectionParams();

                IService replacement = null; // unknown
                TEST: for( IService candidate : serviceFactory.createService(connectionParams) ) {
                    try {
                        CatalogUIPlugin.trace(id + " : connecting"); //$NON-NLS-1$
                        IServiceInfo info = candidate.getInfo(monitor);
                       
View Full Code Here

TOP

Related Classes of org.locationtech.udig.catalog.IService

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.