Repository navigation
Expand file tree
/
Copy pathSSExportWizard1.java
More file actions
109 lines (98 loc) · 3.73 KB
/
Copy pathSSExportWizard1.java
File metadata and controls
109 lines (98 loc) · 3.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package shellScriptGen;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.internal.resources.Workspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.IExportWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.WorkbenchPlugin;
import org.eclipse.ui.progress.IProgressService;
import shellScriptGen.builders.ScriptBuilder;
import shellScriptGen.builders.ScriptBuildingException;
import shellScriptGen.ui.MainPage;
/**
* This is the export wizard class. This performs the finish action when the
* user clicks the "Finish" button on the main page.
*
* @author Amit Nithian ([email protected]) ([email protected])
* @copyright 2006
*
*/
public class SSExportWizard1 extends Wizard implements IExportWizard
{
private MainPage sPage;
public SSExportWizard1()
{
super();
// TODO Auto-generated constructor stub
this.setWindowTitle("Export to Shell Scripts");
this.setNeedsProgressMonitor(true);
}
@Override
public boolean performFinish()
{
// TODO Auto-generated method stub
try
{
// Calls on the page to create the scripts and gets
// the message to display to the user OR prints an error
// if the scripts failed to create.
// MessageDialog.openInformation(getShell(),"Finished Shell Script Generation",sMessage);
getContainer().run(false, false, new IRunnableWithProgress()
{
public void run(IProgressMonitor pm) throws InvocationTargetException
{
try
{
pm.beginTask("Creating Scripts", 150);
String sMessage = sPage.createShellScripts(pm);
MessageDialog.openInformation(getShell(),"Finished Shell Script Generation",sMessage);
}
catch (ScriptBuildingException e)
{
// TODO Auto-generated catch block
MessageDialog.openError(getShell(), "Error:", e.getMessage());
throw new InvocationTargetException(e);
}
// pm.beginTask("Test", 100);
// for(int i=0; i < 10; i++)
// {
// pm.worked(10);
// ScriptBuilder.sleep(1000);
// }
// pm.done();
}
});
}
catch (InvocationTargetException e)
{
// TODO Auto-generated catch block
return false;
}
catch (InterruptedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
return true;
}
public void init(IWorkbench workbench, IStructuredSelection selection)
{
ScriptModel model = new ScriptModel();
if(selection != null && selection.getFirstElement() instanceof IJavaProject)
{
model.setSelectedProject((IJavaProject)selection.getFirstElement());
}
sPage = new MainPage("Select Projects",model);
sPage.setDescription("Select the projects and runtime configurations to export to shell scripts.");
addPage(sPage);
}
}