Changeset 8083
- Timestamp:
- 07/26/08 10:38:51 (5 years ago)
- Location:
- ossiedev/branches/jsnyder/ComponentProject/src/edu/vt/ossie
- Files:
-
- 3 modified
-
OWDPlugin.java (modified) (6 diffs)
-
PreferenceInitializer.java (modified) (1 diff)
-
PreferencePage.java (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ossiedev/branches/jsnyder/ComponentProject/src/edu/vt/ossie/OWDPlugin.java
r7811 r8083 69 69 public static final String PREF_WAVE_AUTO_INSTALL = 70 70 PLUGIN_ID + ".preferences.component.install.auto"; 71 public static final String PREF_USE_EXTERNAL_TOOLS_DIR = 72 PLUGIN_ID + ".preferences.use.external.tools.dir"; 73 public static final String PREF_EXTERNAL_TOOLS_DIR = 74 PLUGIN_ID + ".preferences.external.tools.dir"; 71 75 72 76 … … 141 145 { 142 146 Properties pythonParams = new Properties(); 143 pythonParams.setProperty("python.path", 147 String wavedevBase = getWavedevBase(); 148 pythonParams.setProperty("python.path", 144 149 getPluginFolder() + "/PythonSrc" 145 150 + System.getProperty("path.separator") 146 151 + getPluginFolder() + "/PythonSrc/WaveDev/wavedev" 147 152 + System.getProperty("path.separator") 148 + getPluginFolder()153 + wavedevBase 149 154 + System.getProperty("path.separator") 150 + getPluginFolder()+ "/WaveDev/wavedev");155 + wavedevBase + "/WaveDev/wavedev"); 151 156 pythonParams.setProperty( 152 157 "python.home", getPluginFolder() + "/jython2.2.1"); … … 167 172 "import WaveDev\n" 168 173 + "WaveDev.__path__.append('" 169 + getPluginFolder()+ "/WaveDev')"174 + wavedevBase + "/WaveDev')" 170 175 // + "\nprint 'WaveDev.__path__ = ', WaveDev.__path__" 171 176 ); … … 173 178 "import WaveDev.wavedev\n" 174 179 + "WaveDev.wavedev.__path__.append('" 175 + getPluginFolder()+ "/WaveDev/wavedev')"180 + wavedevBase + "/WaveDev/wavedev')" 176 181 // + "\nprint 'WaveDev.wavedev.__path__ = ', " 177 182 // + "WaveDev.wavedev.__path__" … … 197 202 OWDPlugin.getDefault().getString( 198 203 OWDPlugin.PREF_OSSIE_DIR))); 199 mainFrame.setOssiePluginHome(new PyString(get PluginFolder()));204 mainFrame.setOssiePluginHome(new PyString(getWavedevBase())); 200 205 mainFrame.setIncludePath(new PyString( 201 206 OWDPlugin.getDefault().getString( … … 578 583 579 584 // ---------------------------------------------------------- 585 private static String getWavedevBase() 586 { 587 String wavedevBase = getPluginFolder(); 588 if (getDefault() != null 589 && getDefault().getBoolean(PREF_USE_EXTERNAL_TOOLS_DIR)) 590 { 591 wavedevBase = getDefault().getString(PREF_EXTERNAL_TOOLS_DIR); 592 wavedevBase = wavedevBase.replace('\\', '/') 593 .replaceFirst("/$", ""); 594 } 595 return wavedevBase; 596 } 597 598 599 // ---------------------------------------------------------- 580 600 private static class OutputForwarder 581 601 extends Thread -
ossiedev/branches/jsnyder/ComponentProject/src/edu/vt/ossie/PreferenceInitializer.java
r7690 r8083 21 21 IPreferenceStore store = OWDPlugin.getDefault().getPreferenceStore(); 22 22 store.setDefault(OWDPlugin.PREF_OSSIE_DIR, "/sdr/"); 23 store.setDefault(OWDPlugin.PREF_OSSIE_INCLUDE_PATH, "/usr/local/include/ossie/"); 24 store.setDefault(OWDPlugin.PREF_STANDARD_IDL_PATH, "/usr/local/include/standardinterfaces/"); 25 store.setDefault(OWDPlugin.PREF_CUSTOM_IDL_PATH, "/usr/local/include/custominterfaces/"); 23 store.setDefault( 24 OWDPlugin.PREF_OSSIE_INCLUDE_PATH, 25 "/usr/local/include/ossie/"); 26 store.setDefault( 27 OWDPlugin.PREF_STANDARD_IDL_PATH, 28 "/usr/local/include/standardinterfaces/"); 29 store.setDefault( 30 OWDPlugin.PREF_CUSTOM_IDL_PATH, 31 "/usr/local/include/custominterfaces/"); 26 32 store.setDefault(OWDPlugin.PREF_COMP_AUTO_INSTALL, true); 27 store.setDefault(OWDPlugin.PREF_WAVE_AUTO_INSTALL, true); 33 store.setDefault(OWDPlugin.PREF_USE_EXTERNAL_TOOLS_DIR, false); 34 store.setDefault(OWDPlugin.PREF_EXTERNAL_TOOLS_DIR, ""); 28 35 } 29 36 -
ossiedev/branches/jsnyder/ComponentProject/src/edu/vt/ossie/PreferencePage.java
r7778 r8083 2 2 3 3 import org.eclipse.jface.preference.BooleanFieldEditor; 4 import org.eclipse.jface.preference.DirectoryFieldEditor; 5 import org.eclipse.jface.preference.FieldEditor; 4 6 import org.eclipse.jface.preference.FieldEditorPreferencePage; 5 7 import org.eclipse.jface.preference.IPreferenceStore; 6 8 import org.eclipse.jface.preference.StringFieldEditor; 9 import org.eclipse.jface.util.PropertyChangeEvent; 10 import org.eclipse.swt.layout.GridData; 11 import org.eclipse.swt.widgets.Composite; 12 import org.eclipse.swt.widgets.Label; 7 13 import org.eclipse.ui.IWorkbench; 8 14 import org.eclipse.ui.IWorkbenchPreferencePage; 15 import quicktime.app.spaces.Space; 9 16 10 17 //------------------------------------------------------------------------- … … 42 49 protected void createFieldEditors() 43 50 { 44 addField(new StringFieldEditor( 51 addField(new LabelFieldEditor( 52 "Changes only affect new editors/windows.", 53 getFieldEditorParent())); 54 addField(new SpacerFieldEditor(getFieldEditorParent())); 55 56 addField(new DirectoryFieldEditor( 45 57 OWDPlugin.PREF_OSSIE_DIR, 46 "OSSIE install ationdirectory:",47 getFieldEditorParent())); 48 addField(new StringFieldEditor(58 "OSSIE install directory:", 59 getFieldEditorParent())); 60 addField(new DirectoryFieldEditor( 49 61 OWDPlugin.PREF_OSSIE_INCLUDE_PATH, 50 62 "OSSIE include path:", 51 63 getFieldEditorParent())); 52 addField(new StringFieldEditor(64 addField(new DirectoryFieldEditor( 53 65 OWDPlugin.PREF_STANDARD_IDL_PATH, 54 66 "Standard IDL path:", 55 67 getFieldEditorParent())); 56 addField(new StringFieldEditor(68 addField(new DirectoryFieldEditor( 57 69 OWDPlugin.PREF_CUSTOM_IDL_PATH, 58 70 "Custom IDL path:", … … 67 79 + "install on build", 68 80 getFieldEditorParent())); 81 82 addField(new SpacerFieldEditor(getFieldEditorParent())); 83 useToolsDir = new BooleanFieldEditor( 84 OWDPlugin.PREF_USE_EXTERNAL_TOOLS_DIR, 85 "Use WaveDev code from external tools directory", 86 getFieldEditorParent()); 87 addField(useToolsDir); 88 toolsDirParent = getFieldEditorParent(); 89 toolsDir = new DirectoryFieldEditor( 90 OWDPlugin.PREF_EXTERNAL_TOOLS_DIR, 91 "External tools directory:", 92 toolsDirParent); 93 addField(toolsDir); 94 if (!useToolsDir.getBooleanValue()) 95 { 96 toolsDir.setEnabled(false, toolsDirParent); 97 } 69 98 } 70 99 … … 75 104 // Nothing to do 76 105 } 106 77 107 78 108 // ---------------------------------------------------------- … … 83 113 return super.performOk(); 84 114 } 115 116 117 // ---------------------------------------------------------- 118 @Override 119 public void propertyChange(PropertyChangeEvent event) 120 { 121 super.propertyChange(event); 122 if (event.getSource() == useToolsDir) 123 { 124 System.out.println("propertyChange() called. tools = " 125 + useToolsDir.getBooleanValue()); 126 toolsDir.setEnabled(useToolsDir.getBooleanValue(), toolsDirParent); 127 checkState(); 128 } 129 else if (event.getSource() == toolsDir) 130 { 131 System.out.println("propertyChange() for tools dir"); 132 String value = toolsDir.getStringValue(); 133 if (value != null) 134 { 135 value = value.replaceFirst( 136 "(\\\\|/)WaveDev((\\\\|/)wavedev)?$", ""); 137 toolsDir.setStringValue(value); 138 } 139 checkState(); 140 } 141 } 142 143 144 // ---------------------------------------------------------- 145 @Override 146 protected void checkState() 147 { 148 super.checkState(); 149 if (useToolsDir != null && useToolsDir.getBooleanValue()) 150 { 151 String value = toolsDir.getStringValue(); 152 if (value == null || "".equals(value)) 153 { 154 setErrorMessage( 155 "An external tools directory must be specified."); 156 setValid(false); 157 } 158 else 159 { 160 setErrorMessage(null); 161 setValid(true); 162 } 163 } 164 else 165 { 166 setValid(true); 167 setErrorMessage(null); 168 } 169 } 170 171 172 // ---------------------------------------------------------- 173 /** 174 * A field editor for displaying labels not associated with other widgets. 175 */ 176 private static class LabelFieldEditor 177 extends FieldEditor 178 { 179 // All labels can use the same preference name since they don't 180 // store any preference. 181 public LabelFieldEditor(String value, Composite parent) 182 { 183 super("label", value, parent); 184 } 185 186 // Adjusts the field editor to be displayed correctly 187 // for the given number of columns. 188 protected void adjustForNumColumns(int numColumns) 189 { 190 ((GridData) label.getLayoutData()).horizontalSpan = numColumns; 191 } 192 193 // Fills the field editor's controls into the given parent. 194 protected void doFillIntoGrid(Composite parent, int numColumns) 195 { 196 label = getLabelControl(parent); 197 198 GridData gridData = new GridData(); 199 gridData.horizontalSpan = numColumns; 200 gridData.horizontalAlignment = GridData.FILL; 201 gridData.grabExcessHorizontalSpace = false; 202 gridData.verticalAlignment = GridData.CENTER; 203 gridData.grabExcessVerticalSpace = false; 204 205 label.setLayoutData(gridData); 206 } 207 208 // Returns the number of controls in the field editor. 209 public int getNumberOfControls() 210 { 211 return 1; 212 } 213 214 // Labels do not persist any preferences, so these methods are empty. 215 protected void doLoad() {} 216 protected void doLoadDefault() {} 217 protected void doStore() {} 218 219 private Label label; 220 } 221 222 223 // ---------------------------------------------------------- 224 /** 225 * A field editor for adding space to a preference page. 226 */ 227 private static class SpacerFieldEditor 228 extends LabelFieldEditor 229 { 230 // Implemented as an empty label field editor. 231 public SpacerFieldEditor(Composite parent) 232 { 233 super("", parent); 234 } 235 } 236 237 238 //~ Instance/static variables ............................................. 239 240 private BooleanFieldEditor useToolsDir; 241 private DirectoryFieldEditor toolsDir; 242 private Composite toolsDirParent; 85 243 }