| package org.eclipse.equinox.demo.file.association; |
| |
| import org.eclipse.swt.widgets.Display; |
| import org.eclipse.ui.application.IWorkbenchWindowConfigurer; |
| import org.eclipse.ui.application.WorkbenchAdvisor; |
| import org.eclipse.ui.application.WorkbenchWindowAdvisor; |
| |
| /** |
| * This workbench advisor creates the window advisor, and specifies |
| * the perspective id for the initial window. |
| */ |
| public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor { |
| private OpenDocumentEventProcessor openDocProcessor; |
| |
| public ApplicationWorkbenchAdvisor(OpenDocumentEventProcessor openDocProcessor) { |
| this.openDocProcessor = openDocProcessor; |
| } |
| |
| public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { |
| return new ApplicationWorkbenchWindowAdvisor(configurer); |
| } |
| |
| public String getInitialWindowPerspectiveId() { |
| return Perspective.ID; |
| } |
| /** |
| * Added to process SWT.OpenDocument events. |
| * Here we actually process the OpenDocument events. |
| */ |
| public void eventLoopIdle(Display display) { |
| openDocProcessor.openFiles(); |
| super.eventLoopIdle(display); |
| } |
| } |