/* * (non-Javadoc) * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) */ public void start(BundleContext context) throws Exception { super.start(context); ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener); ResourcesPlugin.getWorkspace() .addSaveParticipant( PLUGIN_ID, new ISaveParticipant() { public void saving(ISaveContext context) throws CoreException { switch (context.getKind()) { case ISaveContext.SNAPSHOT: case ISaveContext.FULL_SAVE: IProject[] ps = ResourcesPlugin.getWorkspace().getRoot().getProjects(); for (IProject p : ps) { KbProject sp = (KbProject) KbProjectFactory.getKbProject(p, false, true); if (sp != null && sp.getModificationsSinceLastStore() > 0) { // sp.printModifications(); try { sp.store(); } catch (IOException e) { WebKbPlugin.getDefault().logError(e); } } } break; case ISaveContext.PROJECT_SAVE: KbProject sp = (KbProject) KbProjectFactory.getKbProject(context.getProject(), false, true); try { if (sp != null && sp.getModificationsSinceLastStore() > 0) { sp.store(); } } catch (IOException e) { WebKbPlugin.getDefault().logError(e); } break; } cleanObsoleteFiles(); } public void rollback(ISaveContext context) {} public void prepareToSave(ISaveContext context) throws CoreException {} public void doneSaving(ISaveContext context) {} }); }
/* * (non-Javadoc) * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) */ public void stop(BundleContext context) throws Exception { ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener); super.stop(context); }
/* * (non-Javadoc) * * @see * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext * ) */ public void stop(BundleContext context) throws Exception { super.stop(context); }