mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
This commit is contained in:
parent
1d97cb0d81
commit
839bb5375c
3 changed files with 39 additions and 28 deletions
|
@ -421,7 +421,8 @@
|
|||
|
||||
<extension
|
||||
point="org.eclipse.ui.startup">
|
||||
<startup>
|
||||
<startup
|
||||
class="org.eclipse.cdt.make.internal.ui.MakeStartup">
|
||||
</startup>
|
||||
</extension>
|
||||
<extension
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package org.eclipse.cdt.make.internal.ui;
|
||||
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import org.eclipse.ui.IStartup;
|
||||
|
||||
import org.eclipse.cdt.make.ui.actions.UpdateMakeProjectAction;
|
||||
|
||||
public class MakeStartup implements IStartup {
|
||||
|
||||
public void earlyStartup() {
|
||||
final IProject[] oldProject = UpdateMakeProjectAction.getOldProjects();
|
||||
if (oldProject.length > 0) {
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
Shell shell = MakeUIPlugin.getDefault().getShell();
|
||||
boolean shouldUpdate = MessageDialog.openQuestion(shell,
|
||||
MakeUIPlugin.getResourceString("MakeUIPlugin.update_project"), //$NON-NLS-1$
|
||||
MakeUIPlugin.getResourceString("MakeUIPlugin.update_project_message")); //$NON-NLS-1$
|
||||
|
||||
if (shouldUpdate) {
|
||||
ProgressMonitorDialog pd = new ProgressMonitorDialog(shell);
|
||||
UpdateMakeProjectAction.run(false, pd, oldProject);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -9,8 +9,6 @@ import org.eclipse.cdt.make.internal.ui.editor.MakefileDocumentProvider;
|
|||
import org.eclipse.cdt.make.internal.ui.editor.WorkingCopyManager;
|
||||
import org.eclipse.cdt.make.internal.ui.preferences.MakeTargetsPreferencePage;
|
||||
import org.eclipse.cdt.make.ui.IWorkingCopyManager;
|
||||
import org.eclipse.cdt.make.ui.actions.UpdateMakeProjectAction;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
@ -18,12 +16,9 @@ import org.eclipse.core.runtime.IPluginDescriptor;
|
|||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IStartup;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
|
@ -31,7 +26,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
|
|||
/**
|
||||
* The main plugin class to be used in the desktop.
|
||||
*/
|
||||
public class MakeUIPlugin extends AbstractUIPlugin implements IStartup {
|
||||
public class MakeUIPlugin extends AbstractUIPlugin {
|
||||
//The shared instance.
|
||||
private static MakeUIPlugin plugin;
|
||||
//Resource bundle.
|
||||
|
@ -215,27 +210,6 @@ public class MakeUIPlugin extends AbstractUIPlugin implements IStartup {
|
|||
ErrorDialog.openError(shell, title, message, status);
|
||||
}
|
||||
|
||||
public void earlyStartup() {
|
||||
final IProject[] oldProject = UpdateMakeProjectAction.getOldProjects();
|
||||
if (oldProject.length > 0) {
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
if (MessageDialog
|
||||
.openQuestion(
|
||||
getShell(),
|
||||
MakeUIPlugin.getResourceString("MakeUIPlugin.update_project"), //$NON-NLS-1$
|
||||
MakeUIPlugin.getResourceString("MakeUIPlugin.update_project_message")) //$NON-NLS-1$
|
||||
== true) {
|
||||
ProgressMonitorDialog pd = new ProgressMonitorDialog(getShell());
|
||||
UpdateMakeProjectAction.run(false, pd, oldProject);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
protected Shell getShell() {
|
||||
if (getActiveWorkbenchShell() != null) {
|
||||
return getActiveWorkbenchShell();
|
||||
|
|
Loading…
Add table
Reference in a new issue