Package org.eclipse.core.runtime

Examples of org.eclipse.core.runtime.SubProgressMonitor


*/
public class ConvertFeatureToNewSchema {

  public void doConversion( IMap map, Filter filter, IProgressMonitor monitor ) throws IOException{
    monitor.beginTask("Copy Features", 30);
    FeatureSource<SimpleFeatureType, SimpleFeature> source=map.getMapLayers().get(0).getResource(FeatureSource.class, new SubProgressMonitor(monitor, 1));
    final FeatureStore<SimpleFeatureType, SimpleFeature> dest=map.getMapLayers().get(1).getResource(FeatureStore.class, new SubProgressMonitor(monitor, 1));
   
    final FeatureCollection<SimpleFeatureType, SimpleFeature>  features = source.getFeatures(filter);
   
   
    // we add a custom feature collection so that we can convert the feature fromt the source feature type to the destination one
View Full Code Here


        Collection<IService> services = getServices();
        if( services != null ){
            try{
                monitor.beginTask("",services.size()*10); //$NON-NLS-1$
                for( IService service : services ) {
                    SubProgressMonitor subMonitor = new SubProgressMonitor(monitor,10);
                    try{
                        URL identifier = service.getIdentifier();
                        monitor.setTaskName(MessageFormat.format(Messages.ResourceSelectionState_taskName, new Object[] {identifier.getProtocol()+"://"+identifier.getPath()})); //$NON-NLS-1$
                    count += service.resources(subMonitor).size();
                    }finally{
                        subMonitor.done();
                    }
                }
                }finally{
                monitor.done();
            }
View Full Code Here

                long start=System.currentTimeMillis();
                while( !Arrays.asList(ds.getTypeNames()).contains(featureType[0].getName().getLocalPart() ) && start+5000>System.currentTimeMillis()){
                    Thread.sleep(300);
                }
                       
                ResetService.reset(Collections.singletonList(service), new SubProgressMonitor(monitor, 2));
            }
        } catch (IOException e) {
            CatalogUIPlugin.log("Error creating feature type in datastore: "+ds.getClass(), e); //$NON-NLS-1$
            display.asyncExec(new Runnable(){
                public void run() {
View Full Code Here

        String bind = MessageFormat.format(Messages.CatalogImport_monitor_task,
                new Object[] { format(context) });
        monitor.beginTask(bind, IProgressMonitor.UNKNOWN);
        monitor.setTaskName(bind);
        try {
            return dialog.runHeadless(new SubProgressMonitor(monitor, 100));
        } finally {
            monitor.done();
        }
    }
View Full Code Here

        final IMap map = layer.getMap();

        //get all selected features
        Query query = new DefaultQuery(layer.getSchema().getTypeName(), layer.getFilter());
       
        FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = layer.getResource(FeatureSource.class, new SubProgressMonitor(monitor, 1));
        FeatureCollection<SimpleFeatureType, SimpleFeature>  features = featureSource.getFeatures(query);
       
        //combine them into one large polygon
        final Geometry union[] = new Geometry[1];
        features.accepts( new FeatureVisitor(){
View Full Code Here

     * @see org.locationtech.udig.project.internal.command.MapCommand#run()
     */
    @SuppressWarnings("deprecation")
    public void run( IProgressMonitor monitor ) throws Exception {
        monitor.beginTask(Messages.WriteFeatureChangesCommand_runTask, 3);
        SubProgressMonitor subProgressMonitor = new SubProgressMonitor(monitor,1);
        editFeature = featureProvider.get(subProgressMonitor);
        subProgressMonitor.done();
        store = storeProvider.get(subProgressMonitor);
        if( editFeature==null || store==null ){
            noChange=true;
            return;
        }
           
        SimpleFeatureType featureType = editFeature.getFeatureType();
        FilterFactory factory = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
        subProgressMonitor = new SubProgressMonitor(monitor,1);
        subProgressMonitor.done();
        filter = factory.id(FeatureUtils.stringToId(factory, editFeature.getID()));
        FeatureCollection<SimpleFeatureType, SimpleFeature>  results = store.getFeatures(filter);

        FeatureIterator<SimpleFeature> reader = results.features();
        try {
View Full Code Here

    }

    public boolean execute( IProgressMonitor monitor ) throws Exception {
        monitor.beginTask(Messages.DeleteFeatureCommand_deleteFeature, 4);
        monitor.worked(1);
        feature = featureProvider.get(new SubProgressMonitor(monitor, 1));
        if( feature==null )
            return false;
        oldLayer = layerProvider.get(new SubProgressMonitor(monitor, 1));
        FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
    oldLayer.getResource(FeatureStore.class, null).removeFeatures(
                filterFactory.id(FeatureUtils.stringToId(filterFactory, feature.getID())));
        map.getEditManagerInternal().setEditFeature(null, null);
        return true;
View Full Code Here

    monitor.setTaskName(name);
    monitor.beginTask(name, 104);
        final int[] worked = new int[]{-3};
        monitor.worked(1);
        try {
            SubProgressMonitor subProgressMonitor = new SubProgressMonitor(monitor, 2);
            FeatureStore<SimpleFeatureType, SimpleFeature> destination = targetLayer.getResource(
                    FeatureStore.class, subProgressMonitor);
            subProgressMonitor.done();
            worked[0] += 2;
            subProgressMonitor = new SubProgressMonitor(monitor, 2);
            FeatureSource<SimpleFeatureType, SimpleFeature> source = sourceLayer.getResource(
                    FeatureSource.class, subProgressMonitor);
            subProgressMonitor.done();
            worked[0] += 2;
            // If no FeatureStore then features can't be copied
            // If no FeatureSource then features can't be copied
            if (destination == null || source == null) {
                targetLayer.setFilter(filter);
View Full Code Here

        monitor.beginTask(Messages.CopyFeaturesCommand_undo + getName(), 4);
        monitor.worked(1);
        this.destinationLayer.eSetDeliver(false);
        try {
            FeatureStore<SimpleFeatureType, SimpleFeature> store = this.destinationLayer
                    .getResource(FeatureStore.class, new SubProgressMonitor(monitor, 1));
            store.removeFeatures(addedFeaturesFilter);
            this.destinationLayer.setFilter(previousDesinationLayerFilter);
        } finally {
            this.destinationLayer.eSetDeliver(true);
        }
View Full Code Here

                for (ISearch search : catalogs) {
                    try {
                        monitor.subTask("Search "+search.getTitle() +" for "+searchText );
                        List<IResolve> searchResults = search.search(searchText, bounds, null);
                        monitor.worked(10);
                        IProgressMonitor searchMonitor = new SubProgressMonitor( monitor,10, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK );
                       
                        for (IResolve member : searchResults) {
                            if (member.canResolve(FeatureSource.class)) {
                                resolves.add(member);
                            }
View Full Code Here

TOP

Related Classes of org.eclipse.core.runtime.SubProgressMonitor

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.