Search in sources :

Example 1 with ISaveContext

use of org.eclipse.core.resources.ISaveContext in project linuxtools by eclipse.

the class LibhoverPlugin method start.

@Override
public void start(BundleContext context) throws Exception {
    super.start(context);
    plugin = this;
    ResourcesPlugin.getWorkspace().addSaveParticipant(PLUGIN_ID, new ISaveParticipant() {

        @Override
        public void saving(ISaveContext saveContext) {
            save();
        }

        @Override
        public void rollback(ISaveContext saveContext) {
        }

        @Override
        public void prepareToSave(ISaveContext saveContext) {
        }

        @Override
        public void doneSaving(ISaveContext saveContext) {
        }
    });
    IPreferenceStore ps = getPreferenceStore();
    if (ps == null || !ps.getBoolean(PreferenceConstants.LAZY_LOAD)) {
        Job k = new LibHoverLoadJob(LibHoverMessages.getString(LOAD_JOB_TXT));
        k.schedule();
    }
}
Also used : ISaveParticipant(org.eclipse.core.resources.ISaveParticipant) ISaveContext(org.eclipse.core.resources.ISaveContext) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) Job(org.eclipse.core.runtime.jobs.Job) LibHoverLoadJob(org.eclipse.linuxtools.internal.cdt.libhover.LibHoverLoadJob) LibHoverLoadJob(org.eclipse.linuxtools.internal.cdt.libhover.LibHoverLoadJob)

Example 2 with ISaveContext

use of org.eclipse.core.resources.ISaveContext in project xtext-xtend by eclipse.

the class UIResourceChangeRegistry method init.

@Inject
public void init(final IWorkspace workspace) {
    try {
        this.workspace = workspace;
        this.load();
        String _symbolicName = this.uiPlugin.getBundle().getSymbolicName();
        workspace.addSaveParticipant(_symbolicName, new ISaveParticipant() {

            @Override
            public void saving(final ISaveContext context) throws CoreException {
                UIResourceChangeRegistry.this.save();
            }

            @Override
            public void doneSaving(final ISaveContext context) {
            }

            @Override
            public void prepareToSave(final ISaveContext context) throws CoreException {
            }

            @Override
            public void rollback(final ISaveContext context) {
            }
        });
        workspace.addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE);
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) ISaveParticipant(org.eclipse.core.resources.ISaveParticipant) ISaveContext(org.eclipse.core.resources.ISaveContext) Inject(com.google.inject.Inject)

Aggregations

ISaveContext (org.eclipse.core.resources.ISaveContext)2 ISaveParticipant (org.eclipse.core.resources.ISaveParticipant)2 Inject (com.google.inject.Inject)1 CoreException (org.eclipse.core.runtime.CoreException)1 Job (org.eclipse.core.runtime.jobs.Job)1 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)1 LibHoverLoadJob (org.eclipse.linuxtools.internal.cdt.libhover.LibHoverLoadJob)1