DesignFlowView.java 69.4 KB
Newer Older
1 2 3
/*******************************************************************************
 * Copyright (c) 2014 Elphel, Inc.
 * Copyright (c) 2006 Elphel, Inc and Excelsior, LLC.
4 5
 * This file is a part of VDT plug-in.
 * VDT plug-in is free software; you can redistribute it and/or modify
6 7 8 9
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
10
 * VDT plug-in is distributed in the hope that it will be useful,
11 12 13 14 15 16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
Andrey Filippov's avatar
Andrey Filippov committed
17 18 19 20 21 22 23 24 25
 * 
 *  Additional permission under GNU GPL version 3 section 7:
 * If you modify this Program, or any covered work, by linking or combining it
 * with Eclipse or Eclipse plugins (or a modified version of those libraries),
 * containing parts covered by the terms of EPL/CPL, the licensors of this
 * Program grant you additional permission to convey the resulting work.
 * {Corresponding Source for a non-source form of such a combination shall
 * include the source code for the parts of Eclipse or Eclipse plugins used
 * as well as that of the covered work.}
26
 *******************************************************************************/
27 28 29
package com.elphel.vdt.ui.views;

import java.util.List;
30
import java.util.Map;
31 32

import org.eclipse.swt.widgets.Composite;
Andrey Filippov's avatar
Andrey Filippov committed
33

34 35
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
36
import org.eclipse.swt.widgets.Shell;
37 38
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
39 40 41 42
import org.eclipse.ui.part.*;
import org.eclipse.jface.viewers.*;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.graphics.Image;
43
//import org.eclipse.swt.graphics.ImageData;
44 45 46 47
import org.eclipse.jface.action.*;
import org.eclipse.ui.*;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.SWT;
48
import org.eclipse.core.resources.IFile;
49 50 51 52
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
53
import org.eclipse.core.runtime.IPath;
54
import org.eclipse.core.runtime.Path;
55
import org.eclipse.core.runtime.QualifiedName;
56

57
import java.io.File;
58

59
import com.elphel.vdt.core.launching.LaunchCore;
60
import com.elphel.vdt.core.launching.ToolLogFile;
61 62 63 64 65 66
import com.elphel.vdt.core.options.OptionsCore;
import com.elphel.vdt.core.options.ValueBasedOption;
import com.elphel.vdt.core.tools.ToolsCore;
import com.elphel.vdt.core.tools.contexts.Context;
import com.elphel.vdt.core.tools.menu.DesignMenu;
import com.elphel.vdt.core.tools.params.Tool;
67
import com.elphel.vdt.core.tools.params.Tool.TOOL_MODE;
68 69
import com.elphel.vdt.core.tools.params.Tool.TOOL_STATE;
import com.elphel.vdt.core.tools.params.ToolSequence;
70
import com.elphel.vdt.core.tools.params.types.RunFor;
71 72
import com.elphel.vdt.Txt;
import com.elphel.vdt.VDT;
73
import com.elphel.vdt.VerilogUtils;
74
import com.elphel.vdt.veditor.VerilogPlugin;
75
import com.elphel.vdt.veditor.preference.PreferenceStrings;
76 77 78 79 80 81
import com.elphel.vdt.ui.MessageUI;
import com.elphel.vdt.ui.VDTPluginImages;
import com.elphel.vdt.ui.variables.SelectedResourceManager;
import com.elphel.vdt.ui.views.DesignMenuModel;
import com.elphel.vdt.ui.dialogs.DesignMenuSelectionDialog;
import com.elphel.vdt.ui.options.ContextOptionsDialog;
82
import com.elphel.vdt.ui.options.FilteredFileSelector;
83 84
import com.elphel.vdt.ui.options.SetupOptionsDialog;
import com.elphel.vdt.ui.options.SetupOptionsManager;
85

86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.ui.DebugUITools;

/**
 * This sample class demonstrates how to plug-in a new
 * workbench view. The view shows data obtained from the
 * model. The sample creates a dummy model on the fly,
 * but a real implementation would connect to the model
 * available either in this or another plug-in (e.g. the workspace).
 * The view is connected to the model using a content provider.
 * <p>
 * The view uses a label provider to define how model
 * objects should be presented in the view. Each
 * view can present the same model objects using
 * different labels and icons, if needed. Alternatively,
 * a single label provider can be shared between views
 * in order to ensure that objects of the same type are
 * presented in the same way everywhere.
 * <p>
 */

public class DesignFlowView extends ViewPart implements ISelectionListener {

    // Persistance tags.
110 111 112
    private static final String TAG_SELECTED_RESOURCE =   "SelectedProject";
    private static final String TAG_SELECTED_HDL_FILE =   "SelectedHdlFile";
    private static final String TAG_SELECTED_HDL_FILTER = "SelectedHdlFilter";
113
    private static final String TAG_LINKED_TOOLS =        "LinkedTools";
114 115

    private TreeViewer viewer;
Andrey Filippov's avatar
Andrey Filippov committed
116
//    private DrillDownAdapter drillDownAdapter;
117
    private Action showLaunchConfigAction;
118 119
//    private Action launchAction;
    
120
    private Action toggleLinkedTools;
121 122
    private Action toggleSaveTools;
    private Action toggleStopTools;
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138

    private Action showInstallationPropertiesAction;
    private ClearAction clearInstallationPropertiesAction;
    
    private Action showPackagePropertiesAction;
    private GlobalContextsAction showPackagePropertiesToolbarAction;
    private ClearContextAction clearPackagePropertiesAction;
    
    private Action showProjectAction;
    private LocalContextsAction showProjectPropertiesToolbarAction;
    private ClearLocalContextAction clearProjectPropertiesAction;
    
    private Action showPropertiesAction;
    private ClearAction clearToolPropertiesAction;

    private Action selectDesignMenuAction;
139
    private ClearToolStates clearToolStatesAction;
140 141
    
    private ClearProjectStates clearProjectStatesAction;
142 143 144 145
    private ClearStateFiles clearStateFilesAction;
    private ClearLogFiles clearLogFilesAction;

    
146 147 148 149 150 151 152 153 154 155 156
    
    private IResource selectedResource;
    
    private DesignMenuModel.Item selectedItem;
    
    private ValueBasedOption desigMenuName;
    
    private String defaultPartName;

    private IMemento memento;
    
157 158 159 160
    private Action pinAction;
    private Action restoreAction;
    private Action restoreSelectAction;

161 162 163 164
    private Action playbackLogLatestAction;
    private Action playbackLogSelectAction;
    
    
165 166
    IDoubleClickListener doubleClickListener=null;
    private Action [] launchActions;
167
    private ToolSequence toolSequence=null;
Andrey Filippov's avatar
Andrey Filippov committed
168
//    private Composite compositeParent;
169 170 171 172 173
    /**
     * The constructor.
     */
    public DesignFlowView() {
        desigMenuName = new ValueBasedOption(VDT.OPTION_PROJECT_MENU);
174 175 176 177
        toolSequence = new ToolSequence(this);
    }
    public ToolSequence getToolSequence(){
    	return toolSequence;
178
    }
179 180 181 182 183 184
    public void setToggleSaveTools(boolean checked){
    	toggleSaveTools.setChecked(checked);
    }
    public void setToggleStopTools(boolean checked){
    	toggleStopTools.setChecked(checked);
    }
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211

    /* 
     * Method declared on IViewPart.
     */
     public void init(IViewSite site, IMemento memento) throws PartInitException {
         defaultPartName = getPartName();
         super.init(site, memento);
         this.memento = memento;
         // add itself as a global selection listener
         getSite().getPage().addSelectionListener(this);
     }
    
    /* 
     * Method declared on IWorkbenchPart.
     */
    public void dispose() {
        // remove ourself as a global selection listener
        getSite().getPage().removeSelectionListener(this);
        // run super.
        super.dispose();
    }

    /**
     * This is a callback that will allow us
     * to create the viewer and initialize it.
     */
    public void createPartControl(Composite parent) {
212 213 214
		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
			System.out.println("+++++ createPartControl()");
    	
Andrey Filippov's avatar
Andrey Filippov committed
215
//    	compositeParent=parent; // will it help to re-draw
216
        viewer = new TreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
Andrey Filippov's avatar
Andrey Filippov committed
217
//        drillDownAdapter = new DrillDownAdapter(viewer);
218 219 220 221 222 223 224 225

        viewer.setContentProvider(new ViewContentProvider());
        viewer.setLabelProvider(new ViewLabelProvider());
// more complex sorter is needed        
//        viewer.setSorter(new NameSorter());
//        viewer.setInput(getViewSite());
//        viewer.setInput(ToolsCore.getDesignMenu());
        viewer.addSelectionChangedListener(new ToolSelectionChangedListener());
226 227 228 229 230 231 232 233 234 235 236 237 238 239
        // Draw tool state (running, success, failure, ...) icon after the label in the tree
        final Tree tree=  viewer.getTree();
        tree.addListener(SWT.MeasureItem, new Listener() {
        	public void handleEvent(Event event) {
    			((DesignMenuModel.Item) ((TreeItem)event.item).getData()).measureItem (event);
        	}
        });
        
        tree.addListener(SWT.PaintItem, new Listener() {
        	   public void handleEvent(Event event) {
         	      TreeItem item = (TreeItem)event.item;
         	     ((DesignMenuModel.Item) item.getData()).showStateIcon(event,tree,item);
        	   }
        	});
240 241
        makeActions();
        hookContextMenu();
242
/**+       hookDoubleClickAction(); */
243 244 245 246 247
        contributeToActionBars();

        if (memento != null)
            restoreState(memento);
        memento = null;
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
        
        tree.addListener(SWT.KeyUp, new Listener(){
            @Override
            public void handleEvent(Event event) {
            	if (event.keyCode == SWT.SHIFT) {
            		toolSequence.setShiftPressed(false);
            	}
            }
        });
        tree.addListener(SWT.KeyDown, new Listener(){
            @Override
            public void handleEvent(Event event) {
            	if (event.keyCode == SWT.SHIFT) {
            		toolSequence.setShiftPressed(true);
            	}
            }
        });

        
267 268
    } // createPartControl()

269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
    private void doLoadDesignMenu(IProject newProject) {
		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER)) {
			System.out.println("##### doLoadDesignMenu("+newProject+"): current project="+selectedResource.getProject().toString());
		}
		if (newProject!=null){
			restoreCurrentState(newProject);
    		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
    			System.out.println("Restored new project: "+newProject.toString());
   	   	    IResource HDLFile=SelectedResourceManager.getDefault().getChosenVerilogFile();
   	   	    if ((HDLFile!=null) && (toolSequence!=null)){
   	   	    	if (VerilogUtils.existsVeditorOutlineDatabase(newProject)){
   	   	    		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
   	   	    			System.out.println("VEditor DB for "+newProject+" already exist");
   	   	    		toolSequence.setUnfinishedBoot(null,false);
   	   	    		finalizeAfterVEditorDB(memento);
   	   	    	} else {
   	   	    		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
   	   	    			System.out.println("Initiating DB rebuild HDLFile="+HDLFile);
   	   	    		toolSequence.setUnfinishedBoot(null,true);
Andrey Filippov's avatar
Andrey Filippov committed
288 289 290
   	   	    		VerilogUtils.getTopModuleNames((IFile) HDLFile); // will initiate DB rebuild, updateDirty and call doLoadDesignMenu();
//   	   	  java.lang.ClassCastException: org.eclipse.core.internal.resources.Project cannot be cast to org.eclipse.core.resources.IFile
//   	   	  	at com.elphel.vdt.ui.views.DesignFlowView.doLoadDesignMenu(DesignFlowView.java:279)
291 292 293 294 295 296 297
   	   	    	}
   	   	    	return; 
   	   	    }
		}
		doLoadDesignMenu();
    }

298
    private void doLoadDesignMenu() {
299 300 301
		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER)) {
			System.out.println("#### doLoadDesignMenu(): project="+selectedResource.getProject().toString());
		}
302 303 304 305
        String menuName = selectedResource == null
                        ? null
                        : OptionsCore.doLoadOption(desigMenuName, selectedResource.getProject()); 
        doLoadDesignMenu(menuName);
306
        
307 308
    }

309
    
310
    private void doLoadDesignMenu(String menuName) {
311
        if (menuName != null) { // Horizontal menu bar
312 313 314 315
            DesignMenu designMenu = ToolsCore.getDesignMenuManager().findDesignMenu(menuName);
            viewer.setInput(designMenu);
            List<Context> packages = ToolsCore.getDesignMenuManager().getPackageContexts(designMenu);
            showPackagePropertiesToolbarAction.setContexts(packages);
316
            clearPackagePropertiesAction.setContexts(packages); // toolBarSeparator already null here
317 318 319 320 321 322 323 324 325 326 327 328 329
            List<Context> projects = ToolsCore.getDesignMenuManager().getProjectContexts(designMenu);
            showProjectPropertiesToolbarAction.setContexts(projects);
            clearProjectPropertiesAction.setContexts(projects);
            setPartName(designMenu.getLabel());
            setTitleToolTip(designMenu.getDescription());
        } else {
            viewer.setInput(null);
            showPackagePropertiesToolbarAction.setContexts(null);
            showProjectPropertiesToolbarAction.setContexts(null);
            setPartName(defaultPartName);
            setTitleToolTip(null);
        }
    }
330 331 332 333
    
    public void changeMenuTitle(String title){
    	setPartName(title);
    }
334 335 336
    public String getMenuTitle(){
    	return getPartName();
    }
337 338 339 340 341 342

    private void hookContextMenu() {
        MenuManager menuMgr = new MenuManager("#PopupMenu");
        menuMgr.setRemoveAllWhenShown(true);
        menuMgr.addMenuListener(new IMenuListener() {
            public void menuAboutToShow(IMenuManager manager) {
343
                DesignFlowView.this.fillContextMenu(manager);  // context (right-click) menu
344 345 346 347 348 349 350
            }
        });
        Menu menu = menuMgr.createContextMenu(viewer.getControl());
        viewer.getControl().setMenu(menu);
        getSite().registerContextMenu(menuMgr, viewer);
    }

351 352
    
    //
353 354
    private void contributeToActionBars() {
        IActionBars bars = getViewSite().getActionBars();
355 356
        fillLocalPullDown(bars.getMenuManager());   // rightmost pull-down 
        fillLocalToolBar(bars.getToolBarManager()); // horizontal bar
357 358
    }

359
    private void fillLocalPullDown(IMenuManager manager) { //rightmost pull-down
360 361 362 363 364
        manager.add(clearInstallationPropertiesAction);
        manager.add(clearPackagePropertiesAction);
        manager.add(clearProjectPropertiesAction);
        manager.add(clearToolPropertiesAction);
        manager.add(new Separator());
365 366
        manager.add(selectDesignMenuAction);
        manager.add(new Separator());
367 368
        manager.add(clearStateFilesAction);
        manager.add(clearLogFilesAction);
369
        manager.add(clearToolStatesAction);
370
        manager.add(new Separator());
371
        manager.add(clearProjectStatesAction);
372
    }
373 374 375 376 377 378 379 380 381 382
    
    private void fillContextMenu(IMenuManager manager) { // context (right-click) menu
    	// Always come here after setting launchActions, so just add all launchActions here
    	/**+       manager.add(launchAction); */
    	if (launchActions!=null) { 
    		for (Action action:launchActions){
    			manager.add(action); // No Separator??
    		}
    	}
   	
383
//    	System.out.println("fillContextMenu(), launchActions="+launchActions);
384
        //      manager.add(new Separator());
385
//      drillDownAdapter.addNavigationActions(manager);
386
      // Other plug-ins can contribute their actions here
387 388 389 390 391 392 393 394 395 396
    	
    	if (pinAction!=null){
    		manager.add(new Separator());
    		manager.add(pinAction);
    	}    	
    	if ((restoreAction!=null) || (restoreSelectAction!=null) ) {
    		manager.add(new Separator()); 
    		if (restoreAction!=null) manager.add(restoreAction);
    		if (restoreSelectAction!=null) manager.add(restoreSelectAction);
    	}    	
397 398 399 400 401
    	if ((playbackLogLatestAction!=null) || (playbackLogSelectAction!=null) ) {
    		manager.add(new Separator()); 
    		if (playbackLogLatestAction!=null) manager.add(playbackLogLatestAction);
    		if (playbackLogSelectAction!=null) manager.add(playbackLogSelectAction);
    	}
402
        manager.add(new Separator()); 
403 404 405 406
        manager.add(showInstallationPropertiesAction);
        manager.add(showPackagePropertiesAction);
        manager.add(showProjectAction);
        manager.add(showPropertiesAction);
407
//        manager.add(showLaunchConfigAction);
408 409 410
        manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    }
        
411
    private void fillLocalToolBar(IToolBarManager manager) { // On Horizontal bar
412 413 414 415 416 417 418 419
/**+               manager.add(launchAction); */
     	if (launchActions!=null) { 
    		for (Action action:launchActions){
    			manager.add(action); // No Separator??
    		}
    	}
//    	System.out.println("fillLocalToolBar(), launchActions="+launchActions);
   	 
420
//        manager.add(launchAction);  // test
421 422
//      manager.add(new Separator());
//      drillDownAdapter.addNavigationActions(manager);
423
        manager.add(new Separator("toolbar-separator"));
424
        manager.add(toggleLinkedTools);
425 426 427
        manager.add(toggleSaveTools);
        manager.add(toggleStopTools);
        manager.add(new Separator());
428 429 430 431
        manager.add(showInstallationPropertiesAction);
        manager.add(showPackagePropertiesToolbarAction);
        manager.add(showProjectPropertiesToolbarAction);
        manager.add(showPropertiesAction);
432 433
        manager.update(false); // (force) - added new, but removed project, tool and clear/change menu for Icarus (kept the same number of items) Need to update higher menu
        getViewSite().getActionBars().updateActionBars();
434
    }
435
    
436
    private void makeActions() {
437 438 439 440
    	final DesignFlowView fDesignFlowView=this;
		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER)) {
			System.out.println("makeActions()");
		}
441 442 443 444 445 446 447 448 449 450
		
	    toggleLinkedTools= new Action("Toggle tool dependency", Action.AS_CHECK_BOX) {
            public void run() {
//            	System.out.println("isChecked()="+isChecked());
            	SelectedResourceManager.getDefault().setToolsLinked(!isChecked());
            	if (isChecked()){
            		toggleLinkedTools.setImageDescriptor(VDTPluginImages.DESC_TOOLS_UNLINKED);
            	} else {
            		toggleLinkedTools.setImageDescriptor(VDTPluginImages.DESC_TOOLS_LINKED);
            	}
Andrey Filippov's avatar
Andrey Filippov committed
451 452
//            	toolSequence.setToolsDirtyFlag(false); //boolean update) - recalculate dirty flags
            	fDesignFlowView.updateLaunchAction(true); // will call toolSequence.setToolsDirtyFlag(false)
453 454 455 456 457
            }
        };
        toggleLinkedTools.setToolTipText("Toggle tool dependency");
        toggleLinkedTools.setImageDescriptor(VDTPluginImages.DESC_TOOLS_LINKED);
        toggleLinkedTools.setChecked(!SelectedResourceManager.getDefault().isToolsLinked()); // normally happens before reading memento
458 459 460 461 462 463 464 465 466 467
        

        toggleSaveTools= new Action("Save tool state", Action.AS_CHECK_BOX) {
            public void run() {
            	toolSequence.setSave(isChecked());
            }
        };
        toggleSaveTools.setToolTipText("Save tool state");
        toggleSaveTools.setImageDescriptor(VDTPluginImages.DESC_TOOLS_SAVE);
        
468 469
        //isSaveEnabled()
        
470 471 472 473 474 475 476 477 478

        toggleStopTools= new Action("Stop tools", Action.AS_CHECK_BOX) {
            public void run() {
            	toolSequence.setStop(isChecked());
            }
        };
        toggleStopTools.setToolTipText("Request tool sequence stop (when convenient), with <SHFT> - mark stopped (for debug)");
        toggleStopTools.setImageDescriptor(VDTPluginImages.DESC_TOOLS_STOP);
         
479
		
480 481
        showInstallationPropertiesAction = new Action() {
            public void run() {
482
                if (openInstallationPropertiesDialog()==Window.OK){
483 484 485
            		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER)) {
            			System.out.println("openInstallationPropertiesDialog()-> OK");
            		}
Andrey Filippov's avatar
Andrey Filippov committed
486
                	fDesignFlowView.updateLaunchAction(true);
487
                }; 
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504
            }
        };
        showInstallationPropertiesAction.setText("Installation Parameters");
        showInstallationPropertiesAction.setToolTipText("Set installation parameters");
        showInstallationPropertiesAction.setImageDescriptor(VDTPluginImages.DESC_INSTALL_PROPERTIES);
        showInstallationPropertiesAction.setEnabled(ToolsCore.getInstallationContext() != null);

        clearInstallationPropertiesAction = new ClearAction("Do you wish to delete values of installation parameters?") {
            public void clear() {
                SetupOptionsManager.clear();    
            }
        };
        clearInstallationPropertiesAction.setText("Clear Installation Parameters");
        clearInstallationPropertiesAction.setImageDescriptor(VDTPluginImages.DESC_INSTALL_PROPERTIES);
        clearInstallationPropertiesAction.setEnabled(ToolsCore.getInstallationContext() != null);
        
        
505
        showPackagePropertiesToolbarAction = new GlobalContextsAction("Package Parameters",fDesignFlowView);
506 507 508 509 510 511
        showPackagePropertiesToolbarAction.setText("Package Parameters");
        showPackagePropertiesToolbarAction.setToolTipText("Set package parameters for this tool");
        showPackagePropertiesToolbarAction.setImageDescriptor(VDTPluginImages.DESC_PACKAGE_PROPERTIES);
        
        showPackagePropertiesAction = new Action() {
            public void run() {
512 513 514 515 516
            	if (GlobalContextsAction.openDialog( "Package Parameters"
                                               , selectedItem.getPackageContext() )==Window.OK){
            		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER)) {
            			System.out.println("GlobalContextsAction.openDialog()-> OK");
            		}
Andrey Filippov's avatar
Andrey Filippov committed
517
                	fDesignFlowView.updateLaunchAction(); // is it already updated?
518
                }; 
519 520 521 522 523 524 525 526 527 528 529
            }
        };
        showPackagePropertiesAction.setText("Package Parameters");
        showPackagePropertiesAction.setToolTipText("Set package parameters");
        showPackagePropertiesAction.setImageDescriptor(VDTPluginImages.DESC_PACKAGE_PROPERTIES);

        clearPackagePropertiesAction = new ClearContextAction("Do you wish to delete values of packages parameters?");
        clearPackagePropertiesAction.setText("Clear Package Parameters");
        clearPackagePropertiesAction.setImageDescriptor(VDTPluginImages.DESC_PACKAGE_PROPERTIES);

        
530
        showProjectPropertiesToolbarAction = new LocalContextsAction("Project Parameters",fDesignFlowView);
531
        showProjectPropertiesToolbarAction.setText("Project Parameters");
532
        showProjectPropertiesToolbarAction.setToolTipText("Set project parameters (toolbar)");
533 534 535 536
        showProjectPropertiesToolbarAction.setImageDescriptor(VDTPluginImages.DESC_PROJECT_PROPERTIES);

        showProjectAction = new Action() {
            public void run() {
537
            	if (LocalContextsAction.openDialog( "Project Parameters"
538
                                              , selectedItem.getProjectContext() 
539
                                              , selectedResource.getProject() )==Window.OK){
540 541 542
            		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER)) {
            			System.out.println("LocalContextsAction.openDialog()-> OK");
            		}
Andrey Filippov's avatar
Andrey Filippov committed
543
                	fDesignFlowView.updateLaunchAction(); // is it already updated?
544
                }; 
545 546 547
            }
        };
        showProjectAction.setText("Project Parameters");
548
        showProjectAction.setToolTipText("Set project parameters (context menue)");
549 550 551 552 553 554 555 556 557
        showProjectAction.setImageDescriptor(VDTPluginImages.DESC_PROJECT_PROPERTIES);
        
        clearProjectPropertiesAction = new ClearLocalContextAction("Do you wish to delete values of projects parameters?");
        clearProjectPropertiesAction.setText("Clear Project Parameters");
        clearProjectPropertiesAction.setImageDescriptor(VDTPluginImages.DESC_PROJECT_PROPERTIES);

        
        showPropertiesAction = new Action() {
            public void run() {
558
            	if (openToolPropertiesDialog(selectedItem)==Window.OK){
559 560 561
            		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER)) {
            			System.out.println("openToolPropertiesDialog()-> OK");
            		}
Andrey Filippov's avatar
Andrey Filippov committed
562
                	fDesignFlowView.updateLaunchAction(true);
563
                };  
564 565 566 567 568 569 570
//              ConsoleView.getDefault().println("Action 1 executed", ConsoleView.MSG_INFORMATION);                
            }
        };
        showPropertiesAction.setText("Tool Parameters");
        showPropertiesAction.setToolTipText("Set tool parameters");
        showPropertiesAction.setImageDescriptor(VDTPluginImages.DESC_TOOL_PROPERTIES);

571
        clearToolPropertiesAction = new ClearAction("Do you wish to delete values of the tool parameters?") {
572 573 574 575 576 577 578 579 580 581 582 583
            public void clear() {
                OptionsCore.doClearContextOptions(selectedItem.getTool(), selectedResource.getProject());
            }
        };
        clearToolPropertiesAction.setText("Clear Tool Parameters");
        clearToolPropertiesAction.setImageDescriptor(VDTPluginImages.DESC_TOOL_PROPERTIES);
        selectDesignMenuAction = new Action() {
            public void run() {
                openDesignMenuSelectionDialog(selectedResource.getProject());
            }
        };
        selectDesignMenuAction.setText("Change Design Menu");
584
        selectDesignMenuAction.setImageDescriptor(VDTPluginImages.DESC_DESIGN_MENU);
585 586

        clearToolStatesAction = new ClearToolStates("Do you wish to reset all tool states (as if they never ran)?",toolSequence);
587
        clearToolStatesAction.setText("Clear tool states");
588 589 590 591 592 593
        clearToolStatesAction.setImageDescriptor(VDTPluginImages.DESC_ERASE);

        clearProjectStatesAction = new ClearProjectStates("Do you wish to reset the project state (persistent storage) as if no tools ran?",
        		toolSequence);
        clearProjectStatesAction.setText("Clear project state (debug feature)");
        clearProjectStatesAction.setImageDescriptor(VDTPluginImages.DESC_ERASE);
594 595

        clearStateFilesAction = new ClearStateFiles("Do you wisth to remove all state files (snapshots), but the current ones?",toolSequence);
596
        clearStateFilesAction.setText("Clear all but the latest snapshot files");
597
        clearStateFilesAction.setImageDescriptor(VDTPluginImages.DESC_ERASE);
598 599

        clearLogFilesAction = new ClearLogFiles("Do you wisth to remove all log files, but the most recent?",toolSequence);
600
        clearLogFilesAction.setText("Clear all but the latest log files");
601
        clearLogFilesAction.setImageDescriptor(VDTPluginImages.DESC_ERASE);
602
        
603
        showLaunchConfigAction = new Action() {
604 605
            public void run() {
                try {
606 607 608
                    int result = openToolLaunchDialog(
                    		selectedItem,
                    		fDesignFlowView);
609 610 611
            		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER)) {
            			System.out.println("Ran openToolLaunchDialog() ->"+result);
            		}
Andrey Filippov's avatar
Andrey Filippov committed
612
                	fDesignFlowView.updateLaunchAction(true);
613 614 615 616 617 618 619
                } catch (CoreException e) {
                    MessageUI.error(Txt.s("Action.OpenLaunchConfigDialog.Error", 
                                          new String[] {selectedItem.getLabel(), e.getMessage()}),
                                    e);
                }    
            }
        };
620
        showLaunchConfigAction.setText("Launch configuration");
621
        showLaunchConfigAction.setToolTipText("Open launch configuration dialog for this tool");
622
        showLaunchConfigAction.setImageDescriptor(VDTPluginImages.DESC_LAUNCH_CONFIG);
623 624 625
        launchActions=null;
        doubleClickListener=null;
        
626 627
    } // makeActions()

628 629 630 631 632 633
    private void removeDoubleClickAction() {
    	if (doubleClickListener!=null){
        	viewer.removeDoubleClickListener(doubleClickListener);
        	doubleClickListener=null;
    	}
    }
634
    private void hookDoubleClickAction() {
635 636 637 638 639 640 641
    	if ((launchActions==null) || (launchActions[0]==null)) return;
    	doubleClickListener=new IDoubleClickListener() {
    		public void doubleClick(DoubleClickEvent event) {
    			launchActions[0].run();  // Andrey: will go to launchAction[0].run
    		}
    	};
    	viewer.addDoubleClickListener(doubleClickListener);
642
    }
643
    
644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668
//    private void showMessage(String message) {
//        MessageDialog.openInformation( viewer.getControl().getShell()
//                                     , "Design Flow"
//                                     , message );
//    }

    /**
     * Passing the focus request to the viewer's control.
     */
    public void setFocus() {
        viewer.getControl().setFocus();
    }

//    private IWorkbenchPart getActivePart() {
//        IWorkbenchWindow window= getSite().getWorkbenchWindow();
//        IPartService service= window.getPartService();
//        return service.getActivePart();
//    }
    
    // ------------------------------------------------------------------------
    //                    Design Flow logic 
    // ------------------------------------------------------------------------

    /* Method declared on ISelectionListener */
    public void selectionChanged(IWorkbenchPart part, ISelection selection) {
669 670
		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
			System.out.println(">>>>> DesignFlowView.selectionChanged(, new selection)="+selection+" selectedResource="+selectedResource);
671
        IResource oldSelection = selectedResource; 
672 673 674 675 676 677 678 679 680 681 682
     // Save old project if it changed, before doin anything else
        IProject oldProject= (selectedResource ==null)? null : selectedResource.getProject();
        IResource newSelectedResource=SelectedResourceManager.getDefault().getSelectedResource(part, selection);
        IProject newProject= (newSelectedResource ==null)? null : newSelectedResource.getProject();
//        	if (HDLFile.getProject().getFullPath().toPortableString().equals(project.getFullPath().toPortableString())){
        
        if ((oldProject != null) && 
        		((newProject == null) ||
        		!oldProject.getFullPath().toPortableString().equals(newProject.getFullPath().toPortableString()))){
		    saveState(oldProject);
        }
683
        selectedResource = SelectedResourceManager.getDefault().getSelectedResource(part, selection);
684 685 686
//        IProject newProject = selectedResource == null 
//                            ? null
//                            : selectedResource.getProject();
687 688 689 690
        
        if ( (oldSelection == null) || 
             (newProject != oldSelection.getProject())
           ) {
691
            doLoadDesignMenu(newProject);
692 693 694
        }
        updateLaunchAction();
    } // selectionChanged()
695 696 697
    // Made it public to call from ContexOptionsDialog.okPressed() as launch actions might change
//    private void updateLaunchAction() {
    public void updateLaunchAction() {
Andrey Filippov's avatar
Andrey Filippov committed
698 699 700 701 702 703 704
    	updateLaunchAction(false);
    }

    public void updateLaunchAction(boolean updateDirty) {
    	if (updateDirty){
    		toolSequence.setToolsDirtyFlag(false); // if true - recalculates parameters
    	}
705

706 707
//    	System.out.println("DesignFlowView.updateLaunchAction()");

708 709 710 711 712 713
        IProject project = selectedResource == null 
                         ? null
                         : selectedResource.getProject();
        showProjectPropertiesToolbarAction.setProject(project);
        clearProjectPropertiesAction.setProject(project);

714 715
     // Selected item should be not null, but resource - may be        
     // RunFor[] getMenuActions()
716
        RunFor [] runFor=null;
717
        Tool tool=null;
718
        String ignoreFilter=null;
719
        if (selectedItem != null){
720
        	tool= selectedItem.getTool();
721
        	if (tool!=null){
722
        		runFor=tool.getMenuActions(project);
723
        		ignoreFilter=tool.getIgnoreFilter(); // should be after getMenuActions(project) that recalculates parameters
724
        		tool.initIcons(false); // if not done before - add icons list for actions
725 726 727 728 729 730 731 732 733 734 735
        		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER)) {
        			System.out.println("Got Runfor["+((runFor!=null)?runFor.length:"null")+"]");
        			if (runFor!=null){
        				for (int i=0;i<runFor.length;i++){
        					System.out.println(
        							"    label='"+runFor[i].getLabel()+
        							"', resource='"+runFor[i].getResource()+
        							"', checkExtension='"+runFor[i].getCheckExtension()+
        							"', checkExistence='"+runFor[i].getCheckExistence()+
        							"'");
        				}
736 737 738 739
        			}
        		}
        	}
        }
740
        final Tool fTool=tool;
741 742
        boolean enabled = (selectedItem != null) // At startup null (twice went through this); Right Click - "Icarus Ver..."
                       && (selectedResource != null) // at startup x353_1.tf;  Right Click - "L/x353/x353_1.tf
743
                       && (selectedItem.isEnabled(selectedResource));
744 745 746 747 748
        
 // Deal with new menus
//        removeLaunchActions(); 
        removeDoubleClickAction();
        launchActions=null;
749 750
        playbackLogLatestAction=null;
        playbackLogSelectAction=null;
751 752 753 754
        pinAction=null;
        restoreAction=null;
        restoreSelectAction=null;

755 756 757 758 759
        if ((runFor!=null) && (project!=null)){
        	launchActions=new Action [runFor.length];
        	for (int i=0;i<runFor.length;i++){
//                String name=runFor[i].getResource();
                String name=SelectedResourceManager.getDefault().tryRelativePath(runFor[i].getResource());
760 761
//                String shortName=name;
                String shortName=runFor[i].getResource(); // as entered
762 763 764 765
                String fullPath=name;
                enabled=(selectedItem != null);
                if (enabled && runFor[i].getCheckExistence()){
                	IPath path = new Path(name);
766 767 768 769 770 771 772 773 774
                	IFile file = null;
                	if (path!=null) {
                		try {
                			file = project.getFile(path);
                		} catch (IllegalArgumentException e) {

                		}
                	}
                	
775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798
                	if (file==null){
//                		System.out.println(name+" does not exist");
                		enabled=false;
                	} else {
                		shortName=file.getName();
//                		fullPath=file.getFullPath().toString(); // What is different?
                		fullPath=file.getLocation().toOSString(); // that matches generators
                		
                	}
                }
                if (enabled && runFor[i].getCheckExtension()){
                	enabled= selectedItem.isEnabled(name);
                	if (enabled && !runFor[i].getCheckExistence()) { // try to get resource and full path name, but no error if it fails
                    	IPath path = new Path(name);
                    	IFile file = (path==null)?null:project.getFile(path);
                    	if (file!=null){
                    		shortName=file.getName();
//                    		fullPath=file.getFullPath().toString(); // What is different?
                    		fullPath=file.getLocation().toOSString(); // that matches generators
                    	}
                	}
                }
        		final int finalI=i;
        		final String fFullPath=fullPath;
799
                final String fIgnoreFilter=ignoreFilter;
800
//                final DesignFlowView fDesignFlowView=this;
801

802 803 804
                launchActions[i] = new Action() {
                    public void run() {
                        try {
805
                            launchTool(
806
                            		fTool, // tool, will get 
807
                            		TOOL_MODE.RUN,
808 809 810
                            		finalI,
                            		fFullPath,
                            		fIgnoreFilter);
811 812 813 814 815 816 817 818
                        } catch (Exception e) {
                            MessageUI.error( Txt.s("Action.ToolLaunch.Error", 
                                                   new String[] {selectedItem.getLabel(), e.getMessage()})
                                            , e);
                        }    
                    }
                };
                launchActions[i].setToolTipText(i+": "+runFor[i].getLabel()+" "+shortName);
819 820 821 822 823
                if (shortName.indexOf("@")>=0){
                    launchActions[i].setText(runFor[i].getLabel()+" "+shortName+"@");
                } else {
                    launchActions[i].setText(runFor[i].getLabel()+" "+shortName);
                }
824
                launchActions[i].setEnabled(enabled);
825 826 827 828
        		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER)) {
        			System.out.println("shortName="+shortName);
        			System.out.println("launchActions[i].getText()="+launchActions[i].getText());
        		}
829
                String actionIconKey=tool.getImageKey(i);
830
                if ((actionIconKey!=null) && (VDTPluginImages.getImageDescriptor(actionIconKey)!=null)) {
831
                	launchActions[i].setImageDescriptor(VDTPluginImages.getImageDescriptor(actionIconKey));
832 833
//                	System.out.println(i+":"+actionIconKey+" - "+ VDTPluginImages.getImageDescriptor(actionIconKey));
                }else
834
                	launchActions[i].setImageDescriptor(VDTPluginImages.DESC_RUN_TOOL);
835 836
                
                if (i==0) { // set log play-back (always for default tool only)
837 838 839 840 841 842 843 844 845
// Add pinned action;                	
                	pinAction=new Action("Toggle tool dependency", Action.AS_CHECK_BOX){
                		public void run(){
                			fTool.setPinned(isChecked());
                		}
                	};
                	pinAction.setText("Pin "+tool.getName());
                	pinAction.setToolTipText("Do not automatically re-run "+tool.getName()+" when its dependency changes");
                	pinAction.setEnabled((tool.getState()==TOOL_STATE.SUCCESS) || (tool.isPinned()));
846
                	pinAction.setChecked(tool.isPinned());
847 848 849 850 851
                	pinAction.setImageDescriptor(VDTPluginImages.DESC_TOOLS_PIN);
                	if (tool.getRestore()!=null){
                		restoreAction=new Action(){
                    		public void run(){
                    			String stateFileName=toolSequence.getSelectedStateFile(fTool, false);
852 853 854 855
                    			if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) { 
                    				System.out.println("*** Will restore latest state of "+fTool.getName());
                    				System.out.println("***Selected restore file: "+stateFileName);
                    			}
856 857 858 859 860 861
                    			Tool restoreTool=fTool.getRestore();
                    			if ((stateFileName!=null) && (restoreTool!=null)){
                    				restoreTool.setResultFile(stateFileName);
                                    try {
                                        launchTool(
                                        		restoreTool,
862
                                        		TOOL_MODE.RESTORE,
863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883
                                        		0,
                                        		fFullPath,
                                        		fIgnoreFilter);
                                    } catch (Exception e) {
                                    	MessageUI.error( Txt.s("Action.ToolLaunch.Error", 
                                    			new String[] {fTool.getName()+" -> "+
                                    					restoreTool.getName() , e.getMessage()}), e);
                                    }    
                    				
                    			}
                    			
                    		}
                    	};
                    	restoreAction.setText("Restote latest "+tool.getName());
                    	restoreAction.setToolTipText("Restore state of the latest successful run of "+tool.getName());
                    	restoreAction.setEnabled(tool.getRestore()!=null); // just to decide should it be removed or disabled
                    	restoreAction.setImageDescriptor(VDTPluginImages.DESC_TOOLS_RESTORE);

                    	restoreSelectAction=new Action(){
                    		public void run(){
                    			System.out.println("*** Will restore selected state of "+fTool.getName());
Andrey Filippov's avatar
Andrey Filippov committed
884
                    			String stateFileName=toolSequence.getSelectedStateFile(fTool, true);
885 886 887 888 889 890 891
                    			System.out.println("***Selected restore file: "+stateFileName);
                    			Tool restoreTool=fTool.getRestore();
                    			if ((stateFileName!=null) && (restoreTool!=null)){
                    				restoreTool.setResultFile(stateFileName);
                                    try {
                                        launchTool(
                                        		restoreTool,
892
                                        		TOOL_MODE.RESTORE,
893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908
                                        		0,
                                        		fFullPath,
                                        		fIgnoreFilter);
                                    } catch (Exception e) {
                                    	MessageUI.error( Txt.s("Action.ToolLaunch.Error", 
                                    			new String[] {fTool.getName()+" -> "+
                                    					restoreTool.getName() , e.getMessage()}), e);
                                    }    
                    			}
                    		}
                    	};
                    	restoreSelectAction.setText("Restote selected "+tool.getName());
                    	restoreSelectAction.setToolTipText("Restore state of the selected successful run of "+tool.getName());
                    	restoreSelectAction.setEnabled(tool.getRestore()!=null); // just to decide should it be removed or disabled
                    	restoreSelectAction.setImageDescriptor(VDTPluginImages.DESC_TOOLS_RESTORE_SELECT);
                	}
909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947
                	boolean logEnabled=(tool.getLogDir()!=null);
// see if tool has log-dir                	
                	playbackLogLatestAction=new Action() {
                        public void run() {
                            try {
                            	playLogs(
                                		false,
                                		fFullPath,
                                		fIgnoreFilter);
                            } catch (Exception e) {
                                MessageUI.error( Txt.s("Action.ToolLaunch.Error", 
                                                       new String[] {selectedItem.getLabel(), e.getMessage()})
                                                , e);
                            }    
                        }
                    };
                    playbackLogSelectAction=new Action() {
                        public void run() {
                            try {
                            	playLogs(
                                		true,
                                		fFullPath,
                                		fIgnoreFilter);
                            } catch (Exception e) {
                                MessageUI.error( Txt.s("Action.ToolLaunch.Error", 
                                                       new String[] {selectedItem.getLabel(), e.getMessage()})
                                                , e);
                            }    
                        }
                    };
                    playbackLogLatestAction.setText("Playback latest log for "+tool.getName());
                    playbackLogSelectAction.setText("Select/playback log for "+tool.getName());
                    playbackLogLatestAction.setToolTipText("Playback latest log for "+runFor[i].getLabel()+" "+shortName);
                    playbackLogSelectAction.setToolTipText("Select and playback log for "+runFor[i].getLabel()+" "+shortName);
                    playbackLogLatestAction.setEnabled(logEnabled);
                    playbackLogSelectAction.setEnabled(logEnabled);
                    playbackLogLatestAction.setImageDescriptor(VDTPluginImages.DESC_PLAY_BACK);
                    playbackLogSelectAction.setImageDescriptor(VDTPluginImages.DESC_PLAY_BACK_SELECT);
                }
948 949 950 951 952 953
        	}
            IToolBarManager toolbarManager= getViewSite().getActionBars().getToolBarManager();
            toolbarManager.removeAll();
            fillLocalToolBar(toolbarManager);
        	hookDoubleClickAction();
        }
954

955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986
        enabled = (selectedItem != null)
               && (selectedResource != null)
               && (selectedItem.getPackageContext() != null);
        showPackagePropertiesAction.setEnabled(enabled);
        clearPackagePropertiesAction.setEnabled(enabled);
        if (enabled){
            String projectName = project.getName(); 
            showPackagePropertiesAction.setText(Txt.s("Action.PackageProperties.Caption", new String[]{selectedItem.getLabel()}));
            showPackagePropertiesAction.setToolTipText(Txt.s("Action.PackageProperties.ToolTip", new String[]{selectedItem.getLabel(), projectName}));
        } else {
            showPackagePropertiesAction.setText(Txt.s("Action.PackageProperties.Caption.Default"));
            showPackagePropertiesAction.setToolTipText(Txt.s("Action.PackageProperties.ToolTip.Default"));
        }
        
        enabled = (selectedItem != null)
               && (selectedResource != null)
               && (selectedItem.getProjectContext() != null);
        showProjectAction.setEnabled(enabled);
        clearProjectPropertiesAction.setEnabled(enabled);
        if (enabled){
            String projectName = project.getName(); 
            showProjectAction.setText(Txt.s("Action.ProjectProperties.Caption", new String[]{selectedItem.getLabel()}));
            showProjectAction.setToolTipText(Txt.s("Action.ProjectProperties.ToolTip", new String[]{selectedItem.getLabel(), projectName}));
        } else {
            showProjectAction.setText(Txt.s("Action.ProjectProperties.Caption.Default"));
            showProjectAction.setToolTipText(Txt.s("Action.ProjectProperties.ToolTip.Default"));
        }
        
        enabled = (selectedItem != null)
               && (selectedItem.getTool() != null);
        showPropertiesAction.setEnabled(enabled);
        clearToolPropertiesAction.setEnabled(enabled);
987
        
988 989
        toggleSaveTools.setEnabled(toolSequence.isSaveEnabled());
        
990
        ((ViewLabelProvider) viewer.getLabelProvider()).fireChanged();
991 992
    } // updateLaunchAction()

993
    private void launchTool(
994
    		Tool tool,
995
    		TOOL_MODE mode,
996 997 998
    		int choice,
    		String fullPath,
    		String ignoreFilter) throws CoreException {
999
    	if (tool != null) {
Andrey Filippov's avatar
Andrey Filippov committed
1000
    		toolSequence.launchToolSequence(tool,mode, choice, fullPath, ignoreFilter);
1001 1002 1003 1004 1005 1006
    	} else if (selectedItem.hasChildren()) {
    		if (viewer.getExpandedState(selectedItem))
    			viewer.collapseToLevel(selectedItem, AbstractTreeViewer.ALL_LEVELS);
    		else    
    			viewer.expandToLevel(selectedItem, 1);
    	}
1007 1008
    } // launchTool()
    
1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019
    private void playLogs(
    		boolean select, // select log file
    		String fullPath,
    		String ignoreFilter) throws CoreException {
        Tool tool = selectedItem.getTool();
        if (tool != null) {
        	String logBuildStamp=select?selectBuildStamp(tool):""; // "" - latest (link)
        	if (logBuildStamp==null) return; // cancelled selection
    		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER)) {
    			System.out.println("logBuildStamp="+logBuildStamp);
    		}
Andrey Filippov's avatar
Andrey Filippov committed
1020 1021 1022 1023
        	toolSequence.playLogs(
        			tool,
            		fullPath,
            		logBuildStamp);
1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060
        } else if (selectedItem.hasChildren()) {
            if (viewer.getExpandedState(selectedItem))
                viewer.collapseToLevel(selectedItem, AbstractTreeViewer.ALL_LEVELS);
            else    
                viewer.expandToLevel(selectedItem, 1);
        }
    } // launchTool()
    
    private String selectBuildStamp(Tool tool){
//    	System.out.println("tool.getLogDir()="+tool.getLogDir());
//    	System.out.println("ToolLogFile.getDir(tool.getLogDir()).getLocation()="+ToolLogFile.getDir(tool.getLogDir()).getLocation());
    	FilteredFileSelector selector= new FilteredFileSelector(
    			ToolLogFile.getDir(tool.getLogDir()).getLocation().toFile() , //File dir,
    			"Select log file", //String title,
    			 null, // Component parent, or convert from SHell VerilogPlugin.getActiveWorkbenchShell()
    			"Select", //String approveText,
    			"Select timestamp by selecting available log file", //String approveToolTip,
    			ToolLogFile.getBaseRegex(tool.getName()), // String filterRegex,
    			"Matchig log files for "+tool.getName(), //String filterDescription,
    			false //boolean allowDirs
    			);
    	File result=selector.openDialog();
    	if (result == null) {
    		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
    			System.out.println("Selection canceled");
    		return null;
    	}
//    	System.out.println("Got file "+result.toString());
//    	System.out.println("Timestamp="+ToolLogFile.getTimeStamp(
//    			tool.getName(),
//    			result.getName()));
    	return ToolLogFile.getTimeStamp(
    			tool.getName(),
    			result.getName());
    }
    
    
1061
    private int openInstallationPropertiesDialog() {
1062 1063 1064 1065 1066
        Shell shell = VerilogPlugin.getActiveWorkbenchShell();
        SetupOptionsDialog dialog = new SetupOptionsDialog(shell);
//        ContextOptionsDialog dialog = new ContextOptionsDialog(shell, ToolsCore.getContextManager().getInstallationContext());
        dialog.setTitle("Instalation Parameters");
        dialog.create();
1067 1068
        return dialog.open();
        
1069 1070 1071
    } // openInstallationPropertiesDialog()

    
1072
    private int openToolPropertiesDialog(DesignMenuModel.Item item) {
1073
        Shell shell = VerilogPlugin.getActiveWorkbenchShell();
1074 1075
        Context context = item.getTool();
        context.setTreeReparse(true); 
1076 1077 1078 1079 1080
        ContextOptionsDialog dialog = new ContextOptionsDialog( shell
                                                              , context 
                                                              , selectedResource.getProject() );
        dialog.setTitle("Tool Parameters");
        dialog.create();
1081
        return dialog.open();
1082 1083
    } // openToolPropertiesDialog()

1084
    private int openDesignMenuSelectionDialog(IProject project) {
1085 1086 1087 1088
        Shell shell = VerilogPlugin.getActiveWorkbenchShell();
        DesignMenuSelectionDialog dialog = new DesignMenuSelectionDialog( shell
                                                                        , desigMenuName.getValue() ); 
        dialog.create();
1089 1090
        int result=dialog.open();
        if (result == Window.OK) {
1091
 //       	System.out.println("openDesignMenuSelectionDialog()-> OK");
1092 1093 1094
            DesignMenu newDesignMenu = dialog.getSelectedDesignMenu();
            String newDesignMenuName = newDesignMenu == null ? null
                                                             : newDesignMenu.getName();
1095
            desigMenuName.setValue(newDesignMenuName); // ??? Andrey
1096 1097 1098
            OptionsCore.doStoreOption(desigMenuName, project);
            doLoadDesignMenu(newDesignMenuName);
        }
1099
        return result;
1100 1101
    }

1102

1103 1104 1105 1106
    private int openToolLaunchDialog(
    		DesignMenuModel.Item item,
    		DesignFlowView designFlowView
    		) throws CoreException {
1107 1108
    	System.out.println("openToolLaunchDialog()");

1109
        Shell shell = VerilogPlugin.getActiveWorkbenchShell();
1110 1111 1112 1113 1114
        ILaunchConfiguration launchConfig = LaunchCore.createLaunchConfiguration(
        		item.getTool(),
        		selectedResource.getProject(),
        		null,
        		null);
1115
        IStructuredSelection selection = new StructuredSelection(launchConfig);
1116
        return DebugUITools.openLaunchConfigurationDialogOnGroup( shell
1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132
                                                         , selection
                                                         , VDT.ID_VERILOG_TOOLS_LAUNCH_GROUP );                        
    } // openToolLaunchDialog()
    
    
    // ------------------------------------------------------------------------
    //                      Tree of the tools 
    // ------------------------------------------------------------------------

    class ToolSelectionChangedListener implements ISelectionChangedListener {
        
        public void selectionChanged(SelectionChangedEvent event) {
            ISelection selection = event.getSelection();
            Object obj = ((IStructuredSelection)selection).getFirstElement();
            selectedItem = (DesignMenuModel.Item) obj;
            if (selectedResource == null)
Andrey Filippov's avatar
Andrey Filippov committed
1133 1134 1135
//                selectedResource = SelectedResourceManager.getDefault().getViewSelectedResource(IPageLayout.ID_RES_NAV);
            	selectedResource = SelectedResourceManager.getDefault().getViewSelectedResource(IPageLayout.ID_PROJECT_EXPLORER);
            //
1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208
            updateLaunchAction();
        }    
    } // class ToolSelectionChangedListener
    
    
    // ------------------------------------------------------------------------
    /*
     * The content provider class is responsible for providing objects to 
     * the view. It can wrap existing objects in adapters or simply return
     * objects as-is. These objects may be sensitive to the current input 
     * of the view, or ignore it and always show the same content 
     * (like Task List, for example).
     */
    class ViewContentProvider implements IStructuredContentProvider 
                                       , ITreeContentProvider {
        private DesignMenuModel invisibleRoot;
        private DesignMenu designMenu;

        public void inputChanged(Viewer v, Object oldInput, Object newInput) {
            invisibleRoot = null;
            if ((newInput != null) && (newInput instanceof DesignMenu))
                designMenu = (DesignMenu) newInput;
            else 
                designMenu = null;
            v.refresh();
        }
        
        public void dispose() { }
  
        public Object[] getElements(Object parent) {
//            if (parent.equals(getViewSite())) {
            if (parent == designMenu) {
                if (invisibleRoot == null) 
                    initialize();
                return getChildren(invisibleRoot);
            }
            return getChildren(parent);
        }
        public Object getParent(Object child) {
            if (child instanceof DesignMenuModel.Item) {
                return ((DesignMenuModel.Item)child).getParent();
            }
            return null;
        }
        public Object [] getChildren(Object parent) {
            if (parent == null) {
                return new Object[0];
            } else if (parent == invisibleRoot) {
                return invisibleRoot.getItems();
            } else if (parent instanceof DesignMenuModel.Item) {
                return ((DesignMenuModel.Item)parent).getChildren();
            }
            return new Object[0];
        }
        public boolean hasChildren(Object parent) {
            if (parent == null) {
                return false;
            } else if (parent == invisibleRoot) {
                return invisibleRoot.getItems().length > 0;
            } else if (parent instanceof DesignMenuModel.Item) {
                return ((DesignMenuModel.Item)parent).hasChildren();
            }    
            return false;
        }

        private void initialize() {
            if (designMenu != null)
                invisibleRoot = new DesignMenuModel(designMenu);
        }
    } // class ViewContentProvider
    
    //-------------------------------------------------------------------------
    class ViewLabelProvider extends LabelProvider {
1209 1210 1211 1212
    	
    	public void fireChanged(){
    		fireLabelProviderChanged(new LabelProviderChangedEvent(this));
    	}
1213 1214 1215 1216

        public String getText(Object obj) {
            return obj.toString();
        }
1217
        
1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241

        public Image getImage(Object obj) {
            String imageKey = ((DesignMenuModel.Item)obj).getImageKey();
            if (imageKey != null) {
                return VDTPluginImages.getImage(imageKey);
            } else {
                imageKey = ISharedImages.IMG_OBJ_ELEMENT;
                if (((DesignMenuModel.Item)obj).hasChildren())
                   imageKey = ISharedImages.IMG_OBJ_FOLDER;
                return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey);
            }    
        }
    } // class ViewLabelProvider

    class NameSorter extends ViewerSorter {
    }

    /**
     * Restores the state of the receiver to the state described in the specified memento.
     *
     * @param memento the memento
     * @since 2.0
     */
    protected void restoreState(IMemento memento) {
1242
        SelectedResourceManager.getDefault().setToolSequence(toolSequence); // to enable access through static method
1243 1244
    	Boolean linkedTools= memento.getBoolean(TAG_LINKED_TOOLS);
    	ToolsCore.restoreToolsState(memento);
1245
        String location = memento.getString(TAG_SELECTED_RESOURCE);
1246 1247
        if (location == null) {
        	System.out.println("No project selected");
1248
            return;
1249
        }
1250
        selectedResource = ResourcesPlugin.getWorkspace().getRoot().findMember(Path.fromPortableString(location));
1251
        String HDLLocation=memento.getString(TAG_SELECTED_HDL_FILE);
1252 1253
        if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
        	System.out.println("restoreState(memento): selectedResource="+selectedResource+ " HDLLocation="+HDLLocation);
1254 1255
        if (HDLLocation!=null) {
        	IResource HDLFile=ResourcesPlugin.getWorkspace().getRoot().findMember(Path.fromPortableString(HDLLocation));
1256 1257 1258 1259 1260
        	if (HDLFile!=null){
        		SelectedResourceManager.getDefault().setChosenVerilogFile(HDLFile);
        		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
        			System.out.println("Setting HDL file to "+HDLFile.toString());
        	}
1261 1262 1263 1264
        }
        String HDLFilter=memento.getString(TAG_SELECTED_HDL_FILTER); //SelectedResourceManager.getDefault().getFilter();
        if (HDLFilter!=null){
        	SelectedResourceManager.getDefault().setFilter(HDLFilter);
1265 1266
        	if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
        		System.out.println("Setting HDL filter to "+HDLFilter);
1267 1268 1269 1270 1271 1272
        }
    	if (linkedTools==null) linkedTools=true;
    	SelectedResourceManager.getDefault().setToolsLinked(linkedTools);
        toggleLinkedTools.setChecked(!SelectedResourceManager.getDefault().isToolsLinked());
        // Initialize VEditor database build
   	    IResource HDLFile=SelectedResourceManager.getDefault().getChosenVerilogFile();
1273 1274 1275 1276 1277 1278 1279 1280 1281
   	    	// restore properties from the project, overwrite global ones
   	    IProject project;
   	    if (selectedResource == null) {
   	    	project = SelectedResourceManager.getDefault().getSelectedProject();
   	    } else {
   	    	project = HDLFile.getProject();
   	    }
//   	    restoreCurrentState(selectedResource.getProject()); // null OK
   	    restoreCurrentState(project); // null OK
1282
   	    
1283
   	    if ((HDLFile!=null) && HDLFile.exists()){
1284 1285 1286
   	    	toolSequence.setUnfinishedBoot(memento,true);
        	if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
        		System.out.println("Initiating DB rebuild HDLFile="+HDLFile);
Andrey Filippov's avatar
Andrey Filippov committed
1287 1288 1289 1290
   	    	VerilogUtils.getTopModuleNames((IFile) HDLFile);
// 	    	java.lang.ClassCastException: org.eclipse.core.internal.resources.Project cannot be cast to org.eclipse.core.resources.IFile
//   	 	at com.elphel.vdt.ui.views.DesignFlowView.restoreState(DesignFlowView.java:1270)
//  	 	at com.elphel.vdt.ui.views.DesignFlowView.createPartControl(DesignFlowView.java:237)   	    	
1291
   	    } else {
1292 1293 1294
        	if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
        		System.out.println("Skipping DB rebuild HDLFile=NULL");
   	    	toolSequence.setUnfinishedBoot(null,false);
1295 1296 1297 1298
   	    	finalizeAfterVEditorDB(memento);
   	    }
    }
    public void finalizeAfterVEditorDB(IMemento memento){
1299 1300 1301 1302 1303 1304 1305 1306 1307
    	if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
    		System.out.println("finalizeAfterVEditorDB(), memento is "+((memento==null)?"NULL":"not NULL"));
    	if (memento!=null) {
    		toolSequence.restoreCurrentStates(memento); // restore states and recalc "dirty" flags - should be after tools themselves
    	}
        if (selectedResource!=null) toolSequence.restoreCurrentStates(selectedResource.getProject()); // restore states and recalc "dirty" flags - should be after tools themselves
        IResource HDLFile=SelectedResourceManager.getDefault().getChosenVerilogFile();
        if ((HDLFile!=null) && HDLFile.exists()){
        	toolSequence.setToolsDirtyFlag(true); // recalculate each successful tool's parameters - does it trigger Database rebuild?
1308 1309 1310
        }
        doLoadDesignMenu();
        updateLaunchAction(true); // true?
1311 1312
    }
    
1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370
    private void restoreCurrentState(IProject project){
    	if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
    		System.out.println("^^^^ restoreCurrentState("+project+")");
    	if ((project==null) || !project.exists()){
    		System.out.println("Can not restore persistent properties from non-existent project "+project);
    		return;
    	}
    	if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER)){
    		System.out.println("::::: Restoring persistent properties from the project "+project);
    	}

    	ToolsCore.restoreToolsState(project);
    	Map<QualifiedName,String> pp;
    	try {
    		pp=project.getPersistentProperties();
    	} catch (CoreException e){
    		System.out.println(project+": Failed getPersistentProperties(), e="+e);
    		return;
    	}
    	String location=	pp.get(new QualifiedName(VDT.ID_VDT, TAG_SELECTED_RESOURCE));
    	if (location!=null) {
    		IResource resource=ResourcesPlugin.getWorkspace().getRoot().findMember(Path.fromPortableString(location));
        	if (resource.getProject().getFullPath().toPortableString().equals(project.getFullPath().toPortableString())){
        		selectedResource = resource;
        	} else {
        		System.out.println("**** Wrong selected resource "+location+" for project "+project.getFullPath().toPortableString());
        	}
    	}
    	String HDLLocation=	pp.get(new QualifiedName(VDT.ID_VDT, TAG_SELECTED_HDL_FILE));
    	if (HDLLocation!=null) {
            if (HDLLocation!=null) {
            	IResource HDLFile=ResourcesPlugin.getWorkspace().getRoot().findMember(Path.fromPortableString(HDLLocation));
            	if (HDLFile!=null){
            		if (HDLFile.getProject().getFullPath().toPortableString().equals(project.getFullPath().toPortableString())){
            			SelectedResourceManager.getDefault().setChosenVerilogFile(HDLFile);
            			if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
            				System.out.println("Setting HDL file to "+HDLFile.toString());
            		} else {
                		System.out.println("*** Wrong HDLFile "+HDLLocation+" for project "+project.getFullPath().toPortableString());
            		}
            	}
            }
    	}
        String HDLFilter= pp.get(new QualifiedName(VDT.ID_VDT, TAG_SELECTED_HDL_FILTER));
        if (HDLFilter!=null){
        	SelectedResourceManager.getDefault().setFilter(HDLFilter);
        	if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
        		System.out.println("Setting HDL filter to "+HDLFilter);
        }
    	
    	String LinkedToolsStr=pp.get(new QualifiedName(VDT.ID_VDT, TAG_LINKED_TOOLS));
    	if (LinkedToolsStr!=null)	try {
    		SelectedResourceManager.getDefault().setToolsLinked(Boolean.parseBoolean(LinkedToolsStr));
            toggleLinkedTools.setChecked(!SelectedResourceManager.getDefault().isToolsLinked());
    	} catch (Exception e){
    		System.out.println(project+"Failed .setToolsLinked("+LinkedToolsStr+"), e="+e);
    	}
    }
1371 1372 1373 1374
    
    
    
    
1375 1376 1377 1378 1379

    /** 
     * @see ViewPart#saveState
     */
    public void saveState(IMemento memento) {
1380 1381
    	if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
    		System.out.println("^^^^saveState()");
1382 1383 1384
        if (viewer == null) {
            if (this.memento != null) //Keep the old state;
                memento.putMemento(this.memento);
1385
//            return;
1386
        }
1387 1388 1389 1390 1391 1392 1393 1394
        IProject project = selectedResource == null 
                ? null
                : selectedResource.getProject();
        if (project==null) {
        	System.out.println("No project selected, nothing to save");
        	return;
        }

1395 1396 1397
        if (selectedResource != null) {
            String location = selectedResource.getFullPath().toPortableString();
            memento.putString(TAG_SELECTED_RESOURCE, location);
Andrey Filippov's avatar
Andrey Filippov committed
1398 1399
        	if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
        		System.out.println("saveState(memento): selectedResource="+selectedResource);
1400
        }
1401 1402 1403
        IResource HDLFile=SelectedResourceManager.getDefault().getChosenVerilogFile();
        if (HDLFile!=null){
        	memento.putString(TAG_SELECTED_HDL_FILE,HDLFile.getFullPath().toPortableString());
1404 1405
        	if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
        		System.out.println("memento.putString("+TAG_SELECTED_HDL_FILE+","+HDLFile.getFullPath().toPortableString()+")");
1406 1407 1408 1409
        }
        String HDLFilter=SelectedResourceManager.getDefault().getFilter();
        if (HDLFilter!=null){
        	memento.putString(TAG_SELECTED_HDL_FILTER,HDLFilter);
1410 1411
        	if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
        		System.out.println("memento.putString("+TAG_SELECTED_HDL_FILTER+","+HDLFilter+")");
1412
        }
1413 1414
        memento.putBoolean(TAG_LINKED_TOOLS, new Boolean(SelectedResourceManager.getDefault().isToolsLinked()));
        ToolsCore.saveToolsState(memento);
1415 1416 1417 1418 1419 1420 1421
        if (toolSequence!=null) {
        	toolSequence.saveCurrentStates(memento);
        }
// set project properties  
        
        if ((project!=null) && project.exists())
        	saveState(project); 
1422
    }
1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442
// this may need some synchronization as saveState(IMemento memento) is called by the timer (what if selectedResource changes while save is in progress?
    public void saveState(IProject project) {
    	if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
    		System.out.println("^^^^ SaveState("+project+")");
    	if ((project==null) || !project.exists()){
    		System.out.println("Can not save persistent properties to non-existent project "+project);
    		return;
    	}
    	QualifiedName qn;
        if (selectedResource != null) {
        	if (selectedResource.getProject().getFullPath().toPortableString().equals(project.getFullPath().toPortableString())){
        		String location = selectedResource.getFullPath().toPortableString();
        		qn= new QualifiedName(VDT.ID_VDT, TAG_SELECTED_RESOURCE);
        		try {project.setPersistentProperty(qn, location);}
        		catch (CoreException e)  {System.out.println(project+"Failed setPersistentProperty("+qn+", "+location+", e="+e);}
        	} else {
        		System.out.println("*** Wrong selected resource "+selectedResource+" for project "+project);
        		return;
        	}
        }
1443

1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457
        IResource HDLFile=SelectedResourceManager.getDefault().getChosenVerilogFile();
        if (HDLFile!=null){
        	if (HDLFile.getProject().getFullPath().toPortableString().equals(project.getFullPath().toPortableString())){
        		qn= new QualifiedName(VDT.ID_VDT, TAG_SELECTED_HDL_FILE);
        		try {project.setPersistentProperty(qn, HDLFile.getFullPath().toPortableString());}
        		catch (CoreException e)  {System.out.println(project+"Failed setPersistentProperty("+qn+", "+HDLFile.getFullPath().toPortableString()+", e="+e);}
        		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
        			System.out.println("project.setPersistentProperty("+qn.toString()+","+HDLFile.getFullPath().toPortableString()+")");
        	} else {
        		System.out.println("*** Wrong HDLFile "+HDLFile+" for project "+project);
        		return;
        	}
        }
        String HDLFilter=SelectedResourceManager.getDefault().getFilter();
1458 1459
        //OK with null - will just arase that property
//        if (HDLFilter!=null){
1460 1461 1462 1463 1464
        	qn= new QualifiedName(VDT.ID_VDT, TAG_SELECTED_HDL_FILTER);
        	try {project.setPersistentProperty(qn, HDLFilter);}
        	catch (CoreException e)  {System.out.println(project+"Failed setPersistentProperty("+qn+", "+HDLFilter+", e="+e);}
        	if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
        		System.out.println("project.setPersistentProperty("+qn.toString()+","+HDLFilter+")");
1465
//        }
1466 1467 1468 1469 1470 1471 1472 1473 1474
        qn= new QualifiedName(VDT.ID_VDT, TAG_LINKED_TOOLS);
        try {project.setPersistentProperty(qn, new Boolean(SelectedResourceManager.getDefault().isToolsLinked()).toString());}
        catch (CoreException e)  {System.out.println(project+"Failed setPersistentProperty("+qn+", "+
        		SelectedResourceManager.getDefault().isToolsLinked()+", e="+e);}
        ToolsCore.saveToolsState(project);
        if (toolSequence!=null) {
        	toolSequence.saveCurrentStates(project);
        }
    }
1475
} // class DesignFlowView