More export wizard UI. Added a warning when running a sketch fails because the editor is in the wrong perspective.

This commit is contained in:
lonnen
2010-09-20 18:58:39 +00:00
parent 05b94676d1
commit 62864a71bc
2 changed files with 56 additions and 16 deletions

View File

@@ -58,22 +58,48 @@ public class RunSketchAsAppletShortcut implements ILaunchShortcut {
ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
return lm.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLET);
}
public void launch(IProject proj, String mode){
try{
if (proj.hasNature("processing.plugin.core.sketchNature"))
launch(createConfiguration(proj), mode);
else
ProcessingLog.logInfo("Sketch could not be launched. "
+ "The selected project does not have the required Sketch nature.");
} catch (CoreException e){
ProcessingLog.logError("Launch aborted. CoreException error occured while accessing the project.", e);
}
}
public void launch(ISelection selection, String mode) {
if (selection instanceof IStructuredSelection) {
Object element = ((IStructuredSelection)selection).getFirstElement();
if (element instanceof IResource){
IProject proj = ((IResource)element).getProject();
try{
if (proj.hasNature("processing.plugin.core.sketchNature"))
launch(createConfiguration(proj), mode);
else
ProcessingLog.logInfo("Sketch could not be launched. The selected project does not have the required Sketch nature.");
} catch (CoreException e){
ProcessingLog.logError("Launch aborted.", e);
if (proj.isAccessible()){
launch(proj, mode);
} else {
ProcessingLog.logInfo("Sketch could not be launched. " +
"Project was not accessible.");
}
} else {
ProcessingLog.logInfo("Sketch could not be launched. Launcher was provided with a non-resource selection.");
// if (element instanceof JavaProject){
// /* The Java perspective hijacks Processing sketches and reports them through the selection
// * interface as JavaProjects instead of IProjects or IResources or SketchProjects, all of
// * which they happen to be, so I'm stuck accessing restricted code. Great.
// */
// IProject project = ((JavaProject)element).getProject();
// if(project.isAccessible()){
// launch( project, mode);
// } else {
// ProcessingLog.logInfo("Sketch could not be launched. " +
// "Project was not accessible. Try launching from the Processing Perspective");
// }
// }
}else {
// System.out.println(element.getClass().getName());
ProcessingLog.logInfo("Sketch could not be launched. " +
"The launcher could not find a Sketch project associated with the provided selection." +
"Try relaunching from the Processing Perspective, or launching a specific *.pde file.");
}
}
}

View File

@@ -66,7 +66,6 @@ public class ExportAsAppletSelectProjectsWizardPage extends WizardPage {
if (entry.setEntry(p)) entries.add(entry);
}
}
}
}
@@ -168,13 +167,28 @@ public class ExportAsAppletSelectProjectsWizardPage extends WizardPage {
table.setLayoutData(formData);
table.setHeaderVisible(true);
final TableColumn rightTableColumn = new TableColumn(table,SWT.NONE);
rightTableColumn.setWidth(200);
rightTableColumn.setText("Name");
final TableColumn leftTableColumn = new TableColumn(table,SWT.NONE);
leftTableColumn.setWidth(250);
leftTableColumn.setText("Notes");
leftTableColumn.setWidth(200);
leftTableColumn.setText("Name");
final TableColumn rightTableColumn = new TableColumn(table,SWT.NONE);
rightTableColumn.setWidth(250);
rightTableColumn.setText("Notes");
}
/**
* Override of setVisible to update and display the content only
* when the page is becoming visible.
* <p>
* {@inheritDoc}
*/
public void setVisible(boolean visible){
if (visible) projectTable.setInput(visible);
/* setInput needs an object, but it really doesn't matter what is
* handed to it as long as the content provider is the private class
* ProjectTableConentProvider, because that provider ignores the object
* and builds everything itself. */
super.setVisible(visible);
}
}