You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by rg...@apache.org on 2004/09/17 03:35:09 UTC
svn commit: rev 46232 - forrest/trunk/scratchpad/eclipsePlugin/src/org/apache/forrest/eclipse/wizards
Author: rgardler
Date: Thu Sep 16 18:35:08 2004
New Revision: 46232
Modified:
forrest/trunk/scratchpad/eclipsePlugin/src/org/apache/forrest/eclipse/wizards/NewXDoc.java
Log:
Create file in separate method to allow it to be overridden without the need to override other aspects of the Wizard.
Modified: forrest/trunk/scratchpad/eclipsePlugin/src/org/apache/forrest/eclipse/wizards/NewXDoc.java
==============================================================================
--- forrest/trunk/scratchpad/eclipsePlugin/src/org/apache/forrest/eclipse/wizards/NewXDoc.java (original)
+++ forrest/trunk/scratchpad/eclipsePlugin/src/org/apache/forrest/eclipse/wizards/NewXDoc.java Thu Sep 16 18:35:08 2004
@@ -124,7 +124,34 @@
throwCoreException("Container \"" + containerName + "\" does not exist.");
}
- // create the file
+ createFile(resource, fileName, monitor);
+
+ IContainer container = (IContainer) resource;
+ final IFile file = container.getFile(new Path(fileName));
+
+ monitor.worked(1);
+ monitor.setTaskName("Opening file for editing...");
+ getShell().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ IWorkbenchPage page =
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ try {
+ IDE.openEditor(page, file, true);
+ } catch (PartInitException e) {
+ }
+ }
+ });
+ monitor.worked(1);
+ }
+
+ /*
+ * Create the file and put the template data into it.
+ */
+ protected void createFile(
+ IResource resource,
+ String fileName,
+ IProgressMonitor monitor)
+ throws CoreException {
AntRunner runner = new AntRunner();
ForrestPlugin plugin = ForrestPlugin.getDefault();
String strPluginDir = plugin.getBundle().getLocation();
@@ -143,23 +170,6 @@
runner.setArguments(sb.toString());
runner.run(monitor);
resource.refreshLocal(IProject.DEPTH_INFINITE, monitor);
-
- IContainer container = (IContainer) resource;
- final IFile file = container.getFile(new Path(fileName));
-
- monitor.worked(1);
- monitor.setTaskName("Opening file for editing...");
- getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- IWorkbenchPage page =
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- try {
- IDE.openEditor(page, file, true);
- } catch (PartInitException e) {
- }
- }
- });
- monitor.worked(1);
}
private void throwCoreException(String message) throws CoreException {