|
Lines 20-26
Link Here
|
| 20 |
import org.apache.muse.tools.generator.analyzer.Analyzer; |
20 |
import org.apache.muse.tools.generator.analyzer.Analyzer; |
| 21 |
import org.apache.muse.tools.generator.projectizer.Projectizer; |
21 |
import org.apache.muse.tools.generator.projectizer.Projectizer; |
| 22 |
import org.apache.muse.tools.generator.synthesizer.Synthesizer; |
22 |
import org.apache.muse.tools.generator.synthesizer.Synthesizer; |
| 23 |
import org.eclipse.core.filesystem.IFileInfo; |
|
|
| 24 |
import org.eclipse.core.filesystem.URIUtil; |
23 |
import org.eclipse.core.filesystem.URIUtil; |
| 25 |
import org.eclipse.core.resources.IProject; |
24 |
import org.eclipse.core.resources.IProject; |
| 26 |
import org.eclipse.core.resources.IResource; |
25 |
import org.eclipse.core.resources.IResource; |
|
Lines 41-46
Link Here
|
| 41 |
import org.eclipse.jface.dialogs.DialogPage; |
40 |
import org.eclipse.jface.dialogs.DialogPage; |
| 42 |
import org.eclipse.jface.dialogs.IDialogConstants; |
41 |
import org.eclipse.jface.dialogs.IDialogConstants; |
| 43 |
import org.eclipse.jface.resource.ImageRegistry; |
42 |
import org.eclipse.jface.resource.ImageRegistry; |
|
|
43 |
import org.eclipse.jface.util.Util; |
| 44 |
import org.eclipse.jface.viewers.ISelection; |
44 |
import org.eclipse.jface.viewers.ISelection; |
| 45 |
import org.eclipse.jface.viewers.ISelectionChangedListener; |
45 |
import org.eclipse.jface.viewers.ISelectionChangedListener; |
| 46 |
import org.eclipse.jface.viewers.IStructuredContentProvider; |
46 |
import org.eclipse.jface.viewers.IStructuredContentProvider; |
|
Lines 50-56
Link Here
|
| 50 |
import org.eclipse.jface.viewers.TableViewer; |
50 |
import org.eclipse.jface.viewers.TableViewer; |
| 51 |
import org.eclipse.jface.viewers.Viewer; |
51 |
import org.eclipse.jface.viewers.Viewer; |
| 52 |
import org.eclipse.jface.window.Window; |
52 |
import org.eclipse.jface.window.Window; |
| 53 |
import org.eclipse.jface.wizard.WizardDialog; |
|
|
| 54 |
import org.eclipse.jface.wizard.WizardPage; |
53 |
import org.eclipse.jface.wizard.WizardPage; |
| 55 |
import org.eclipse.osgi.util.TextProcessor; |
54 |
import org.eclipse.osgi.util.TextProcessor; |
| 56 |
import org.eclipse.swt.SWT; |
55 |
import org.eclipse.swt.SWT; |
|
Lines 76-88
Link Here
|
| 76 |
import org.eclipse.tptp.wsdm.tooling.editor.mrt.internal.ManageableResourceTypeEditorPlugin; |
75 |
import org.eclipse.tptp.wsdm.tooling.editor.mrt.internal.ManageableResourceTypeEditorPlugin; |
| 77 |
import org.eclipse.tptp.wsdm.tooling.nls.messages.mrt.internal.Messages; |
76 |
import org.eclipse.tptp.wsdm.tooling.nls.messages.mrt.internal.Messages; |
| 78 |
import org.eclipse.tptp.wsdm.tooling.util.internal.Validation; |
77 |
import org.eclipse.tptp.wsdm.tooling.util.internal.Validation; |
| 79 |
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; |
|
|
| 80 |
import org.eclipse.ui.internal.ide.dialogs.FileSystemSelectionArea; |
| 81 |
import org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils; |
| 82 |
import org.eclipse.ui.internal.ide.dialogs.ProjectContentsLocationArea; |
| 83 |
import org.eclipse.ui.internal.ide.dialogs.ProjectContentsLocationArea.IErrorMessageReporter; |
| 84 |
import org.eclipse.ui.internal.ide.filesystem.FileSystemConfiguration; |
| 85 |
import org.eclipse.ui.internal.ide.filesystem.FileSystemSupportRegistry; |
| 86 |
|
78 |
|
| 87 |
/** |
79 |
/** |
| 88 |
* This wizard enables the use to specify the projectizer options and |
80 |
* This wizard enables the use to specify the projectizer options and |
|
Lines 96-105
Link Here
|
| 96 |
private Text _ddText; |
88 |
private Text _ddText; |
| 97 |
private Text _projectNameField; |
89 |
private Text _projectNameField; |
| 98 |
|
90 |
|
| 99 |
private ProjectContentsLocationArea _locationArea; |
91 |
private String _userPath = Util.ZERO_LENGTH_STRING;//IDEResourceInfoUtils.EMPTY_STRING; |
| 100 |
private FileSystemSelectionArea _fileSystemSelectionArea; |
|
|
| 101 |
private IErrorMessageReporter _errorReporter; |
| 102 |
private String _userPath = IDEResourceInfoUtils.EMPTY_STRING; |
| 103 |
|
92 |
|
| 104 |
private Button _useDefaultsButton; |
93 |
private Button _useDefaultsButton; |
| 105 |
|
94 |
|
|
Lines 207-215
Link Here
|
| 207 |
_projectNameField.setFont(parent.getFont()); |
196 |
_projectNameField.setFont(parent.getFont()); |
| 208 |
_projectNameField.addListener(SWT.Modify, nameModifyListener); |
197 |
_projectNameField.addListener(SWT.Modify, nameModifyListener); |
| 209 |
|
198 |
|
| 210 |
_errorReporter = getErrorReporter(); |
199 |
//_errorReporter = getErrorReporter(); |
| 211 |
_useDefaultsButton = new Button(page, SWT.CHECK | SWT.RIGHT); |
200 |
_useDefaultsButton = new Button(page, SWT.CHECK | SWT.RIGHT); |
| 212 |
_useDefaultsButton.setText(IDEWorkbenchMessages.ProjectLocationSelectionDialog_useDefaultLabel); |
201 |
_useDefaultsButton.setText(Messages.CODE_GEN_DEFAULT_LOCATION);//IDEWorkbenchMessages.ProjectLocationSelectionDialog_useDefaultLabel); |
| 213 |
_useDefaultsButton.setSelection(true); |
202 |
_useDefaultsButton.setSelection(true); |
| 214 |
GridData buttonData = new GridData(); |
203 |
GridData buttonData = new GridData(); |
| 215 |
buttonData.horizontalSpan = 2; |
204 |
buttonData.horizontalSpan = 2; |
|
Lines 289-297
Link Here
|
| 289 |
_locationLabel.setEnabled(enabled); |
278 |
_locationLabel.setEnabled(enabled); |
| 290 |
_locationPathField.setEnabled(enabled); |
279 |
_locationPathField.setEnabled(enabled); |
| 291 |
_browseButton.setEnabled(enabled); |
280 |
_browseButton.setEnabled(enabled); |
| 292 |
if (_fileSystemSelectionArea != null) { |
|
|
| 293 |
_fileSystemSelectionArea.setEnabled(enabled); |
| 294 |
} |
| 295 |
} |
281 |
} |
| 296 |
|
282 |
|
| 297 |
private void createUserEntryArea(Composite composite, boolean defaultEnabled) { |
283 |
private void createUserEntryArea(Composite composite, boolean defaultEnabled) { |
|
Lines 318-330
Link Here
|
| 318 |
} |
304 |
} |
| 319 |
}); |
305 |
}); |
| 320 |
|
306 |
|
| 321 |
createFileSystemSelection(composite); |
|
|
| 322 |
|
| 323 |
if (defaultEnabled) { |
307 |
if (defaultEnabled) { |
| 324 |
_locationPathField.setText(TextProcessor.process(getDefaultPathDisplayString())); |
308 |
_locationPathField.setText(TextProcessor.process(getDefaultPathDisplayString())); |
| 325 |
} else { |
309 |
} else { |
| 326 |
if (_existingProject == null) { |
310 |
if (_existingProject == null) { |
| 327 |
_locationPathField.setText(IDEResourceInfoUtils.EMPTY_STRING); |
311 |
_locationPathField.setText(Util.ZERO_LENGTH_STRING);//IDEResourceInfoUtils.EMPTY_STRING); |
| 328 |
} else { |
312 |
} else { |
| 329 |
_locationPathField.setText(TextProcessor.process(_existingProject |
313 |
_locationPathField.setText(TextProcessor.process(_existingProject |
| 330 |
.getLocation().toString())); |
314 |
.getLocation().toString())); |
|
Lines 338-378
Link Here
|
| 338 |
* @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent) |
322 |
* @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent) |
| 339 |
*/ |
323 |
*/ |
| 340 |
public void modifyText(ModifyEvent e) { |
324 |
public void modifyText(ModifyEvent e) { |
| 341 |
_errorReporter.reportError(checkValidLocation()); |
325 |
setErrorMessage(checkValidLocation()); |
| 342 |
} |
326 |
} |
| 343 |
}); |
327 |
}); |
| 344 |
} |
328 |
} |
| 345 |
|
329 |
|
| 346 |
/** |
330 |
/** |
| 347 |
* Return the default location |
331 |
* Returns whether the default location is selected or not. |
|
|
332 |
* @return boolean |
| 348 |
*/ |
333 |
*/ |
| 349 |
public boolean isDefault() { |
334 |
public boolean isDefault() { |
| 350 |
return _useDefaultsButton.getSelection(); |
335 |
return _useDefaultsButton.getSelection(); |
| 351 |
} |
336 |
} |
| 352 |
|
337 |
|
| 353 |
private FileSystemConfiguration getSelectedConfiguration() { |
338 |
/** |
| 354 |
if (_fileSystemSelectionArea == null) { |
339 |
* Returns the Project location URI |
| 355 |
return FileSystemSupportRegistry.getInstance() |
340 |
* @return java.net.URI |
| 356 |
.getDefaultConfiguration(); |
341 |
*/ |
| 357 |
} |
|
|
| 358 |
|
| 359 |
return _fileSystemSelectionArea.getSelectedConfiguration(); |
| 360 |
} |
| 361 |
|
| 362 |
public java.net.URI getProjectLocationURI() { |
342 |
public java.net.URI getProjectLocationURI() { |
| 363 |
|
343 |
return URIUtil.toURI(_locationPathField.getText()); |
| 364 |
FileSystemConfiguration configuration = getSelectedConfiguration(); |
|
|
| 365 |
if (configuration == null) { |
| 366 |
return null; |
| 367 |
} |
| 368 |
|
| 369 |
return configuration.getContributor().getURI( |
| 370 |
_locationPathField.getText()); |
| 371 |
|
| 372 |
} |
344 |
} |
| 373 |
|
345 |
|
| 374 |
/** |
346 |
/** |
| 375 |
* Check if the location is valid |
347 |
* Check if the location is valid |
|
|
348 |
* @return String |
| 376 |
*/ |
349 |
*/ |
| 377 |
public String checkValidLocation() { |
350 |
public String checkValidLocation() { |
| 378 |
|
351 |
|
|
Lines 382-393
Link Here
|
| 382 |
|
355 |
|
| 383 |
String locationFieldContents = _locationPathField.getText(); |
356 |
String locationFieldContents = _locationPathField.getText(); |
| 384 |
if (locationFieldContents.length() == 0) { |
357 |
if (locationFieldContents.length() == 0) { |
| 385 |
return (IDEWorkbenchMessages.WizardNewProjectCreationPage_projectLocationEmpty); |
358 |
return (Messages.CODE_GEN_PROJECT_DIR);//IDEWorkbenchMessages.WizardNewProjectCreationPage_projectLocationEmpty); |
| 386 |
} |
359 |
} |
| 387 |
|
360 |
|
| 388 |
java.net.URI newPath = getProjectLocationURI(); |
361 |
java.net.URI newPath = getProjectLocationURI(); |
| 389 |
if (newPath == null) { |
362 |
if (newPath == null) { |
| 390 |
return IDEWorkbenchMessages.ProjectLocationSelectionDialog_locationError; |
363 |
return Messages.CODE_GEN_LOCATION_ERROR;//IDEWorkbenchMessages.ProjectLocationSelectionDialog_locationError; |
| 391 |
} |
364 |
} |
| 392 |
|
365 |
|
| 393 |
if (_existingProject == null) { |
366 |
if (_existingProject == null) { |
|
Lines 406-412
Link Here
|
| 406 |
|
379 |
|
| 407 |
java.net.URI projectPath = _existingProject.getLocationURI(); |
380 |
java.net.URI projectPath = _existingProject.getLocationURI(); |
| 408 |
if (projectPath != null && URIUtil.equals(projectPath, newPath)) { |
381 |
if (projectPath != null && URIUtil.equals(projectPath, newPath)) { |
| 409 |
return IDEWorkbenchMessages.ProjectLocationSelectionDialog_locationError; |
382 |
return Messages.CODE_GEN_LOCATION_ERROR;//IDEWorkbenchMessages.ProjectLocationSelectionDialog_locationError; |
| 410 |
} |
383 |
} |
| 411 |
} |
384 |
} |
| 412 |
|
385 |
|
|
Lines 447-510
Link Here
|
| 447 |
String selectedDirectory = null; |
420 |
String selectedDirectory = null; |
| 448 |
String dirName = getPathFromLocationField(); |
421 |
String dirName = getPathFromLocationField(); |
| 449 |
|
422 |
|
| 450 |
if (!dirName.equals(IDEResourceInfoUtils.EMPTY_STRING)) { |
423 |
DirectoryDialog dialog = new DirectoryDialog(_locationPathField.getShell()); |
| 451 |
IFileInfo info; |
424 |
dialog.setMessage(Messages.CODE_GEN_DIR_LOCATION);//IDEWorkbenchMessages.ProjectLocationSelectionDialog_directoryLabel); |
| 452 |
info = IDEResourceInfoUtils.getFileInfo(dirName); |
425 |
dialog.setFilterPath(dirName); |
| 453 |
|
426 |
selectedDirectory = dialog.open(); |
| 454 |
if (info == null || !(info.exists())) |
427 |
|
| 455 |
dirName = IDEResourceInfoUtils.EMPTY_STRING; |
|
|
| 456 |
} |
| 457 |
|
| 458 |
FileSystemConfiguration config = getSelectedConfiguration(); |
| 459 |
if (config== null || config.equals( |
| 460 |
FileSystemSupportRegistry.getInstance() |
| 461 |
.getDefaultConfiguration())) { |
| 462 |
DirectoryDialog dialog = new DirectoryDialog(_locationPathField.getShell()); |
| 463 |
dialog.setMessage(IDEWorkbenchMessages.ProjectLocationSelectionDialog_directoryLabel); |
| 464 |
|
| 465 |
dialog.setFilterPath(dirName); |
| 466 |
|
| 467 |
selectedDirectory = dialog.open(); |
| 468 |
|
| 469 |
} else { |
| 470 |
java.net.URI uri = getSelectedConfiguration().getContributor() |
| 471 |
.browseFileSystem(dirName, _browseButton.getShell()); |
| 472 |
if (uri != null) |
| 473 |
selectedDirectory = uri.toString(); |
| 474 |
} |
| 475 |
|
| 476 |
if (selectedDirectory != null) |
428 |
if (selectedDirectory != null) |
| 477 |
updateLocationField(selectedDirectory); |
429 |
updateLocationField(selectedDirectory); |
| 478 |
} |
430 |
} |
| 479 |
|
431 |
|
| 480 |
/** |
|
|
| 481 |
* Create the file system selection area. |
| 482 |
* |
| 483 |
* @param composite |
| 484 |
*/ |
| 485 |
private void createFileSystemSelection(Composite composite) { |
| 486 |
|
| 487 |
// Always use the default if that is all there is. |
| 488 |
if (FileSystemSupportRegistry.getInstance().hasOneFileSystem()) { |
| 489 |
return; |
| 490 |
} |
| 491 |
|
| 492 |
new Label(composite, SWT.NONE); |
| 493 |
|
| 494 |
_fileSystemSelectionArea = new FileSystemSelectionArea(); |
| 495 |
_fileSystemSelectionArea.createContents(composite); |
| 496 |
} |
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
private IErrorMessageReporter getErrorReporter() { |
| 501 |
return new IErrorMessageReporter(){ |
| 502 |
public void reportError(String errorMessage) { |
| 503 |
setErrorMessage(errorMessage); |
| 504 |
} |
| 505 |
}; |
| 506 |
} |
| 507 |
|
| 508 |
private Listener nameModifyListener = new Listener() { |
432 |
private Listener nameModifyListener = new Listener() { |
| 509 |
public void handleEvent(Event e) { |
433 |
public void handleEvent(Event e) { |
| 510 |
setLocationForSelection(); |
434 |
setLocationForSelection(); |
|
Lines 634-644
Link Here
|
| 634 |
|
558 |
|
| 635 |
/** |
559 |
/** |
| 636 |
* Return the value of the output project |
560 |
* Return the value of the output project |
|
|
561 |
* @return String |
| 637 |
*/ |
562 |
*/ |
| 638 |
public String getProjectName() { |
563 |
public String getProjectName() { |
| 639 |
return _projectNameField.getText(); |
564 |
return _projectNameField.getText(); |
| 640 |
} |
565 |
} |
| 641 |
|
566 |
|
|
|
567 |
/** |
| 568 |
* Returns if Overwrite button is enabled |
| 569 |
* @return boolean |
| 570 |
*/ |
| 642 |
public boolean isOverwrite() { |
571 |
public boolean isOverwrite() { |
| 643 |
return _buttonOverwrite.isEnabled(); |
572 |
return _buttonOverwrite.isEnabled(); |
| 644 |
} |
573 |
} |
|
Lines 676-681
Link Here
|
| 676 |
return null; |
605 |
return null; |
| 677 |
} |
606 |
} |
| 678 |
|
607 |
|
|
|
608 |
/** |
| 609 |
* Returns the base address |
| 610 |
* @return String |
| 611 |
*/ |
| 679 |
public String getBaseAddress() { |
612 |
public String getBaseAddress() { |
| 680 |
String name = _projectizerCombo.getText(); |
613 |
String name = _projectizerCombo.getText(); |
| 681 |
String baseAddress = "http://localhost"; |
614 |
String baseAddress = "http://localhost"; |