Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: e4954e03d6a59b5381aa72aa361cb32d898cc79c (plain) (blame)
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
/**********************************************************************
 * Copyright (c) 2004 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors: 
 * IBM - Initial API and implementation
 **********************************************************************/
package org.eclipse.cdt.managedbuilder.internal.ui;

import org.eclipse.cdt.managedbuilder.ui.actions.UpdateManagedProjectAction;
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IStartup;

/**
 *
 */
public class ManagedMakeStartup implements IStartup {
	/* (non-Javadoc)
	 * @see org.eclipse.ui.IStartup#earlyStartup()
	 */
	public void earlyStartup() {
		// Get any 1.2 projects from the workspace
		final IProject[] projects = UpdateManagedProjectAction.getVersion12Projects();
		if (projects.length > 0) {
			Display.getDefault().asyncExec(new Runnable() {
				// Start the process that will update the 1.2 projects
				public void run() {
					Shell shell = ManagedBuilderUIPlugin.getDefault().getShell();
					for (int index = projects.length - 1; index >= 0; --index) {
						IProject project = projects[index];
						boolean shouldUpdate = MessageDialog.openQuestion(shell,
								ManagedBuilderUIMessages.getResourceString("ManagedBuilderStartup.update.12x.title"), //$NON-NLS-1$
								ManagedBuilderUIMessages.getFormattedString("ManagedBuilderStartup.update.12x.message", new String[]{project.getName()})); //$NON-NLS-1$
						// Go for it
						if (shouldUpdate) {
							ProgressMonitorDialog pd = new ProgressMonitorDialog(shell);
							UpdateManagedProjectAction.run(false, pd, project);
						}
					}

				}
			});
		}
	}
}

Back to the top