Merge default -> jdk9. jdk9
authorTomas Zezula <tzezula@netbeans.org>
Tue, 07 Mar 2017 10:02:27 +0100
branchjdk9
changeset 314514549a3f05841a
parent 314513 efa6e7d20b94
parent 314367 81ddde09df9b
child 314515 aaaff8a153e0
Merge default -> jdk9.
     1.1 --- a/cnd.debugger.common2/manifest.mf	Mon Mar 06 17:42:32 2017 +0100
     1.2 +++ b/cnd.debugger.common2/manifest.mf	Tue Mar 07 10:02:27 2017 +0100
     1.3 @@ -5,5 +5,5 @@
     1.4  OpenIDE-Module-Install: org/netbeans/modules/cnd/debugger/common2/DbgGuiModule.class
     1.5  OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/cnd/debugger/common2/Bundle.properties
     1.6  OpenIDE-Module-Requires: org.netbeans.api.javahelp.Help, org.openide.windows.WindowManager
     1.7 -OpenIDE-Module-Specification-Version: 3.31.8
     1.8 +OpenIDE-Module-Specification-Version: 3.31.9
     1.9  
     2.1 --- a/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/WatchBag.java	Mon Mar 06 17:42:32 2017 +0100
     2.2 +++ b/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/WatchBag.java	Tue Mar 07 10:02:27 2017 +0100
     2.3 @@ -51,6 +51,7 @@
     2.4  import java.util.ArrayList;
     2.5  import org.netbeans.api.debugger.Watch;
     2.6  import org.netbeans.spi.debugger.ui.EditorPin;
     2.7 +import org.openide.filesystems.FileObject;
     2.8  
     2.9  public class WatchBag {
    2.10      private ArrayList<NativeWatch> watches = new ArrayList<NativeWatch>();
    2.11 @@ -95,6 +96,50 @@
    2.12          return false;
    2.13      }
    2.14      
    2.15 +    public static boolean hasPin(NativeWatch nativeWatch) {
    2.16 +        final Watch watch = nativeWatch.watch();
    2.17 +        Watch.Pin pin = watch.getPin();
    2.18 +        return (pin instanceof EditorPin); 
    2.19 +    }
    2.20 +    
    2.21 +    public static boolean isPinOpened(NativeWatch nativeWatch) {
    2.22 +        final Watch watch = nativeWatch.watch();
    2.23 +        Watch.Pin pin = watch.getPin();
    2.24 +        if (pin instanceof EditorPin) {
    2.25 +            EditorPin editorPin = (EditorPin)pin;
    2.26 +            FileObject editorFO = EditorContextBridge.getCurrentFileObject();
    2.27 +            if (editorFO != null &&  editorFO.equals(editorPin.getFile())) {
    2.28 +                //the editor is opened for the pinned watch
    2.29 +                return true;
    2.30 +            }
    2.31 +        }
    2.32 +        return false;
    2.33 +    }
    2.34 +    
    2.35 +    /**
    2.36 +     * Checks if we have watches in the editor for the fileToOpen
    2.37 +     * @param fileToOpen if <code>null</code>  will check with the EditorContextBridge.getCurrentFileObject()
    2.38 +     * @return 
    2.39 +     */
    2.40 +    public synchronized boolean hasPinnedWatchesOpened(final FileObject fileToOpen) {
    2.41 +        FileObject editorFO = EditorContextBridge.getCurrentFileObject();
    2.42 +        if (fileToOpen != null && fileToOpen.isValid()) {
    2.43 +            editorFO = fileToOpen;
    2.44 +        }
    2.45 +        for (NativeWatch nativeWatch : watches) {
    2.46 +            final Watch watch = nativeWatch.watch();
    2.47 +            Watch.Pin pin = watch.getPin();
    2.48 +            if (pin instanceof EditorPin) {
    2.49 +                EditorPin editorPin = (EditorPin)pin;                
    2.50 +                if (editorFO != null &&  editorFO.equals(editorPin.getFile())) {
    2.51 +                    //the editor is opened for the pinned watch
    2.52 +                    return true;
    2.53 +                }
    2.54 +            }
    2.55 +        }
    2.56 +        return false;
    2.57 +    }    
    2.58 +    
    2.59      public void postDeleteAllWatches() {
    2.60  
    2.61  	// Use an array because
    2.62 @@ -147,6 +192,7 @@
    2.63  	assert !watches.contains(oldWatch) :
    2.64  	       "WB.remove(): watch still there after removal"; // NOI18N
    2.65  	// OLD manager().removeWatch(oldWatch);
    2.66 +        oldWatch.postDelete(false);
    2.67  	watchUpdater().treeChanged();      // causes a pull
    2.68      }
    2.69  }
     3.1 --- a/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/options/Bundle.properties	Mon Mar 06 17:42:32 2017 +0100
     3.2 +++ b/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/options/Bundle.properties	Tue Mar 07 10:02:27 2017 +0100
     3.3 @@ -326,6 +326,13 @@
     3.4  ACSD_balloon_eval_on=Turn on balloon expression evaluation
     3.5  ACSD_balloon_eval_off=Turn off balloon expression evaluation
     3.6  
     3.7 +LABEL_args_values_in_stack=Show arguments values in Call Stack and Debugging View windows
     3.8 +ACSD_args_values_in_stack=Show arguments values in Call Stack and Debugging View windows
     3.9 +MNEM_args_values_in_stack=S
    3.10 +ACSD_args_values_in_stack_on=Turn on Show arguments values in Call Stack and Debugging View windows
    3.11 +ACSD_args_values_in_stack_off=Turn off Show arguments values in Call Stack and Debugging View windows
    3.12 +
    3.13 +
    3.14  LABEL_save_breakpoints=Save and Restore Breakpoints
    3.15  ACSD_save_breakpoints=Save and restore breakpoints
    3.16  MNEM_save_breakpoints=S
     4.1 --- a/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/options/DebuggerOption.java	Mon Mar 06 17:42:32 2017 +0100
     4.2 +++ b/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/options/DebuggerOption.java	Tue Mar 07 10:02:27 2017 +0100
     4.3 @@ -691,6 +691,14 @@
     4.4  			    "on",    // NOI18N //default value
     4.5  			    false, // is engine option
     4.6  			    radio_or_check, false, true);  //type
     4.7 +    
     4.8 +    public static final DebuggerOption ARGS_VALUES_IN_STACK  =
     4.9 +	new DebuggerOption( // NOI18N
    4.10 +			    "args_values_in_stack",  // NOI18N //name
    4.11 +			    new String[] {"on", "off"},  // NOI18N //values
    4.12 +			    "on",    // NOI18N //default value
    4.13 +			    false, // is engine option
    4.14 +			    radio_or_check, false, true);  //type    
    4.15  
    4.16  
    4.17      public static final DebuggerOption SESSION_REUSE  =
     5.1 --- a/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/options/GlobalOptionSet.java	Mon Mar 06 17:42:32 2017 +0100
     5.2 +++ b/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/options/GlobalOptionSet.java	Tue Mar 07 10:02:27 2017 +0100
     5.3 @@ -95,6 +95,7 @@
     5.4  	DebuggerOption.TRACE_SPEED,
     5.5  	DebuggerOption.RUN_AUTOSTART,
     5.6  	DebuggerOption.BALLOON_EVAL,
     5.7 +        DebuggerOption.ARGS_VALUES_IN_STACK,
     5.8      };
     5.9  
    5.10  
     6.1 --- a/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/options/GlobalOptionsSubPanel.java	Mon Mar 06 17:42:32 2017 +0100
     6.2 +++ b/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/options/GlobalOptionsSubPanel.java	Tue Mar 07 10:02:27 2017 +0100
     6.3 @@ -65,13 +65,15 @@
     6.4  		    DebuggerOption.FINISH_SESSION.createUI(),
     6.5  		    DebuggerOption.SESSION_REUSE.createUI(),
     6.6  		    DebuggerOption.BALLOON_EVAL.createUI(),
     6.7 -		};
     6.8 +                    DebuggerOption.ARGS_VALUES_IN_STACK.createUI(),
     6.9 +		};  
    6.10  	    OptionUI[]	panels = {
    6.11  		    //DebuggerOption.SUPPRESS_STARTUP_MESSAGE.createUI(),
    6.12  		    DebuggerOption.TRACE_SPEED.createUI(),
    6.13                      DebuggerOption.FINISH_SESSION.createUI(),
    6.14  		    DebuggerOption.RUN_AUTOSTART.createUI(),
    6.15  		    DebuggerOption.BALLOON_EVAL.createUI(),
    6.16 +                    DebuggerOption.ARGS_VALUES_IN_STACK.createUI(),
    6.17  		};
    6.18  
    6.19  	    if (NativeDebuggerManager.isStandalone() || NativeDebuggerManager.isPL()) {
    6.20 @@ -136,7 +138,7 @@
    6.21  	setBorder(new javax.swing.border.EtchedBorder());
    6.22      }
    6.23  
    6.24 -    protected void setup(OptionUI[] panels) {
    6.25 +   protected void setup(OptionUI[] panels) {
    6.26  	UISet.add(panels);
    6.27  	OptionUI.fillPanel(this, panels);
    6.28      }
     7.1 --- a/cnd.debugger.gdb2/nbproject/project.properties	Mon Mar 06 17:42:32 2017 +0100
     7.2 +++ b/cnd.debugger.gdb2/nbproject/project.properties	Tue Mar 07 10:02:27 2017 +0100
     7.3 @@ -37,5 +37,5 @@
     7.4  # Contributor(s):
     7.5  javac.source=1.6
     7.6  javac.compilerargs=-Xlint -Xlint:-serial
     7.7 -spec.version.base=1.25.10
     7.8 +spec.version.base=1.25.11
     7.9  
     8.1 --- a/cnd.debugger.gdb2/src/org/netbeans/modules/cnd/debugger/gdb2/GdbDebuggerImpl.java	Mon Mar 06 17:42:32 2017 +0100
     8.2 +++ b/cnd.debugger.gdb2/src/org/netbeans/modules/cnd/debugger/gdb2/GdbDebuggerImpl.java	Tue Mar 07 10:02:27 2017 +0100
     8.3 @@ -46,6 +46,8 @@
     8.4  
     8.5  import java.awt.event.ActionEvent;
     8.6  import java.awt.event.ActionListener;
     8.7 +import java.beans.PropertyChangeEvent;
     8.8 +import java.beans.PropertyChangeListener;
     8.9  import java.io.File;
    8.10  import java.io.IOException;
    8.11  import java.net.ConnectException;
    8.12 @@ -284,6 +286,7 @@
    8.13          handlerExpert = new GdbHandlerExpert(this);
    8.14          disassembly = new GdbDisassembly(this, breakpointModel());
    8.15          disStateModel().addListener(disassembly);
    8.16 +        //need to attach to EditorContext Bridge as we need to 
    8.17      }
    8.18  
    8.19      @Override
    8.20 @@ -1979,7 +1982,7 @@
    8.21              System.out.println("tid_no " + currentThreadId); // NOI18N
    8.22              System.out.println("frame " + frame.toString()); // NOI18N
    8.23          }
    8.24 -        GdbFrame f = new GdbFrame(this, frame, null, null);
    8.25 +        GdbFrame f = new GdbFrame(this, frame, null);
    8.26  
    8.27          //if (index != -1)
    8.28          //threads[index] = new GdbThread(this, threadUpdater, tid_no, f);
    8.29 @@ -2066,7 +2069,7 @@
    8.30                          String id = thrList.getConstValue("id"); //NOI18N
    8.31                          String name = thrList.getConstValue("target-id"); //NOI18N
    8.32                          MIValue frame = thrList.valueOf(MI_FRAME);// frame entry
    8.33 -                        GdbFrame f = new GdbFrame(GdbDebuggerImpl.this, frame, null, null);
    8.34 +                        GdbFrame f = new GdbFrame(GdbDebuggerImpl.this, frame, null);
    8.35                          f.setCurrent(true);     // in order to let Thread make some updates | GDB response contains only current frame
    8.36                          String state = thrList.getConstValue("state"); // NOI18N
    8.37                          GdbThread gdbThread = new GdbThread(GdbDebuggerImpl.this, threadUpdater, id, name, new Frame[]{f}, state);
    8.38 @@ -2115,13 +2118,13 @@
    8.39                                          result = (MIResult) results.get(i++);
    8.40                                          if (result.matches(MI_FRAME)) {
    8.41                                              MIValue frame = result.value();
    8.42 -                                            f = new GdbFrame(GdbDebuggerImpl.this, frame, null, null);
    8.43 +                                            f = new GdbFrame(GdbDebuggerImpl.this, frame, null);
    8.44                                          }
    8.45                                      } else if (result.matches(MI_FRAME)) {
    8.46                                          name = "Thread ".concat(id); //NOI18N
    8.47  
    8.48                                          MIValue frame = result.value();
    8.49 -                                        f = new GdbFrame(GdbDebuggerImpl.this, frame, null, null);
    8.50 +                                        f = new GdbFrame(GdbDebuggerImpl.this, frame, null);
    8.51                                          f.setCurrent(true);     // in order to let Thread make some updates | GDB response contains only current frame
    8.52                                      }
    8.53  
    8.54 @@ -2239,7 +2242,7 @@
    8.55                                  if (item.matches(MI_FRAME)) {
    8.56                                      MIValue frame = item.value();
    8.57  
    8.58 -                                    GdbFrame gdbFrame = new GdbFrame(GdbDebuggerImpl.this, frame, null, gdbThread);
    8.59 +                                    GdbFrame gdbFrame = new GdbFrame(GdbDebuggerImpl.this, frame, gdbThread);
    8.60                                      if (gdbFrame.getNumber().equals(frameNo)) {
    8.61                                          gdbFrame.setCurrent(true);
    8.62                                      }
    8.63 @@ -2260,10 +2263,13 @@
    8.64  
    8.65                              MICommand cmd = new MiCommandImpl(peculiarity.stackListFramesCommand(id)) {
    8.66                                  @Override
    8.67 -                                protected void onDone(final MIRecord frames) {
    8.68 -
    8.69 +                                protected void onDone(final MIRecord framesRecord) {
    8.70 +                                    //do not ask for arguments here
    8.71 +                                    //it is too time expensive and too earlier
    8.72                                      // "1" means get both arg's name and value
    8.73 -                                    String args_command = "-stack-list-arguments 1 --thread " + id; // NOI18N
    8.74 +                                    String stack_list_args_param = 
    8.75 +                                            DebuggerOption.ARGS_VALUES_IN_STACK.isEnabled(NativeDebuggerManager.get().globalOptions()) ? "1" :"0";//NOI18N
    8.76 +                                    String args_command = "-stack-list-arguments " + stack_list_args_param + " --thread " + id; // NOI18N
    8.77  
    8.78                                      MICommand cmd3 = new MiCommandImpl(args_command) {
    8.79  
    8.80 @@ -2282,7 +2288,7 @@
    8.81                                                  }
    8.82                                              }
    8.83  
    8.84 -                                            MITList results = frames.results();
    8.85 +                                            MITList results = framesRecord.results();
    8.86                                              MITList stack_list = (MITList) results.valueOf("stack"); // NOI18N
    8.87                                              int size = stack_list.size();
    8.88  
    8.89 @@ -2293,12 +2299,15 @@
    8.90                                                  MIResult frame = (MIResult) stack_list.get(vx);
    8.91  
    8.92                                                  // try to find frame arguments
    8.93 +                                                //no args here
    8.94 +                                                //do not ask it ever
    8.95                                                  MIResult frameArgs = null;
    8.96                                                  if (args_list != null && vx < args_list.size()) {
    8.97                                                      frameArgs = (MIResult) args_list.get(vx);
    8.98                                                  }
    8.99  
   8.100 -                                                GdbFrame gdbFrame = new GdbFrame(GdbDebuggerImpl.this, frame.value(), frameArgs, gdbThread);    // TODO arguments request
   8.101 +                                                GdbFrame gdbFrame = 
   8.102 +                                                        new GdbFrame(GdbDebuggerImpl.this, frame.value(), frameArgs, gdbThread);    // TODO arguments request
   8.103                                                  if (gdbFrame.getNumber().equals(frameNo)) {
   8.104                                                      gdbFrame.setCurrent(true);
   8.105                                                  }
   8.106 @@ -2363,14 +2372,11 @@
   8.107              System.out.println("registerStackModel " + model); // NOI18N
   8.108          }
   8.109          stackUpdater.addListener(model);
   8.110 -        if (model != null) {
   8.111 -            get_frames = true;
   8.112 -//            if (state().isProcess && !state().isRunning) {
   8.113 -//                showStackFrames();
   8.114 -//            }
   8.115 -        } else {
   8.116 -            get_frames = false;
   8.117 -        }
   8.118 +        get_frames = model != null;
   8.119 +        if (get_frames && state().isProcess && !state().isRunning ) {
   8.120 +            requestStack();
   8.121 +        }          
   8.122 +        
   8.123      }
   8.124  
   8.125      @Override
   8.126 @@ -2468,7 +2474,7 @@
   8.127      private void visitCurrentSrc(GdbFrame f, MIRecord srcRecord) {
   8.128          MITList  srcTuple = srcRecord.results();
   8.129          if (f == null)
   8.130 -            f = new GdbFrame(this, null, null, null);
   8.131 +            f = new GdbFrame(this, null, null);
   8.132  
   8.133          // create a non-visited location because it may be assigned to
   8.134          // homeLoc
   8.135 @@ -2533,7 +2539,12 @@
   8.136       * framerecords: what we got from -stack-list-frames = stack
   8.137       * args: what we got from -stack-list-arguments 1 = stack-args
   8.138       */
   8.139 -    private void setStackWithArgs(MIRecord framerecords, MIRecord args) {
   8.140 +    //mromashova_bz#269898: we will not do this call ever with the 1 (names and values)
   8.141 +    //it is too expensive to get all arguments for all frames even for one particular thread
   8.142 +    //and the only need is Debuggin View, but we will show arg names only without values
   8.143 +    private void setStackWithArgs(MIRecord framerecords
   8.144 +            , MIRecord args
   8.145 +    ) {
   8.146          MITList argsresults;
   8.147          MITList args_list = null;
   8.148          String stringframes;
   8.149 @@ -2585,9 +2596,14 @@
   8.150       * for whole stack
   8.151       * framerecords: what we got from -stack-list-frames
   8.152       */
   8.153 -    private void setStack(final MIRecord framerecords) {
   8.154 +    private void setStack(final MIRecord framerecords) {     
   8.155 +        //mromashova_bz#269898:
   8.156          // "1" means get both arg's name and value
   8.157 -        String args_command = "-stack-list-arguments 1"; // NOI18N
   8.158 +        String stack_list_args_param = 
   8.159 +                get_frames && DebuggerOption.ARGS_VALUES_IN_STACK.isEnabled(NativeDebuggerManager.get().globalOptions()) 
   8.160 +                ? "1" :"0";//NOI18N
   8.161 +        
   8.162 +        String args_command = "-stack-list-arguments " + stack_list_args_param; // NOI18N
   8.163  
   8.164          MICommand cmd =
   8.165              new MiCommandImpl(args_command) {
   8.166 @@ -2717,22 +2733,27 @@
   8.167              send("-break-disable"); //NOI18N
   8.168          }
   8.169          send("-gdb-set unwindonsignal on"); //NOI18N
   8.170 -
   8.171 -        dataMIEval(lp, expr, dis);
   8.172 -
   8.173 -        // enable breakpoints and signals
   8.174 -        if (handlers.length > 0) {
   8.175 -            StringBuilder command = new StringBuilder();
   8.176 -            command.append("-break-enable"); // NOI18N
   8.177 -            for (Handler h : handlers) {
   8.178 -                if (h.breakpoint().isEnabled()) {
   8.179 -                    command.append(' ');
   8.180 -                    command.append(h.getId());
   8.181 +        Runnable postRunnable = new Runnable() {
   8.182 +            @Override
   8.183 +            public void run() {
   8.184 +                // enable breakpoints and signals
   8.185 +                if (handlers.length > 0) {
   8.186 +                    StringBuilder command = new StringBuilder();
   8.187 +                    command.append("-break-enable"); // NOI18N
   8.188 +                    for (Handler h : handlers) {
   8.189 +                        if (h.breakpoint().isEnabled()) {
   8.190 +                            command.append(' ');
   8.191 +                            command.append(h.getId());
   8.192 +                        }
   8.193 +                    }
   8.194 +                    send(command.toString());
   8.195                  }
   8.196 +                send("-gdb-set unwindonsignal off"); //NOI18N
   8.197              }
   8.198 -            send(command.toString());
   8.199 -        }
   8.200 -        send("-gdb-set unwindonsignal off"); //NOI18N
   8.201 +        };
   8.202 +        dataMIEval(lp, expr, dis, postRunnable);
   8.203 +
   8.204 +       
   8.205      }
   8.206  
   8.207      @Override
   8.208 @@ -2783,7 +2804,7 @@
   8.209          });
   8.210      }
   8.211  
   8.212 -    private static final class ModelChangeListenerTooltipImpl implements ModelListener {
   8.213 +    private final class ModelChangeListenerTooltipImpl implements ModelListener {
   8.214          private AtomicBoolean isInitilaized = new AtomicBoolean(false);
   8.215          private JEditorPane editorPane;
   8.216          private  Line.Part lp;
   8.217 @@ -2806,8 +2827,11 @@
   8.218                  ModelEvent.NodeChanged nodeChanged = (ModelEvent.NodeChanged) event;
   8.219                  if (nodeChanged.getChange() != ModelEvent.NodeChanged.DISPLAY_NAME_MASK) {
   8.220                      return;//need to update display name only
   8.221 +                }                
   8.222 +                if (!(nodeChanged.getNode() instanceof GdbVariable) ){
   8.223 +                    return;
   8.224                  }
   8.225 -                final Variable variable = ((Variable) nodeChanged.getNode());
   8.226 +                final GdbVariable variable = ((GdbVariable) nodeChanged.getNode());
   8.227                  if (!tts.isEnabled() || !tts.isToolTipVisible()) {
   8.228                      return;
   8.229                  }
   8.230 @@ -2829,6 +2853,7 @@
   8.231                             final String toolTip = variable.getVariableName() + "=" + variable.getAsText();//NOI18N
   8.232                             ToolTipUI toolTipUI = ViewFactory.getDefault().createToolTip(toolTip, expandable, pinnable);
   8.233                             ToolTipSupport tts = toolTipUI.show(editorPane);
   8.234 +                           tts.addPropertyChangeListener(new ToolTipSupportPropertyChangeListener(variable));
   8.235                             variable.getUpdater().removeListener(ModelChangeListenerTooltipImpl.this);
   8.236                             //variable.getUpdater().setListener(null);
   8.237                         }
   8.238 @@ -2836,7 +2861,29 @@
   8.239                 }
   8.240              }
   8.241          }
   8.242 -    }    
   8.243 +    } 
   8.244 +    
   8.245 +    private final class ToolTipSupportPropertyChangeListener implements PropertyChangeListener {
   8.246 +        private final GdbVariable v;
   8.247 +
   8.248 +        ToolTipSupportPropertyChangeListener(GdbVariable v) {
   8.249 +            this.v = v;
   8.250 +        }
   8.251 +        @Override
   8.252 +        public void propertyChange(PropertyChangeEvent evt) {
   8.253 +            if (!ToolTipSupport.PROP_STATUS.equals(evt.getPropertyName())) {                
   8.254 +               return;//we are interested in status only 
   8.255 +            }
   8.256 +            if ((((Integer)evt.getNewValue()) == ToolTipSupport.STATUS_HIDDEN)){
   8.257 +                DeleteMIVarCommand cmd = new DeleteMIVarCommand(v);
   8.258 +                cmd.dontReportError();
   8.259 +                sendCommandInt(cmd);
   8.260 +                ((ToolTipSupport)evt.getSource()).removePropertyChangeListener(this);
   8.261 +            }
   8.262 +        }
   8.263 +        
   8.264 +    }
   8.265 +    
   8.266      private static final class ModelChangeListenerImpl implements ModelListener {
   8.267          @Override
   8.268          public void modelChanged(ModelEvent event) {
   8.269 @@ -2867,7 +2914,7 @@
   8.270      public void postExprQualify(String expr, QualifiedExprListener qeListener) {
   8.271      }
   8.272  
   8.273 -    private void dataMIEval(final Line.Part lp, final String expr, final boolean dis) {
   8.274 +    private void dataMIEval(final Line.Part lp, final String expr, final boolean dis, final Runnable postRunnable) {
   8.275          String expandedExpr = MacroSupport.expandMacro(this, expr);
   8.276          String cmdString = "-data-evaluate-expression " + "\"" + expandedExpr + "\""; // NOI18N
   8.277          MICommand cmd =
   8.278 @@ -2889,10 +2936,14 @@
   8.279                          }
   8.280                      }
   8.281                  } else if (value_string.startsWith("@0x")) { //NOI18N
   8.282 -                    // See bug 206736 - tooltip for reference-based variable shows address instead of value
   8.283 -                    balloonEvaluate(lp, "*&" + expr, false); //NOI18N
   8.284 -                    finish();
   8.285 -                    return;
   8.286 +                    try{
   8.287 +                        // See bug 206736 - tooltip for reference-based variable shows address instead of value
   8.288 +                        balloonEvaluate(lp, "*&" + expr, false); //NOI18N
   8.289 +                        finish();                        
   8.290 +                        return;
   8.291 +                    } finally {
   8.292 +                        postRunnable.run();
   8.293 +                    }
   8.294                  } else {
   8.295                      value_string = ValuePresenter.getValue(value_string);
   8.296                  }
   8.297 @@ -2900,10 +2951,12 @@
   8.298                  Line line = lp.getLine();
   8.299                  DataObject dob = DataEditorSupport.findDataObject(line);
   8.300                  if (dob == null) {
   8.301 +                    postRunnable.run();
   8.302                      return;
   8.303                  }
   8.304                  final EditorCookie ec = dob.getLookup().lookup(EditorCookie.class);
   8.305                  if (ec == null) {
   8.306 +                    postRunnable.run();
   8.307                      return;
   8.308                      // Only for editable dataobjects
   8.309                  }
   8.310 @@ -2911,10 +2964,12 @@
   8.311                  try {
   8.312                      doc = ec.openDocument();
   8.313                  } catch (IOException ex) {
   8.314 +                    postRunnable.run();
   8.315                      return;
   8.316                  }
   8.317                  final JEditorPane ep = EditorContextDispatcher.getDefault().getMostRecentEditor();
   8.318                  if (ep == null || ep.getDocument() != doc) {
   8.319 +                    postRunnable.run();
   8.320                      return ;
   8.321                  }      
   8.322                  //Object var = null; 
   8.323 @@ -2926,6 +2981,7 @@
   8.324                  final Runnable onDoneRunnable = new Runnable() {
   8.325                      @Override
   8.326                      public void run() {
   8.327 +                        postRunnable.run();
   8.328                          //need to execute following code only after the value is update in onDone in createMIVar
   8.329                          final Object objectVariable = watch;
   8.330                          final String toolTip = expr + "=" + watch.getAsText();//NOI18N
   8.331 @@ -2952,17 +3008,20 @@
   8.332                                  ToolTipUI toolTipUI = ViewFactory.getDefault().createToolTip(toolTip, expandable, pinnable);
   8.333                                  final ToolTipSupport tts = toolTipUI.show(ep);
   8.334                                  if (tts != null) {
   8.335 +                                    tts.addPropertyChangeListener(new ToolTipSupportPropertyChangeListener(watch));
   8.336                                      mcLImpl.registerToolTip(tts, ep, lp);
   8.337                                  }
   8.338  
   8.339                              }
   8.340                          });
   8.341 +                        
   8.342                      }
   8.343                  };
   8.344                  //this runnable for the case when it is not WATCH
   8.345                  final Runnable onErrorRunnable = new Runnable() {
   8.346                      @Override
   8.347                      public void run() {
   8.348 +                        postRunnable.run();
   8.349                          //need to execute following code only after the value is update in onDone in createMIVar
   8.350                          final String toolTip = expr + "=" + data_value_string;//NOI18N
   8.351                          final String expression = expr;
   8.352 @@ -2984,6 +3043,7 @@
   8.353                                  ToolTipUI toolTipUI = ViewFactory.getDefault().createToolTip(toolTip, expandable, pinnable);
   8.354                                  final ToolTipSupport tts = toolTipUI.show(ep);
   8.355                                  if (tts != null) {
   8.356 +                                    tts.addPropertyChangeListener(new ToolTipSupportPropertyChangeListener(watch));
   8.357                                      mcLImpl.registerToolTip(tts, ep, lp);
   8.358                                  }
   8.359  
   8.360 @@ -3045,13 +3105,19 @@
   8.361          // see IZ 194721
   8.362          // No need to check for duplicates - gdb will create different vars
   8.363          GdbWatch gdbWatch = new GdbWatch(this, watchUpdater(), nativeWatch.getExpression());
   8.364 -        createMIVar(gdbWatch, true);
   8.365 -
   8.366 -        updateMIVar();
   8.367 +        if (get_watches || WatchBag.isPinOpened(nativeWatch)) {
   8.368 +            createMIVar(gdbWatch, true);
   8.369 +            //do not call update if there is no editor opened or watches are opened
   8.370 +//            if (get_watches || WatchBag.isPinOpened(nativeWatch)) {
   8.371 +            updateMIVar();
   8.372 +            //}
   8.373 +        }
   8.374          nativeWatch.setSubWatchFor(gdbWatch, this);
   8.375          watches.add(gdbWatch);
   8.376          manager().bringDownDialog();
   8.377 -        watchUpdater().treeChanged();     // causes a pull
   8.378 +        if (get_watches) {
   8.379 +            watchUpdater().treeChanged();     // causes a pull
   8.380 +    }       
   8.381      }
   8.382  
   8.383      @Override
   8.384 @@ -3115,7 +3181,7 @@
   8.385          if (model != null) {
   8.386              get_watches = true;
   8.387              if (state().isProcess && !state().isRunning) {
   8.388 -                updateWatches();
   8.389 +                updateWatches(true);
   8.390              }
   8.391          } else {
   8.392              get_watches = false;
   8.393 @@ -3126,23 +3192,26 @@
   8.394       * Try and re-create vars for watches which don't have var's (mi_name's)
   8.395       * yet.
   8.396       */
   8.397 -    private void retryWatches() {
   8.398 +    private void retryWatches(boolean forceVarCreate) {
   8.399  
   8.400          for (WatchVariable wv : watches) {
   8.401              GdbWatch w = (GdbWatch) wv;
   8.402 -
   8.403 -            // due to the fix of #197053 it looks safe not to create new vars
   8.404 -            if (w.getMIName() != null) {
   8.405 -                continue;		// we already have a var for this one
   8.406 +            if (forceVarCreate || w.getNativeWatch().watch().getPin() != null) {
   8.407 +                // due to the fix of #197053 it looks safe not to create new vars
   8.408 +                if (w.getMIName() != null) {
   8.409 +                    continue;		// we already have a var for this one
   8.410 +                }
   8.411 +
   8.412 +                createMIVar(w, true);
   8.413              }
   8.414 -
   8.415 -            createMIVar(w, true);
   8.416 -        }
   8.417 -    }
   8.418 -
   8.419 -    private void updateWatches() {
   8.420 -        retryWatches();
   8.421 -        updateMIVar();
   8.422 +        }
   8.423 +    }
   8.424 +
   8.425 +    private void updateWatches(boolean forceVarCreate) {
   8.426 +        retryWatches(forceVarCreate);
   8.427 +        if (forceVarCreate) {
   8.428 +            updateMIVar();
   8.429 +        }
   8.430      }
   8.431  
   8.432      private void updateVarAttr(GdbVariable v, MIRecord attr, boolean evalValue) {
   8.433 @@ -3789,21 +3858,24 @@
   8.434       */
   8.435      private void setLocals(boolean update_var, MIRecord locals) {
   8.436          MITList localsresults = locals.results();
   8.437 -        MITList locals_list = (MITList) localsresults.valueOf("locals"); // NOI18N
   8.438 +        MITList locals_list = (MITList) localsresults.valueOf("variables"); // NOI18N
   8.439          int size = locals_list.size();
   8.440          int local_count = size;
   8.441  
   8.442          List<GdbLocal> param_list = null;
   8.443          int params_count = 0;
   8.444  
   8.445 -        // paramaters
   8.446 -        GdbFrame cf = getCurrentFrame();
   8.447 -        if (cf != null) {
   8.448 -            param_list = cf.getArgsList();
   8.449 -            if (param_list != null) {
   8.450 -                params_count = param_list.size();
   8.451 -            }
   8.452 -        }
   8.453 +        //mromashova_bz#269898: we will use "-stack-list-variables --no-values" not "-stack-list-locals --no-values"
   8.454 +        //and frame will never keep args
   8.455 +//        // paramaters
   8.456 +//        GdbFrame cf = getCurrentFrame();
   8.457 +//        if (cf != null) {
   8.458 +//            //ask for the args as we will not ask now
   8.459 +//            param_list = cf.getArgsList();
   8.460 +//            if (param_list != null) {
   8.461 +//                params_count = param_list.size();
   8.462 +//            }
   8.463 +//        }
   8.464  
   8.465          local_count += params_count;
   8.466          if (Log.Variable.mi_vars) {
   8.467 @@ -3820,6 +3892,9 @@
   8.468              if (peculiarity.isLocalsOutputUnusual()) {
   8.469                  localItem = ((MITList) localItem).get(0);
   8.470              }
   8.471 +            if (localItem instanceof MITList) {
   8.472 +                localItem = ((MITList) localItem).get(0);
   8.473 +            }
   8.474              MIResult localvar = (MIResult) localItem;
   8.475              String var_name = localvar.value().asConst().value();
   8.476              GdbVariable gv = variableBag.get(var_name,
   8.477 @@ -3978,12 +4053,14 @@
   8.478  
   8.479              // For the scenario that stack view is closed and local view
   8.480              // is open, we need frame params info from here.
   8.481 -            if (get_locals && frameValue != null) {
   8.482 -                // needs to get args info
   8.483 -                // frameValue include args  info
   8.484 -                guiStackFrames = new GdbFrame[] {new GdbFrame(this, frameValue, null, null)};
   8.485 -            }
   8.486 -
   8.487 +            //mromashova_bz#269898: the above is incorrect anymore
   8.488 +            //when locals are requested we will get arguments (names and values, no need for this)
   8.489 +//            if (get_locals && frameValue != null) {
   8.490 +//                // needs to get args info
   8.491 +//                // frameValue include args  info
   8.492 +//                guiStackFrames = new GdbFrame[] {new GdbFrame(this, frameValue, null)};
   8.493 +//            }
   8.494 +        
   8.495              if (srcResults != null) {
   8.496                  boolean visited = false;
   8.497                  stack = srcResults.valueOf("stack").asList(); // NOI18N
   8.498 @@ -4017,9 +4094,12 @@
   8.499              if (get_threads) {
   8.500                  showThreads();
   8.501              }
   8.502 -
   8.503 -            if (get_watches || watchBag().hasPinnedWatches()) {
   8.504 -                updateWatches();
   8.505 +            FileObject fileObj = homeLoc == null || !homeLoc.hasSource() ? null : 
   8.506 +                    EditorBridge.findFileObject(fmap().engineToWorld(homeLoc.src()), this);                    
   8.507 +            final boolean updateWatches = get_watches || watchBag().hasPinnedWatchesOpened(fileObj);
   8.508 +            if (updateWatches) {
   8.509 +                //do not update non pinned watches if watches window is closed 
   8.510 +                updateWatches(updateWatches);
   8.511              }
   8.512  
   8.513              if (get_debugging) {
   8.514 @@ -4243,6 +4323,29 @@
   8.515              gdb.sendCommand(cmd);
   8.516          }
   8.517      }
   8.518 +    
   8.519 +    //call this when Call Stack window is opened
   8.520 +    private void requestStack() {
   8.521 +        MICommand cmd =
   8.522 +            new MiCommandImpl(peculiarity.stackListFramesCommand(currentThreadId)) {
   8.523 +            @Override
   8.524 +            protected void onDone(MIRecord record) {
   8.525 +                setStack(record);
   8.526 +                finish();
   8.527 +            }
   8.528 +            @Override
   8.529 +            protected void onError(MIRecord record) {
   8.530 +//                if (get_frames) {
   8.531 +//                    setStack(record);
   8.532 +//                }
   8.533 +//should show some message here I think
   8.534 +                finish();
   8.535 +            }
   8.536 +
   8.537 +           
   8.538 +        };
   8.539 +        gdb.sendCommand(cmd);        
   8.540 +    }    
   8.541  
   8.542      protected void requestStack(final MIRecord stopRecord) {
   8.543          MICommand cmd =
   8.544 @@ -5750,10 +5853,10 @@
   8.545  
   8.546              @Override
   8.547              protected void onDone(MIRecord record) {
   8.548 -                GdbFrame currentFrame = getCurrentFrame();
   8.549 -                if (currentFrame != null) {
   8.550 -                    currentFrame.varUpdated(var.getFullName(), value);
   8.551 -                }
   8.552 +//                GdbFrame currentFrame = getCurrentFrame();
   8.553 +//                if (currentFrame != null) {
   8.554 +//                    currentFrame.varUpdated(var.getFullName(), value);
   8.555 +//                }
   8.556                  updateMIVar();
   8.557                  finish();
   8.558              }
     9.1 --- a/cnd.debugger.gdb2/src/org/netbeans/modules/cnd/debugger/gdb2/GdbFrame.java	Mon Mar 06 17:42:32 2017 +0100
     9.2 +++ b/cnd.debugger.gdb2/src/org/netbeans/modules/cnd/debugger/gdb2/GdbFrame.java	Tue Mar 07 10:02:27 2017 +0100
     9.3 @@ -46,19 +46,26 @@
     9.4  
     9.5  import java.util.ArrayList;
     9.6  import java.util.List;
     9.7 -import org.netbeans.modules.cnd.debugger.gdb2.mi.MIResult;
     9.8  import org.netbeans.modules.cnd.debugger.gdb2.mi.MIValue;
     9.9  import org.netbeans.modules.cnd.debugger.gdb2.mi.MITList;
    9.10  import org.netbeans.modules.cnd.debugger.common2.debugger.Frame;
    9.11  import org.netbeans.modules.cnd.debugger.common2.debugger.Thread;
    9.12 +import org.netbeans.modules.cnd.debugger.gdb2.mi.MIResult;
    9.13  
    9.14  public final class GdbFrame extends Frame {
    9.15    
    9.16      private MITList MIframe;
    9.17      private final List<GdbLocal> argsArray = new ArrayList<GdbLocal>();
    9.18      private String fullname;
    9.19 +    
    9.20 +    public GdbFrame(GdbDebuggerImpl debugger, MIValue frame, 
    9.21 +            Thread thread) {
    9.22 +        this(debugger, frame, null, thread);
    9.23 +    }
    9.24  
    9.25 -    public GdbFrame(GdbDebuggerImpl debugger, MIValue frame, MIResult frameargs, Thread thread) {
    9.26 +    public GdbFrame(GdbDebuggerImpl debugger, MIValue frame, 
    9.27 +            MIResult frameargs, 
    9.28 +            Thread thread) {
    9.29  	super(debugger, thread);
    9.30  	if (frame == null) {
    9.31  	    return;
    9.32 @@ -77,9 +84,9 @@
    9.33          fullname = MIframe.getConstValue("fullname", null); // NOI18N
    9.34          
    9.35          MITList args_list = (MITList) MIframe.valueOf("args"); // NOI18N
    9.36 -	if (args_list != null && frameargs != null) {
    9.37 -	    System.out.println("GdbFrame Impossible "); // NOI18N
    9.38 -        }
    9.39 +//	if (args_list != null && frameargs != null) {
    9.40 +//	    System.out.println("GdbFrame Impossible "); // NOI18N
    9.41 +//        }
    9.42  
    9.43  	// handle args info
    9.44  	if (frameargs != null) {
    9.45 @@ -93,16 +100,25 @@
    9.46                  int args_count = args_list.size();
    9.47                      // iterate through args list
    9.48                  for (int vx=0; vx < args_count; vx++) {
    9.49 -                    MIValue arg = (MIValue)args_list.get(vx);
    9.50                      if (vx != 0) {
    9.51                          sb.append(", "); // NOI18N
    9.52 -                    }
    9.53 -                    sb.append( arg.asTuple().getConstValue("name")); // NOI18N
    9.54 -                    MIValue value = arg.asTuple().valueOf("value"); // NOI18N
    9.55 -                    if (value != null) {
    9.56 -                        argsArray.add(new GdbLocal(arg));
    9.57 -                        sb.append("="); // NOI18N
    9.58 -                        sb.append(value.asConst().value());
    9.59 +                    }                    
    9.60 +                    if (args_list.get(vx) instanceof MIValue) {
    9.61 +                        MIValue arg = (MIValue)args_list.get(vx);
    9.62 +
    9.63 +                        sb.append( arg.asTuple().getConstValue("name")); // NOI18N
    9.64 +                        MIValue value = arg.asTuple().valueOf("value"); // NOI18N
    9.65 +                        if (value != null) {
    9.66 +                            argsArray.add(new GdbLocal(arg));
    9.67 +                            sb.append("="); // NOI18N
    9.68 +                            sb.append(value.asConst().value());
    9.69 +                        }
    9.70 +                    } else if (args_list.get(vx) instanceof MIResult) {
    9.71 +                        //mromashova_bz#269898: 
    9.72 +                        //we have the list of names, no values at all
    9.73 +                        //which is correct!! as we will never call -stack-list-arguments 1 
    9.74 +                        //to get values, will call -stack-list-arguments 0 to get args names only
    9.75 +                        sb.append(((MIResult)args_list.get(vx)).value().asConst().value());
    9.76                      }
    9.77                  }
    9.78              }
    9.79 @@ -121,10 +137,14 @@
    9.80      public MITList getMIframe() {
    9.81  	return MIframe;
    9.82      }
    9.83 +    
    9.84 +    public String getLevel() {
    9.85 +        return frameno;
    9.86 +    }
    9.87  
    9.88 -    public List<GdbLocal> getArgsList() {
    9.89 -	return argsArray;
    9.90 -    }
    9.91 +//    public List<GdbLocal> getArgsList() {
    9.92 +//	return argsArray;
    9.93 +//    }
    9.94      
    9.95      @Override
    9.96      public String getFullPath() {
    9.97 @@ -135,11 +155,11 @@
    9.98          return fullname;
    9.99      }
   9.100      
   9.101 -    void varUpdated(String name, String value) {
   9.102 -        for (GdbLocal var : argsArray) {
   9.103 -            if (var.getName().equals(name)) {
   9.104 -                var.setValue(value);
   9.105 -            }
   9.106 -        }
   9.107 -    }
   9.108 +//    void varUpdated(String name, String value) {
   9.109 +//        for (GdbLocal var : argsArray) {
   9.110 +//            if (var.getName().equals(name)) {
   9.111 +//                var.setValue(value);
   9.112 +//            }
   9.113 +//        }
   9.114 +//    }
   9.115  }
    10.1 --- a/cnd.debugger.gdb2/src/org/netbeans/modules/cnd/debugger/gdb2/GdbVersionPeculiarity.java	Mon Mar 06 17:42:32 2017 +0100
    10.2 +++ b/cnd.debugger.gdb2/src/org/netbeans/modules/cnd/debugger/gdb2/GdbVersionPeculiarity.java	Tue Mar 07 10:02:27 2017 +0100
    10.3 @@ -239,7 +239,7 @@
    10.4      }
    10.5      
    10.6      public String stackListLocalsCommand() {
    10.7 -        return "-stack-list-locals --no-values"; // NOI18N
    10.8 +        return "-stack-list-variables --no-values"; // NOI18N
    10.9      }
   10.10  
   10.11      public boolean isSupported() {
    11.1 --- a/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java	Mon Mar 06 17:42:32 2017 +0100
    11.2 +++ b/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java	Tue Mar 07 10:02:27 2017 +0100
    11.3 @@ -125,6 +125,7 @@
    11.4  import java.util.List;
    11.5  import java.util.Map;
    11.6  import java.util.concurrent.CountDownLatch;
    11.7 +import java.util.concurrent.Future;
    11.8  import java.util.concurrent.TimeUnit;
    11.9  import java.util.logging.Handler;
   11.10  import java.util.logging.Level;
   11.11 @@ -1369,7 +1370,7 @@
   11.12          assertNotNull("getOccurrencesFinder must be implemented", finder);
   11.13          finder.setCaretPosition(caretOffset);
   11.14  
   11.15 -        ParserManager.parse(Collections.singleton(testSource), new UserTask() {
   11.16 +        UserTask task = new UserTask() {
   11.17              public @Override void run(ResultIterator resultIterator) throws Exception {
   11.18                  Parser.Result r = resultIterator.getParserResult(caretOffset);
   11.19                  if (r instanceof ParserResult) {
   11.20 @@ -1395,7 +1396,15 @@
   11.21                      }
   11.22                  }
   11.23              }
   11.24 -        });
   11.25 +        };
   11.26 +        if (classPathsForTest == null || classPathsForTest.isEmpty()) {
   11.27 +            ParserManager.parse(Collections.singleton(testSource), task);
   11.28 +        } else {
   11.29 +            Future<Void> future = ParserManager.parseWhenScanFinished(Collections.singleton(testSource), task);
   11.30 +            if (!future.isDone()) {
   11.31 +                future.get();
   11.32 +            }
   11.33 +        }
   11.34      }
   11.35  
   11.36      protected String annotateFinderResult(Snapshot snapshot, Map<OffsetRange, ColoringAttributes> highlights, int caretOffset) throws Exception {
   11.37 @@ -1484,7 +1493,7 @@
   11.38              enforceCaretOffset(testSource, caretOffset);
   11.39          }
   11.40  
   11.41 -        ParserManager.parse(Collections.singleton(testSource), new UserTask() {
   11.42 +        UserTask task = new UserTask() {
   11.43              public @Override void run(ResultIterator resultIterator) throws Exception {
   11.44                  Parser.Result r = resultIterator.getParserResult();
   11.45                  assertTrue(r instanceof ParserResult);
   11.46 @@ -1506,7 +1515,17 @@
   11.47                  String annotatedSource = annotateSemanticResults(doc, highlights);
   11.48                  assertDescriptionMatches(relFilePath, annotatedSource, false, ".semantic");
   11.49              }
   11.50 -        });
   11.51 +        };
   11.52 +
   11.53 +        if (classPathsForTest == null || classPathsForTest.isEmpty()) {
   11.54 +            ParserManager.parse(Collections.singleton(testSource), task);
   11.55 +        } else {
   11.56 +            Future<Void> future = ParserManager.parseWhenScanFinished(Collections.singleton(testSource), task);
   11.57 +            if (!future.isDone()) {
   11.58 +                future.get();
   11.59 +            }
   11.60 +        }
   11.61 +
   11.62      }
   11.63  
   11.64      protected void checkNoOverlaps(Set<OffsetRange> ranges, Document doc) throws BadLocationException {
   11.65 @@ -2796,7 +2815,10 @@
   11.66          if (classPathsForTest == null || classPathsForTest.isEmpty()) {
   11.67              ParserManager.parse(Collections.singleton(testSource), task);
   11.68          } else {
   11.69 -            ParserManager.parseWhenScanFinished(Collections.singleton(testSource), task);
   11.70 +            Future<Void> future = ParserManager.parseWhenScanFinished(Collections.singleton(testSource), task);
   11.71 +            if (!future.isDone()) {
   11.72 +                future.get();
   11.73 +            }
   11.74          }
   11.75      }
   11.76  
   11.77 @@ -4135,7 +4157,7 @@
   11.78          }
   11.79  
   11.80          final ComputedHints [] result = new ComputedHints[] { null };
   11.81 -        ParserManager.parse(Collections.singleton(testSource), new UserTask() {
   11.82 +        UserTask task = new UserTask() {
   11.83              public @Override void run(ResultIterator resultIterator) throws Exception {
   11.84                  Parser.Result r = resultIterator.getParserResult();
   11.85                  assertTrue(r instanceof ParserResult);
   11.86 @@ -4252,7 +4274,16 @@
   11.87                      }
   11.88                  }
   11.89              }
   11.90 -        });
   11.91 +        };
   11.92 +
   11.93 +        if (classPathsForTest == null || classPathsForTest.isEmpty()) {
   11.94 +            ParserManager.parse(Collections.singleton(testSource), task);
   11.95 +        } else {
   11.96 +            Future<Void> future = ParserManager.parseWhenScanFinished(Collections.singleton(testSource), task);
   11.97 +            if (!future.isDone()) {
   11.98 +                future.get();
   11.99 +            }
  11.100 +        }
  11.101  
  11.102          return result[0];
  11.103      }
  11.104 @@ -4507,7 +4538,7 @@
  11.105          enforceCaretOffset(testSource, caretOffset);
  11.106  
  11.107          final DeclarationLocation [] location = new DeclarationLocation[] { null };
  11.108 -        ParserManager.parse(Collections.singleton(testSource), new UserTask() {
  11.109 +        UserTask task = new UserTask() {
  11.110              public @Override void run(ResultIterator resultIterator) throws Exception {
  11.111                  Parser.Result r = resultIterator.getParserResult();
  11.112                  assertTrue(r instanceof ParserResult);
  11.113 @@ -4516,7 +4547,16 @@
  11.114                  DeclarationFinder finder = getFinder();
  11.115                  location[0] = finder.findDeclaration(pr, caretOffset);
  11.116              }
  11.117 -        });
  11.118 +        };
  11.119 +
  11.120 +        if (classPathsForTest == null || classPathsForTest.isEmpty()) {
  11.121 +            ParserManager.parse(Collections.singleton(testSource), task);
  11.122 +        } else {
  11.123 +            Future<Void> future = ParserManager.parseWhenScanFinished(Collections.singleton(testSource), task);
  11.124 +            if (!future.isDone()) {
  11.125 +                future.get();
  11.126 +            }
  11.127 +        }
  11.128  
  11.129          return location[0];
  11.130      }
    12.1 --- a/javaee.wildfly/src/org/netbeans/modules/javaee/wildfly/ide/WildflyOutputSupport.java	Mon Mar 06 17:42:32 2017 +0100
    12.2 +++ b/javaee.wildfly/src/org/netbeans/modules/javaee/wildfly/ide/WildflyOutputSupport.java	Tue Mar 07 10:02:27 2017 +0100
    12.3 @@ -42,7 +42,10 @@
    12.4  package org.netbeans.modules.javaee.wildfly.ide;
    12.5  
    12.6  import java.io.File;
    12.7 +import java.io.IOException;
    12.8 +import java.io.InputStream;
    12.9  import java.nio.charset.Charset;
   12.10 +import java.nio.file.Files;
   12.11  import java.util.HashMap;
   12.12  import java.util.Map;
   12.13  import java.util.concurrent.Callable;
   12.14 @@ -57,12 +60,12 @@
   12.15  import java.util.regex.Pattern;
   12.16  import org.netbeans.api.extexecution.ExecutionDescriptor;
   12.17  import org.netbeans.api.extexecution.ExecutionService;
   12.18 -import org.netbeans.api.extexecution.input.InputProcessor;
   12.19 -import org.netbeans.api.extexecution.input.InputProcessors;
   12.20 -import org.netbeans.api.extexecution.input.InputReader;
   12.21 -import org.netbeans.api.extexecution.input.InputReaderTask;
   12.22 -import org.netbeans.api.extexecution.input.InputReaders;
   12.23 -import org.netbeans.api.extexecution.input.LineProcessor;
   12.24 +import org.netbeans.api.extexecution.base.input.InputProcessor;
   12.25 +import org.netbeans.api.extexecution.base.input.InputProcessors;
   12.26 +import org.netbeans.api.extexecution.base.input.InputReaderTask;
   12.27 +import org.netbeans.api.extexecution.base.input.InputReaders;
   12.28 +import org.netbeans.api.extexecution.base.input.LineProcessor;
   12.29 +import org.netbeans.api.extexecution.base.input.InputReader;
   12.30  import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
   12.31  import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerSupport;
   12.32  import org.openide.windows.InputOutput;
   12.33 @@ -146,14 +149,14 @@
   12.34          reset();
   12.35  
   12.36          ExecutionDescriptor descriptor = DESCRIPTOR.inputOutput(io);
   12.37 -        descriptor = descriptor.outProcessorFactory(new ExecutionDescriptor.InputProcessorFactory() {
   12.38 +        descriptor = descriptor.outProcessorFactory(new ExecutionDescriptor.InputProcessorFactory2() {
   12.39  
   12.40              @Override
   12.41              public InputProcessor newInputProcessor(InputProcessor defaultProcessor) {
   12.42                  return InputProcessors.proxy(defaultProcessor, InputProcessors.bridge(new StartLineProcessor(profiler)));
   12.43              }
   12.44          });
   12.45 -        descriptor = descriptor.errProcessorFactory(new ExecutionDescriptor.InputProcessorFactory() {
   12.46 +        descriptor = descriptor.errProcessorFactory(new ExecutionDescriptor.InputProcessorFactory2() {
   12.47  
   12.48              @Override
   12.49              public InputProcessor newInputProcessor(InputProcessor defaultProcessor) {
   12.50 @@ -209,9 +212,15 @@
   12.51  
   12.52      public void start(InputOutput io, final File file) {
   12.53          reset();
   12.54 -
   12.55 -        InputReader reader = InputReaders.forFile(file, Charset.defaultCharset());
   12.56 -        InputReaderTask localFileTask = InputReaderTask.newTask(reader, InputProcessors.printing(io.getOut(), false));
   12.57 +        InputReader reader;
   12.58 +        try {
   12.59 +            InputStream in = Files.newInputStream(file.toPath());
   12.60 +            in.skip(file.length());
   12.61 +            reader = InputReaders.forStream(in, Charset.defaultCharset());
   12.62 +        } catch (IOException ex) {
   12.63 +            reader = InputReaders.forFile(file, Charset.defaultCharset());
   12.64 +        }
   12.65 +        InputReaderTask localFileTask = InputReaderTask.newTask(reader, InputProcessors.printing(io.getOut()));
   12.66          LOG_FILE_SERVICE.submit(localFileTask);
   12.67          synchronized (this) {
   12.68              fileTask = localFileTask;
   12.69 @@ -401,7 +410,7 @@
   12.70                      || line.contains("started (with errors) in")) // JBoss 7 with some errors (include wrong deployments) // NOI18N
   12.71                      || JBOSS_7_STARTED_ML.matcher(line).matches()
   12.72                      || WILDFLY_8_STARTED_ML.matcher(line).matches()
   12.73 -                    || WILDFLY_9_STARTED_ML.matcher(line).matches()                    
   12.74 +                    || WILDFLY_9_STARTED_ML.matcher(line).matches()
   12.75                      || WILDFLY_10_STARTED_ML.matcher(line).matches()
   12.76                      || EAP6_STARTED_ML.matcher(line).matches()
   12.77                      || EAP7_STARTED_ML.matcher(line).matches();
   12.78 @@ -446,4 +455,4 @@
   12.79          }
   12.80  
   12.81      }
   12.82 -}
   12.83 +}
   12.84 \ No newline at end of file
    13.1 --- a/javaee.wildfly/src/org/netbeans/modules/javaee/wildfly/ide/WildflyStartRunnable.java	Mon Mar 06 17:42:32 2017 +0100
    13.2 +++ b/javaee.wildfly/src/org/netbeans/modules/javaee/wildfly/ide/WildflyStartRunnable.java	Tue Mar 07 10:02:27 2017 +0100
    13.3 @@ -270,6 +270,9 @@
    13.4          env.setVariable("JAVA_HOME", javaHome); // NOI18N
    13.5          env.setVariable(JBOSS_HOME, ip.getProperty(WildflyPluginProperties.PROPERTY_ROOT_DIR)); // NOI18N
    13.6          env.setVariable(JAVA_OPTS, javaOpts); // NOI18N
    13.7 +        if(Utilities.isWindows()) {
    13.8 +            env.setVariable("NOPAUSE", "true"); // NOI18N
    13.9 +        }
   13.10      }
   13.11  
   13.12      private static StartupExtender.StartMode getMode(WildflyStartServer.MODE jbMode) {
    14.1 --- a/javaee.wildfly/src/org/netbeans/modules/javaee/wildfly/ide/ui/AddServerPropertiesVisualPanel.java	Mon Mar 06 17:42:32 2017 +0100
    14.2 +++ b/javaee.wildfly/src/org/netbeans/modules/javaee/wildfly/ide/ui/AddServerPropertiesVisualPanel.java	Tue Mar 07 10:02:27 2017 +0100
    14.3 @@ -443,10 +443,10 @@
    14.4  
    14.5          domainPathField.setEnabled(false);
    14.6  
    14.7 -        userField.setVisible(false);
    14.8 -        userLabel.setVisible(false);
    14.9 -        passwordField.setVisible(false);
   14.10 -        passwordLabel.setVisible(false);
   14.11 +        userField.setVisible(true);
   14.12 +        userLabel.setVisible(true);
   14.13 +        passwordField.setVisible(true);
   14.14 +        passwordLabel.setVisible(true);
   14.15  
   14.16  
   14.17          serverType.setVisible(false);
    15.1 --- a/php.editor/test/unit/src/org/netbeans/modules/php/editor/actions/ImportDataCreatorTest.java	Mon Mar 06 17:42:32 2017 +0100
    15.2 +++ b/php.editor/test/unit/src/org/netbeans/modules/php/editor/actions/ImportDataCreatorTest.java	Tue Mar 07 10:02:27 2017 +0100
    15.3 @@ -45,6 +45,7 @@
    15.4  import java.util.Collections;
    15.5  import java.util.List;
    15.6  import java.util.Map;
    15.7 +import java.util.concurrent.Future;
    15.8  import javax.swing.text.Document;
    15.9  import org.netbeans.api.java.classpath.ClassPath;
   15.10  import org.netbeans.modules.csl.spi.ParserResult;
   15.11 @@ -151,8 +152,7 @@
   15.12              caretOffset = -1;
   15.13          }
   15.14          final ImportData[] result = new ImportData[1];
   15.15 -        ParserManager.parse(Collections.singleton(testSource), new UserTask() {
   15.16 -
   15.17 +        Future<Void> future = ParserManager.parseWhenScanFinished(Collections.singleton(testSource), new UserTask() {
   15.18              @Override
   15.19              public void run(ResultIterator resultIterator) throws Exception {
   15.20                  Parser.Result r = caretOffset == -1 ? resultIterator.getParserResult() : resultIterator.getParserResult(caretOffset);
   15.21 @@ -178,6 +178,9 @@
   15.22                  }
   15.23              }
   15.24          });
   15.25 +        if (!future.isDone()) {
   15.26 +            future.get();
   15.27 +        }
   15.28  
   15.29          return result[0];
   15.30      }
    16.1 --- a/php.editor/test/unit/src/org/netbeans/modules/php/editor/csl/PhpNavigatorTestBase.java	Mon Mar 06 17:42:32 2017 +0100
    16.2 +++ b/php.editor/test/unit/src/org/netbeans/modules/php/editor/csl/PhpNavigatorTestBase.java	Tue Mar 07 10:02:27 2017 +0100
    16.3 @@ -45,6 +45,9 @@
    16.4  import java.util.Collections;
    16.5  import java.util.Comparator;
    16.6  import java.util.List;
    16.7 +import java.util.Map;
    16.8 +import java.util.concurrent.Future;
    16.9 +import org.netbeans.api.java.classpath.ClassPath;
   16.10  import org.netbeans.modules.csl.api.HtmlFormatter;
   16.11  import org.netbeans.modules.csl.api.StructureItem;
   16.12  import org.netbeans.modules.parsing.api.ParserManager;
   16.13 @@ -81,8 +84,7 @@
   16.14              }
   16.15          };
   16.16          final List<StructureItem> result = new ArrayList<>();
   16.17 -        ParserManager.parse(Collections.singleton(testSource), new UserTask() {
   16.18 -
   16.19 +        UserTask task = new UserTask() {
   16.20              @Override
   16.21              public void run(ResultIterator resultIterator) throws Exception {
   16.22                  PHPParseResult info = (PHPParseResult)resultIterator.getParserResult();
   16.23 @@ -90,7 +92,18 @@
   16.24                      result.addAll(instance.scan(info));
   16.25                  }
   16.26              }
   16.27 -        });
   16.28 +        };
   16.29 +
   16.30 +        Map<String, ClassPath> classPaths = createClassPathsForTest();
   16.31 +        if (classPaths == null || classPaths.isEmpty()) {
   16.32 +            ParserManager.parse(Collections.singleton(testSource), task);
   16.33 +        } else {
   16.34 +            Future<Void> future = ParserManager.parseWhenScanFinished(Collections.singleton(testSource), task);
   16.35 +            if (!future.isDone()) {
   16.36 +                future.get();
   16.37 +            }
   16.38 +        }
   16.39 +
   16.40          Comparator<StructureItem> comparator = new Comparator<StructureItem>() {
   16.41              @Override
   16.42              public int compare(StructureItem o1, StructureItem o2) {
    17.1 --- a/php.editor/test/unit/src/org/netbeans/modules/php/editor/index/PHPIndexTest.java	Mon Mar 06 17:42:32 2017 +0100
    17.2 +++ b/php.editor/test/unit/src/org/netbeans/modules/php/editor/index/PHPIndexTest.java	Tue Mar 07 10:02:27 2017 +0100
    17.3 @@ -45,10 +45,17 @@
    17.4  import java.util.ArrayList;
    17.5  import java.util.Arrays;
    17.6  import java.util.Collection;
    17.7 +import java.util.Collections;
    17.8  import java.util.Iterator;
    17.9  import java.util.List;
   17.10  import java.util.Set;
   17.11 +import java.util.concurrent.Future;
   17.12  import org.junit.Test;
   17.13 +import org.netbeans.modules.csl.spi.ParserResult;
   17.14 +import org.netbeans.modules.parsing.api.ParserManager;
   17.15 +import org.netbeans.modules.parsing.api.ResultIterator;
   17.16 +import org.netbeans.modules.parsing.api.Source;
   17.17 +import org.netbeans.modules.parsing.api.UserTask;
   17.18  import org.netbeans.modules.parsing.spi.indexing.support.QuerySupport;
   17.19  import org.netbeans.modules.php.editor.api.ElementQuery;
   17.20  import org.netbeans.modules.php.editor.api.ElementQueryFactory;
   17.21 @@ -84,8 +91,20 @@
   17.22      @Override
   17.23      public void setUp() throws Exception {
   17.24          super.setUp();
   17.25 -        QuerySupport querySupport = QuerySupportFactory.get(Arrays.asList(createSourceClassPathsForTest()));
   17.26 -        index = ElementQueryFactory.createIndexQuery(querySupport);
   17.27 +        Source source = getTestSource();
   17.28 +        Future<Void> future = ParserManager.parseWhenScanFinished(Collections.singleton(source), new UserTask() {
   17.29 +            @Override
   17.30 +            public void run(ResultIterator resultIterator) throws Exception {
   17.31 +                final ParserResult parserResult = (ParserResult) resultIterator.getParserResult();
   17.32 +                if (parserResult != null) {
   17.33 +                    QuerySupport querySupport = QuerySupportFactory.get(parserResult);
   17.34 +                    index = ElementQueryFactory.createIndexQuery(querySupport);
   17.35 +                }
   17.36 +            }
   17.37 +        });
   17.38 +        if (!future.isDone()) {
   17.39 +            future.get();
   17.40 +        }
   17.41      }
   17.42  
   17.43      /**
   17.44 @@ -572,6 +591,12 @@
   17.45          return new FileObject[]{FileUtil.toFileObject(folder)};
   17.46      }
   17.47  
   17.48 +    protected Source getTestSource() {
   17.49 +        final File file = new File(getDataDir(), getTestPath());
   17.50 +        FileObject fileObject = FileUtil.toFileObject(file);
   17.51 +        return Source.create(fileObject);
   17.52 +    }
   17.53 +
   17.54      private String getTestFolderPath() {
   17.55          return "testfiles/index/" + getTestName();//NOI18N
   17.56      }
    18.1 --- a/php.editor/test/unit/src/org/netbeans/modules/php/editor/model/impl/ModelIndexTest.java	Mon Mar 06 17:42:32 2017 +0100
    18.2 +++ b/php.editor/test/unit/src/org/netbeans/modules/php/editor/model/impl/ModelIndexTest.java	Tue Mar 07 10:02:27 2017 +0100
    18.3 @@ -50,9 +50,11 @@
    18.4  import java.util.List;
    18.5  import java.util.Map;
    18.6  import java.util.Set;
    18.7 +import java.util.concurrent.Future;
    18.8  import java.util.logging.Filter;
    18.9  import java.util.logging.LogRecord;
   18.10  import java.util.logging.Logger;
   18.11 +import org.netbeans.api.java.classpath.ClassPath;
   18.12  import org.netbeans.modules.parsing.api.Source;
   18.13  import org.netbeans.modules.parsing.api.ParserManager;
   18.14  import org.netbeans.modules.parsing.api.ResultIterator;
   18.15 @@ -127,7 +129,15 @@
   18.16      void performModelTest(AbstractTestModelTask task, String testFilePath) throws Exception {
   18.17          FileObject testFile = getTestFile(testFilePath);
   18.18          Source testSource = getTestSource(testFile);
   18.19 -        ParserManager.parse(Collections.singleton(testSource), task);
   18.20 +        Map<String, ClassPath> classPaths = createClassPathsForTest();
   18.21 +        if (classPaths == null || classPaths.isEmpty()) {
   18.22 +            ParserManager.parse(Collections.singleton(testSource), task);
   18.23 +        } else {
   18.24 +            Future<Void> future = ParserManager.parseWhenScanFinished(Collections.singleton(testSource), task);
   18.25 +            if (!future.isDone()) {
   18.26 +                future.get();
   18.27 +            }
   18.28 +        }
   18.29      }
   18.30  
   18.31      static <T extends ModelElement> T getFirst(Collection<T> allElements,