Package org.eclipse.core.runtime

Examples of org.eclipse.core.runtime.IProgressMonitor


   */
  protected void doSaveAs(URI uri, IEditorInput editorInput) {
    (editingDomain.getResourceSet().getResources().get(0)).setURI(uri);
    setInputWithNotify(editorInput);
    setPartName(editorInput.getName());
    IProgressMonitor progressMonitor =
      getActionBars().getStatusLineManager() != null ?
        getActionBars().getStatusLineManager().getProgressMonitor() :
        new NullProgressMonitor();
    doSave(progressMonitor);
  }
View Full Code Here


                        // RepositoryProvider
                        Hashtable table = getProviderMapping((IResource[]) newFiles.toArray(new IResource[newFiles.size()]));
                        Set keySet = table.keySet();
                        Iterator iterator = keySet.iterator();
                        while (iterator.hasNext()) {
                            IProgressMonitor subMonitor = Policy.subMonitorFor(monitor, 100);
                            SVNTeamProvider provider = (SVNTeamProvider) iterator.next();
                            List list = (List) table.get(provider);
                            IResource[] providerResources = (IResource[]) list.toArray(new IResource[list.size()]);

                            provider.add(providerResources, IResource.DEPTH_INFINITE, subMonitor);
View Full Code Here

        FeatureTableContentProvider provider = (FeatureTableContentProvider) this.tableViewer
                .getContentProvider();
        List<SimpleFeature> toSearch = provider.features;

        IProgressMonitor progressMonitor = getSelectionProvider().progressMonitor;
        if (progressMonitor != null) {
            progressMonitor.setCanceled(true);
        }
        getSelectionProvider().getSelectionFids().clear();
        int j = 0;
        int firstMatch = -1;
        OUTER: for( SimpleFeature feature : toSearch ) {
View Full Code Here

        FeatureTableContentProvider provider = (FeatureTableContentProvider) this.tableViewer
                .getContentProvider();
        List<SimpleFeature> toSearch = provider.features;

        IProgressMonitor progressMonitor = getSelectionProvider().progressMonitor;
        if (progressMonitor != null) {
            progressMonitor.setCanceled(true);
        }
        getSelectionProvider().getSelectionFids().clear();
        int j = 0;
        int firstMatch = -1;
        OUTER: for( SimpleFeature feature : toSearch ) {
View Full Code Here

    public static void addFileToCatalog() throws Exception {       
        File file = new File( "C:\\data\\cities.shp" );
        URL url = file.toURI().toURL();
       
        IProgressMonitor monitor = ProgressManager.instance().get();
       
        IRepository local = CatalogPlugin.getDefault().getLocal();
        IService service = local.acquire( url, monitor );       
    }
View Full Code Here

        if (monitor == null) {
            monitor = new NullProgressMonitor();
        }

        IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
        subMonitor.beginTask(LaunchingMessages.StandardVMDebugger_Launching_VM____1, 4);
        subMonitor.subTask(LaunchingMessages.StandardVMDebugger_Finding_free_socket____2);

        int port= SocketUtil.findFreePort();
        if (port == -1) {
            abort(LaunchingMessages.StandardVMDebugger_Could_not_find_a_free_socket_for_the_debugger_1, null, IJavaLaunchConfigurationConstants.ERR_NO_SOCKET_AVAILABLE);
        }

        subMonitor.worked(1);

        // check for cancellation
        if (monitor.isCanceled()) {
            return;
        }

        subMonitor.subTask(LaunchingMessages.StandardVMDebugger_Constructing_command_line____3);

        String program= constructProgramString(config);

        List arguments= new ArrayList(12);

        arguments.add(program);

        // VM args are the first thing after the java program so that users can specify
        // options like '-client' & '-server' which are required to be the first options
        String[] allVMArgs = combineVmArgs(config, fVMInstance);
        addArguments(allVMArgs, arguments);
        arguments.add("-D"+MVELDebugHandler.DEBUG_LAUNCH_KEY+"=true");
       
        addBootClassPathArguments(arguments, config);

        String[] cp= config.getClassPath();
        if (cp.length > 0) {
            arguments.add("-classpath"); //$NON-NLS-1$
            arguments.add(convertClassPath(cp));
        }
        double version = getJavaVersion();
        if (version < 1.5) {
            arguments.add("-Xdebug"); //$NON-NLS-1$
            arguments.add("-Xnoagent"); //$NON-NLS-1$
        }

        //check if java 1.4 or greater
        if (version < 1.4) {
            arguments.add("-Djava.compiler=NONE"); //$NON-NLS-1$
        }
        if (version < 1.5) {
            arguments.add("-Xrunjdwp:transport=dt_socket,suspend=y,address=localhost:" + port); //$NON-NLS-1$
        } else {
            arguments.add("-agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:" + port); //$NON-NLS-1$
        }

        arguments.add(config.getClassToLaunch());
        addArguments(config.getProgramArguments(), arguments);
       
        String[] cmdLine= new String[arguments.size()];
        arguments.toArray(cmdLine);

        String[] envp= config.getEnvironment();

        // check for cancellation
        if (monitor.isCanceled()) {
            return;
        }

        subMonitor.worked(1);
        subMonitor.subTask(LaunchingMessages.StandardVMDebugger_Starting_virtual_machine____4);

        ListeningConnector connector= getConnector();
        if (connector == null) {
            abort(LaunchingMessages.StandardVMDebugger_Couldn__t_find_an_appropriate_debug_connector_2, null, IJavaLaunchConfigurationConstants.ERR_CONNECTOR_NOT_AVAILABLE);
        }
        Map map= connector.defaultArguments();

        specifyArguments(map, port);
        Process p= null;
        try {
            try {
                // check for cancellation
                if (monitor.isCanceled()) {
                    return;
                }

                connector.startListening(map);

                File workingDir = getWorkingDir(config);
                p = exec(cmdLine, workingDir, envp);
                if (p == null) {
                    return;
                }

                // check for cancellation
                if (monitor.isCanceled()) {
                    p.destroy();
                    return;
                }
                java.util.Date date= new java.util.Date();
                Timestamp ts = new Timestamp(date.getTime());
                String format= LaunchingMessages.StandardVMRunner__0____1___2;
            String label = NLS.bind(format, new String[] { cmdLine[0], ts.toString() });
                IProcess process= newProcess(launch, p, label, getDefaultProcessMap());
                process.setAttribute(IProcess.ATTR_CMDLINE, renderCommandLineInternal(cmdLine));
                subMonitor.worked(1);
                subMonitor.subTask(LaunchingMessages.StandardVMDebugger_Establishing_debug_connection____5);
                boolean retry= false;
                do  {
                    try {

                        ConnectRunnable runnable = new ConnectRunnable(connector, map);
                        Thread connectThread = new Thread(runnable, "Listening Connector"); //$NON-NLS-1$
                        connectThread.setDaemon(true);
                        connectThread.start();
                        while (connectThread.isAlive()) {
                            if (monitor.isCanceled()) {
                                connector.stopListening(map);
                                p.destroy();
                                return;
                            }
                            try {
                                p.exitValue();
                                // process has terminated - stop waiting for a connection
                                try {
                                    connector.stopListening(map);
                                } catch (IOException e) {
                                    // expected
                                }
                                checkErrorMessage(process);
                            } catch (IllegalThreadStateException e) {
                                // expected while process is alive
                            }
                            try {
                                Thread.sleep(100);
                            } catch (InterruptedException e) {
                            }
                        }

                        Exception ex = runnable.getException();
                        if (ex instanceof IllegalConnectorArgumentsException)                         {
                            throw (IllegalConnectorArgumentsException)ex;
                        }
                        if (ex instanceof InterruptedIOException) {
                            throw (InterruptedIOException)ex;
                        }
                        if (ex instanceof IOException) {
                            throw (IOException)ex;
                        }

                        VirtualMachine vm= runnable.getVirtualMachine();
                        if (vm != null) {
                            DroolsDebugModel.newDebugTarget(launch, vm, renderDebugTarget(config.getClassToLaunch(), port), process, true, false, config.isResumeOnStartup());
                            subMonitor.worked(1);
                            subMonitor.done();
                        }
                        return;
                    } catch (InterruptedIOException e) {
                        checkErrorMessage(process);
View Full Code Here

    public void connect(Map<String, String> arguments, IProgressMonitor monitor, ILaunch launch) throws CoreException {
        if (monitor == null) {
            monitor = new NullProgressMonitor();
        }
       
        IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
        subMonitor.beginTask(LaunchingMessages.SocketAttachConnector_Connecting____1, 2);
        subMonitor.subTask(LaunchingMessages.SocketAttachConnector_Configuring_connection____1);
       
        AttachingConnector connector= getAttachingConnector();
        String portNumberString = arguments.get("port"); //$NON-NLS-1$
        if (portNumberString == null) {
            abort(LaunchingMessages.SocketAttachConnector_Port_unspecified_for_remote_connection__2, null, IJavaLaunchConfigurationConstants.ERR_UNSPECIFIED_PORT);
        }
        String host = arguments.get("hostname"); //$NON-NLS-1$
        if (host == null) {
            abort(LaunchingMessages.SocketAttachConnector_Hostname_unspecified_for_remote_connection__4, null, IJavaLaunchConfigurationConstants.ERR_UNSPECIFIED_HOSTNAME);
        }
        Map<String, Connector.Argument> map= connector.defaultArguments();
       
        Connector.Argument param= map.get("hostname"); //$NON-NLS-1$
        param.setValue(host);
        param= map.get("port"); //$NON-NLS-1$
        param.setValue(portNumberString);
       
        String timeoutString = arguments.get("timeout"); //$NON-NLS-1$
        if (timeoutString != null) {
            param= map.get("timeout"); //$NON-NLS-1$
            param.setValue(timeoutString);
        }
       
        ILaunchConfiguration configuration = launch.getLaunchConfiguration();
        boolean allowTerminate = false;
        if (configuration != null) {
            allowTerminate = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_ALLOW_TERMINATE, false);
        }
        subMonitor.worked(1);
        subMonitor.subTask(LaunchingMessages.SocketAttachConnector_Establishing_connection____2);
        try {
            VirtualMachine vm = connector.attach(map);
            String vmLabel = constructVMLabel(vm, host, portNumberString, configuration);
            IDebugTarget debugTarget= DroolsDebugModel.newDebugTarget(launch, vm, vmLabel, null, allowTerminate, true);
            launch.addDebugTarget(debugTarget);
            subMonitor.worked(1);
            subMonitor.done();
        } catch (TimeoutException e) {
            abort(LaunchingMessages.SocketAttachConnector_0, e, IJavaLaunchConfigurationConstants.ERR_REMOTE_VM_CONNECTION_FAILED);
        } catch (UnknownHostException e) {
            abort(NLS.bind(LaunchingMessages.SocketAttachConnector_Failed_to_connect_to_remote_VM_because_of_unknown_host____0___1, new String[]{host}), e, IJavaLaunchConfigurationConstants.ERR_REMOTE_VM_CONNECTION_FAILED);
        } catch (ConnectException e) {
View Full Code Here

        if (monitor == null) {
            monitor = new NullProgressMonitor();
        }

        IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
        subMonitor.beginTask(LaunchingMessages.StandardVMDebugger_Launching_VM____1, 4);
        subMonitor.subTask(LaunchingMessages.StandardVMDebugger_Finding_free_socket____2);

        int port= SocketUtil.findFreePort();
        if (port == -1) {
            abort(LaunchingMessages.StandardVMDebugger_Could_not_find_a_free_socket_for_the_debugger_1, null, IJavaLaunchConfigurationConstants.ERR_NO_SOCKET_AVAILABLE);
        }

        subMonitor.worked(1);

        // check for cancellation
        if (monitor.isCanceled()) {
            return;
        }

        subMonitor.subTask(LaunchingMessages.StandardVMDebugger_Constructing_command_line____3);

        String program= constructProgramString(config);

        List<String> arguments= new ArrayList<String>(12);

        arguments.add(program);

        // VM args are the first thing after the java program so that users can specify
        // options like '-client' & '-server' which are required to be the first options
        String[] allVMArgs = combineVmArgs(config, fVMInstance);
        addArguments(allVMArgs, arguments);
        arguments.add("-D"+MVELDebugHandler.DEBUG_LAUNCH_KEY+"=true");
       
        addBootClassPathArguments(arguments, config);

        String[] cp= config.getClassPath();
        if (cp.length > 0) {
            arguments.add("-classpath"); //$NON-NLS-1$
            arguments.add(convertClassPath(cp));
        }
        double version = getJavaVersion();
        if (version < 1.5) {
            arguments.add("-Xdebug"); //$NON-NLS-1$
            arguments.add("-Xnoagent"); //$NON-NLS-1$
        }

        //check if java 1.4 or greater
        if (version < 1.4) {
            arguments.add("-Djava.compiler=NONE"); //$NON-NLS-1$
        }
        if (version < 1.5) {
            arguments.add("-Xrunjdwp:transport=dt_socket,suspend=y,address=localhost:" + port); //$NON-NLS-1$
        } else {
            arguments.add("-agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:" + port); //$NON-NLS-1$
        }

        arguments.add(config.getClassToLaunch());
        addArguments(config.getProgramArguments(), arguments);
       
        String[] cmdLine= new String[arguments.size()];
        arguments.toArray(cmdLine);

        String[] envp= config.getEnvironment();

        // check for cancellation
        if (monitor.isCanceled()) {
            return;
        }

        subMonitor.worked(1);
        subMonitor.subTask(LaunchingMessages.StandardVMDebugger_Starting_virtual_machine____4);

        ListeningConnector connector= getConnector();
        if (connector == null) {
            abort(LaunchingMessages.StandardVMDebugger_Couldn__t_find_an_appropriate_debug_connector_2, null, IJavaLaunchConfigurationConstants.ERR_CONNECTOR_NOT_AVAILABLE);
        }
        Map<String, Argument> map= connector.defaultArguments();

        specifyArguments(map, port);
        Process p= null;
        try {
            try {
                // check for cancellation
                if (monitor.isCanceled()) {
                    return;
                }

                connector.startListening(map);

                File workingDir = getWorkingDir(config);
                p = exec(cmdLine, workingDir, envp);
                if (p == null) {
                    return;
                }

                // check for cancellation
                if (monitor.isCanceled()) {
                    p.destroy();
                    return;
                }
                java.util.Date date= new java.util.Date();
                Timestamp ts = new Timestamp(date.getTime());
                String format= LaunchingMessages.StandardVMRunner__0____1___2;
            String label = NLS.bind(format, new String[] { cmdLine[0], ts.toString() });
                IProcess process= newProcess(launch, p, label, getDefaultProcessMap());
                process.setAttribute(IProcess.ATTR_CMDLINE, renderCommandLineInternal(cmdLine));
                subMonitor.worked(1);
                subMonitor.subTask(LaunchingMessages.StandardVMDebugger_Establishing_debug_connection____5);
                boolean retry= false;
                do  {
                    try {

                        ConnectRunnable runnable = new ConnectRunnable(connector, map);
                        Thread connectThread = new Thread(runnable, "Listening Connector"); //$NON-NLS-1$
                        connectThread.setDaemon(true);
                        connectThread.start();
                        while (connectThread.isAlive()) {
                            if (monitor.isCanceled()) {
                                connector.stopListening(map);
                                p.destroy();
                                return;
                            }
                            try {
                                p.exitValue();
                                // process has terminated - stop waiting for a connection
                                try {
                                    connector.stopListening(map);
                                } catch (IOException e) {
                                    // expected
                                }
                                checkErrorMessage(process);
                            } catch (IllegalThreadStateException e) {
                                // expected while process is alive
                            }
                            try {
                                Thread.sleep(100);
                            } catch (InterruptedException e) {
                            }
                        }

                        Exception ex = runnable.getException();
                        if (ex instanceof IllegalConnectorArgumentsException)                         {
                            throw (IllegalConnectorArgumentsException)ex;
                        }
                        if (ex instanceof InterruptedIOException) {
                            throw (InterruptedIOException)ex;
                        }
                        if (ex instanceof IOException) {
                            throw (IOException)ex;
                        }

                        VirtualMachine vm= runnable.getVirtualMachine();
                        if (vm != null) {
                            DroolsDebugModel.newDebugTarget(launch, vm, renderDebugTarget(config.getClassToLaunch(), port), process, true, false, config.isResumeOnStartup());
                            subMonitor.worked(1);
                            subMonitor.done();
                        }
                        return;
                    } catch (InterruptedIOException e) {
                        checkErrorMessage(process);
View Full Code Here

        monitor.done();
    }

    private void checkDuplicates(IProgressMonitor monitor) {
      synchronized (lastFilteredItems) {
        IProgressMonitor subMonitor = null;
        int reportEvery = lastFilteredItems.size() / 20;
        if (monitor != null) {
          subMonitor = new SubProgressMonitor(monitor, 100);
          subMonitor
              .beginTask(
                  WorkbenchMessages.FilteredItemsSelectionDialog_cacheRefreshJob_checkDuplicates,
                  5);
        }
        HashMap helperMap = new HashMap();
        for (int i = 0; i < lastFilteredItems.size(); i++) {
          if (reset
              || (subMonitor != null && subMonitor.isCanceled()))
            return;
          Object item = lastFilteredItems.get(i);

          if (!(item instanceof ItemsListSeparator)) {
            Object previousItem = helperMap.put(
                getElementName(item), item);
            if (previousItem != null) {
              setDuplicateElement(previousItem, true);
              setDuplicateElement(item, true);
            } else {
              setDuplicateElement(item, false);
            }
          }

          if (subMonitor != null && reportEvery != 0
              && (i + 1) % reportEvery == 0)
            subMonitor.worked(1);
        }
        helperMap.clear();
      }
    }
View Full Code Here

   /**
   * Create a monitor for the receiver that wrappers the superclasses monitor.
   *
   */
    public void createWrapperedMonitor() {
        wrapperedMonitor = new IProgressMonitor() {

            IProgressMonitor superMonitor = TimeTriggeredProgressMonitorDialog.super
                    .getProgressMonitor();

            /*
 
View Full Code Here

TOP

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

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.