User a200fcbc5e
20-03-2012 13:06:48
Hi,
I have removed the "view-> open MarvinSpace" menu option by using a customization.xml file in a specified location (not in $USER_HOME/chemaxon/{MarvinSketch_version}/customization.xml)
This causes
1) the "view->configurations" menu option to be disabled permanently after hovering over it.
2) the "view->customize..." option has disappeared completely.
I want the user to still have access to these 2 menu options.
In the documentation ( http://www.chemaxon.com/marvin/help/developer/sketchman.html#parameters.menuconfig )
it states (in reference to the 'menuconfig' parameter) :
"Please note that if this parameter is used, the customizationEnabled parameter is automatically set to false."
which I assume is what is causing this behaviour. I'm trying to revert this 'customizationEnabled' parameter to 'true'. Printing out the value shows it is set to 'true', but behaviours 1) and 2) are still showing.
Is there any way to achieve what I want? Am I using the API correctly?
Source code and customization.xml file below - thanks:
package toy;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import chemaxon.marvin.beans.MSketchPane;
import chemaxon.marvin.beans.MarvinPane;
import chemaxon.marvin.common.UserSettings;
import chemaxon.marvin.sketch.SketchParameterConstants;
public class Customization
{
static MSketchPane sketchPane;
public static void main( String[] args )
{
SwingUtilities.invokeLater( new Runnable(){
public void run() {
displayMSketchPane();
}
});
}
private static void displayMSketchPane()
{
JFrame baseFrame = new JFrame();
baseFrame.setPreferredSize( new Dimension(400,400) );
baseFrame.add( getSketchPane() );
baseFrame.pack();
baseFrame.setVisible( true );
}
private static MarvinPane getSketchPane()
{
UserSettings userSettings=new UserSettings();
userSettings.setProperty( SketchParameterConstants.MENU_CUSTOMIZATION_FILE, "C:/Users/bconnor.WIN/workspace/ToyJChem_customGUI/src/toy/customization.xml");
userSettings.setProperty( SketchParameterConstants.CUSTOMIZATION_ENABLED, "true" );
sketchPane = new MSketchPane( userSettings );
//check the property values are set to expected values
System.out.println( "custEnabled=" + userSettings.getProperty( SketchParameterConstants.CUSTOMIZATION_ENABLED ) );
System.out.println( "custFile=" + userSettings.getProperty( SketchParameterConstants.MENU_CUSTOMIZATION_FILE) );
return sketchPane;
}
}