Commit 1849246a authored by Andrey Filippov's avatar Andrey Filippov

Made actions in context and toolbar menus updated after parameters were

updated in dialogs. Left some conditioned debug output behind.
parent bdbfb6b6
...@@ -30,11 +30,13 @@ import org.eclipse.swt.widgets.Shell; ...@@ -30,11 +30,13 @@ import org.eclipse.swt.widgets.Shell;
import com.elphel.vdt.Txt; import com.elphel.vdt.Txt;
//import com.elphel.vdt.VDTPlugin; //import com.elphel.vdt.VDTPlugin;
import com.elphel.vdt.veditor.VerilogPlugin; import com.elphel.vdt.veditor.VerilogPlugin;
import com.elphel.vdt.veditor.preference.PreferenceStrings;
import com.elphel.vdt.core.options.OptionsCore; import com.elphel.vdt.core.options.OptionsCore;
import com.elphel.vdt.core.tools.contexts.Context; import com.elphel.vdt.core.tools.contexts.Context;
import com.elphel.vdt.core.tools.contexts.PackageContext; import com.elphel.vdt.core.tools.contexts.PackageContext;
import com.elphel.vdt.core.tools.params.ToolException; import com.elphel.vdt.core.tools.params.ToolException;
import com.elphel.vdt.ui.MessageUI; import com.elphel.vdt.ui.MessageUI;
import com.elphel.vdt.ui.views.DesignFlowView;
public class ContextOptionsDialog extends Dialog { public class ContextOptionsDialog extends Dialog {
...@@ -44,7 +46,7 @@ public class ContextOptionsDialog extends Dialog { ...@@ -44,7 +46,7 @@ public class ContextOptionsDialog extends Dialog {
private IPreferenceStore store; private IPreferenceStore store;
private OptionsBlock optionsBlock; private OptionsBlock optionsBlock;
private String location; private String location;
// private DesignFlowView designFlowView; // Andrey
public ContextOptionsDialog(Shell parent, Context context, IProject project) { public ContextOptionsDialog(Shell parent, Context context, IProject project) {
this( parent this( parent
, context , context
...@@ -70,6 +72,7 @@ public class ContextOptionsDialog extends Dialog { ...@@ -70,6 +72,7 @@ public class ContextOptionsDialog extends Dialog {
this.store = store; this.store = store;
OptionsCore.doLoadContextOptions(context, store); OptionsCore.doLoadContextOptions(context, store);
setShellStyle(getShellStyle() | SWT.RESIZE); setShellStyle(getShellStyle() | SWT.RESIZE);
// this.designFlowView=null; // Andrey
} }
protected void okPressed() { protected void okPressed() {
...@@ -83,9 +86,16 @@ public class ContextOptionsDialog extends Dialog { ...@@ -83,9 +86,16 @@ public class ContextOptionsDialog extends Dialog {
, new String[] {context.getLabel(), e.getMessage()}) , new String[] {context.getLabel(), e.getMessage()})
, e ); , e );
} }
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
System.out.println("ContexOptionsDialog.okPressed()");
// Need to update Design menu as it uses calculated parameters
super.okPressed(); super.okPressed();
// if (this.designFlowView!=null) this.designFlowView.updateLaunchAction();
} }
// public void setDesignFlowView(DesignFlowView designFlowView){
// this.designFlowView=designFlowView;
// };
protected Control createDialogArea(Composite parent) { protected Control createDialogArea(Composite parent) {
GridLayout layout = new GridLayout(1, false); GridLayout layout = new GridLayout(1, false);
layout.marginHeight = 5; layout.marginHeight = 5;
......
...@@ -29,6 +29,7 @@ import org.eclipse.ui.IWorkbenchPreferencePage; ...@@ -29,6 +29,7 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
import com.elphel.vdt.Txt; import com.elphel.vdt.Txt;
//import com.elphel.vdt.VDTPlugin; //import com.elphel.vdt.VDTPlugin;
import com.elphel.vdt.veditor.VerilogPlugin; import com.elphel.vdt.veditor.VerilogPlugin;
import com.elphel.vdt.veditor.preference.PreferenceStrings;
import com.elphel.vdt.core.options.OptionsCore; import com.elphel.vdt.core.options.OptionsCore;
import com.elphel.vdt.core.tools.contexts.Context; import com.elphel.vdt.core.tools.contexts.Context;
import com.elphel.vdt.core.tools.params.ToolException; import com.elphel.vdt.core.tools.params.ToolException;
...@@ -85,6 +86,8 @@ public class ContextOptionsPage extends PreferencePage ...@@ -85,6 +86,8 @@ public class ContextOptionsPage extends PreferencePage
, new String[] {context.getLabel(), e.getMessage()}) , new String[] {context.getLabel(), e.getMessage()})
, e ); , e );
} }
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
System.out.println("ContexOptionsPage.performOK()");
return super.performOk(); return super.performOk();
} }
......
...@@ -33,6 +33,8 @@ import org.eclipse.swt.widgets.Label; ...@@ -33,6 +33,8 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.preferences.ScopedPreferenceStore; import org.eclipse.ui.preferences.ScopedPreferenceStore;
import com.elphel.vdt.VDT; import com.elphel.vdt.VDT;
import com.elphel.vdt.veditor.VerilogPlugin;
import com.elphel.vdt.veditor.preference.PreferenceStrings;
/** /**
* Abstract options configuration block providing a general implementation * Abstract options configuration block providing a general implementation
...@@ -114,6 +116,8 @@ public class OptionsBlock { ...@@ -114,6 +116,8 @@ public class OptionsBlock {
// Nothing do do, we don't need to bother the user // Nothing do do, we don't need to bother the user
} }
} }
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
System.out.println("OptionsBlock.performOK()");
return ok; return ok;
} // performOk() } // performOk()
......
...@@ -45,11 +45,22 @@ abstract public class ContextsAction extends Action ...@@ -45,11 +45,22 @@ abstract public class ContextsAction extends Action
protected String title; protected String title;
protected Context lastSelected; protected Context lastSelected;
protected DesignFlowView designFlowView; // Andrey
public ContextsAction(String title) { public ContextsAction(String title) {
this.title = title; this.title = title;
setMenuCreator(this); setMenuCreator(this);
setEnabled(false); setEnabled(false);
designFlowView=null;
}
public void setDesignFlowView(DesignFlowView designFlowView){
this.designFlowView=designFlowView;
}
public void updateActions(){
if (this.designFlowView!=null) this.designFlowView.updateLaunchAction();
} }
public void setContexts(List<Context> contexts) { public void setContexts(List<Context> contexts) {
......
...@@ -17,10 +17,15 @@ ...@@ -17,10 +17,15 @@
*******************************************************************************/ *******************************************************************************/
package com.elphel.vdt.ui.views; package com.elphel.vdt.ui.views;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
//import com.elphel.vdt.VDTPlugin; //import com.elphel.vdt.VDTPlugin;
import com.elphel.vdt.veditor.VerilogPlugin; import com.elphel.vdt.veditor.VerilogPlugin;
import com.elphel.vdt.veditor.preference.PreferenceStrings;
import com.elphel.vdt.core.tools.contexts.Context; import com.elphel.vdt.core.tools.contexts.Context;
import com.elphel.vdt.ui.options.ContextOptionsDialog; import com.elphel.vdt.ui.options.ContextOptionsDialog;
...@@ -32,26 +37,34 @@ import com.elphel.vdt.ui.options.ContextOptionsDialog; ...@@ -32,26 +37,34 @@ import com.elphel.vdt.ui.options.ContextOptionsDialog;
*/ */
public class GlobalContextsAction extends ContextsAction { public class GlobalContextsAction extends ContextsAction {
public GlobalContextsAction(String title) { public GlobalContextsAction(String title, DesignFlowView designFlowView) {
super(title); super(title);
super.setDesignFlowView(designFlowView);
} }
protected ShowContextAction createContextAction(Context context) { protected ShowContextAction createContextAction(Context context) {
return new ShowGlobalContextAction(context); return new ShowGlobalContextAction(context);
} }
public void run() { public void run() {
if (lastSelected != null) { if (lastSelected != null) {
openDialog(title, lastSelected); // openDialog(title, lastSelected);
if (openDialog(title, lastSelected)== Window.OK){
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER)) {
System.out.println("GlobalContextsAction.run()");
}
super.updateActions();
}
} }
} }
public static void openDialog(String title, Context context) { public static int openDialog(String title, Context context) {
Shell shell = VerilogPlugin.getActiveWorkbenchShell(); Shell shell = VerilogPlugin.getActiveWorkbenchShell();
ContextOptionsDialog dialog = new ContextOptionsDialog(shell, context); ContextOptionsDialog dialog = new ContextOptionsDialog(shell, context);
dialog.setTitle(title); dialog.setTitle(title);
dialog.create(); dialog.create();
dialog.open(); return dialog.open();
} // openDialog() } // openDialog()
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
......
...@@ -20,10 +20,12 @@ package com.elphel.vdt.ui.views; ...@@ -20,10 +20,12 @@ package com.elphel.vdt.ui.views;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.jface.window.Window;
import com.elphel.vdt.VDT; import com.elphel.vdt.VDT;
//import com.elphel.vdt.VDTPlugin; //import com.elphel.vdt.VDTPlugin;
import com.elphel.vdt.veditor.VerilogPlugin; import com.elphel.vdt.veditor.VerilogPlugin;
import com.elphel.vdt.veditor.preference.PreferenceStrings;
import com.elphel.vdt.core.tools.contexts.Context; import com.elphel.vdt.core.tools.contexts.Context;
import com.elphel.vdt.ui.options.ContextOptionsDialog; import com.elphel.vdt.ui.options.ContextOptionsDialog;
...@@ -36,9 +38,10 @@ import com.elphel.vdt.ui.options.ContextOptionsDialog; ...@@ -36,9 +38,10 @@ import com.elphel.vdt.ui.options.ContextOptionsDialog;
public class LocalContextsAction extends ContextsAction { public class LocalContextsAction extends ContextsAction {
private IProject project; private IProject project;
public LocalContextsAction(String title) { public LocalContextsAction(String title, DesignFlowView designFlowView) {
super(title); super(title);
setEnabled(false); setEnabled(false);
super.setDesignFlowView(designFlowView);
} }
public void setProject(IProject project) { public void setProject(IProject project) {
...@@ -58,16 +61,26 @@ public class LocalContextsAction extends ContextsAction { ...@@ -58,16 +61,26 @@ public class LocalContextsAction extends ContextsAction {
public void run() { public void run() {
if (lastSelected != null) { if (lastSelected != null) {
openDialog(title, lastSelected, project); if (openDialog(title, lastSelected, project)== Window.OK){
System.out.println("LocalContextsAction.run()");
super.updateActions();
}
} }
} }
public static void openDialog(String title, Context context, IProject project) { public static int openDialog(String title, Context context, IProject project) {
Shell shell = VerilogPlugin.getActiveWorkbenchShell(); Shell shell = VerilogPlugin.getActiveWorkbenchShell();
ContextOptionsDialog dialog = new ContextOptionsDialog(shell, context, project); ContextOptionsDialog dialog = new ContextOptionsDialog(shell, context, project);
dialog.setTitle(title); dialog.setTitle(title);
dialog.create(); dialog.create();
dialog.open(); int result=dialog.open();
// if (result == Window.OK){
// updateActions();
// }
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER)) {
System.out.println("LocalContextAction()->"+result);
}
return result;
} // openDialog() } // openDialog()
......
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
<action-menu> <action-menu>
<action label="Launch Vivado" resource="" icon="xilinx.png" /> <action label="Launch Vivado" resource="" icon="xilinx.png" />
<action label="Generate public key" resource="" icon="gnu.png" /> <action label="Generate public key" resource="" icon="gnu.png" />
<action label="Setup connection to" resource="%RemoteUser@%RemoteHost" icon="gnu.png" /> <action label="Setup connection to" resource="%RemoteUser@%RemoteHost"
check-extension="false" check-existence="false" icon="gnu.png" />
</action-menu> </action-menu>
<!-- <!--
<parameter id="command" label="Command" default="" <parameter id="command" label="Command" default=""
...@@ -61,8 +62,8 @@ ...@@ -61,8 +62,8 @@
<if actionIndex="2"> <if actionIndex="2">
<line name="SSHCopyID"> <line name="SSHCopyID">
"%ShellSwitches" "%ShellSwitches"
"echo \"**********************************************\";" "echo \"*********************************************\";"
"echo \"** **\";" "echo \"** **\";"
"echo \"** This command requires you to be able **\";" "echo \"** This command requires you to be able **\";"
"echo \"** to login to the remote system and enter **\";" "echo \"** to login to the remote system and enter **\";"
"echo \"** a password once to post your public key **\";" "echo \"** a password once to post your public key **\";"
...@@ -86,7 +87,7 @@ ...@@ -86,7 +87,7 @@
"echo \"** terminal - just switch to it and **\";" "echo \"** terminal - just switch to it and **\";"
"echo \"** complete the setup. **\";" "echo \"** complete the setup. **\";"
"echo \"** **\";" "echo \"** **\";"
"echo \"**********************************************\";" "echo \"*********************************************\";"
"ssh-copy-id %RemoteUser@%RemoteHost;" "ssh-copy-id %RemoteUser@%RemoteHost;"
</line> </line>
</if> </if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment