eclipse plugin: use the new "thread-safe" messagebox showing
This commit is contained in:
parent
2392e8ac80
commit
bfc9cc8b24
4 changed files with 11 additions and 17 deletions
|
@ -13,6 +13,7 @@ import wesnoth_eclipse_plugin.Activator;
|
|||
import wesnoth_eclipse_plugin.builder.ExternalToolInvoker;
|
||||
import wesnoth_eclipse_plugin.preferences.PreferenceConstants;
|
||||
import wesnoth_eclipse_plugin.preferences.PreferenceInitializer;
|
||||
import wesnoth_eclipse_plugin.utils.GUIUtils;
|
||||
import wesnoth_eclipse_plugin.utils.WorkspaceUtils;
|
||||
|
||||
public class EditorActions
|
||||
|
@ -27,9 +28,7 @@ public class EditorActions
|
|||
|
||||
if (editorPath.isEmpty())
|
||||
{
|
||||
MessageBox box = new MessageBox(Activator.getShell());
|
||||
box.setMessage(String.format("Please set the wesnoth's executable path first."));
|
||||
box.open();
|
||||
GUIUtils.showMessageBox(WorkspaceUtils.getWorkbenchWindow(), "Please set the wesnoth's executable path first.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,10 +4,9 @@ import org.eclipse.core.commands.AbstractHandler;
|
|||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
|
||||
import wesnoth_eclipse_plugin.Activator;
|
||||
import wesnoth_eclipse_plugin.globalactions.MapActions;
|
||||
import wesnoth_eclipse_plugin.utils.GUIUtils;
|
||||
import wesnoth_eclipse_plugin.utils.WorkspaceUtils;
|
||||
|
||||
public class ImportMapHandler extends AbstractHandler
|
||||
|
@ -26,9 +25,8 @@ public class ImportMapHandler extends AbstractHandler
|
|||
|
||||
if (!selectedFolder.getName().equals("maps"))
|
||||
{
|
||||
MessageBox box = new MessageBox(Activator.getShell());
|
||||
box.setMessage("You need to select a \"maps\" folder before importing anything");
|
||||
box.open();
|
||||
GUIUtils.showMessageBox(WorkspaceUtils.getWorkbenchWindow(),
|
||||
"You need to select a \"maps\" folder before importing anything");
|
||||
}
|
||||
|
||||
return (selectedFolder != null && selectedFolder.getName().equals("maps"));
|
||||
|
|
|
@ -4,10 +4,9 @@ import org.eclipse.core.commands.AbstractHandler;
|
|||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
|
||||
import wesnoth_eclipse_plugin.Activator;
|
||||
import wesnoth_eclipse_plugin.globalactions.EditorActions;
|
||||
import wesnoth_eclipse_plugin.utils.GUIUtils;
|
||||
import wesnoth_eclipse_plugin.utils.WorkspaceUtils;
|
||||
|
||||
public class OpenMapHandler extends AbstractHandler
|
||||
|
@ -18,9 +17,7 @@ public class OpenMapHandler extends AbstractHandler
|
|||
IFile selectedFile = WorkspaceUtils.getSelectedFile(WorkspaceUtils.getWorkbenchWindow());
|
||||
if (!selectedFile.getName().endsWith(".map"))
|
||||
{
|
||||
MessageBox box = new MessageBox(Activator.getShell());
|
||||
box.setMessage("Please select a .map file");
|
||||
box.open();
|
||||
GUIUtils.showMessageBox(WorkspaceUtils.getWorkbenchWindow(),"Please select a .map file");
|
||||
return null;
|
||||
}
|
||||
EditorActions.startEditor(selectedFile.getLocation().toOSString());
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.eclipse.jface.viewers.ISelection;
|
|||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.wizard.IWizardPage;
|
||||
import org.eclipse.jface.wizard.Wizard;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
import org.eclipse.ui.INewWizard;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
|
@ -33,6 +32,8 @@ import org.eclipse.ui.ide.IDE;
|
|||
|
||||
import wesnoth_eclipse_plugin.ReplaceableParameter;
|
||||
import wesnoth_eclipse_plugin.TemplateProvider;
|
||||
import wesnoth_eclipse_plugin.utils.GUIUtils;
|
||||
import wesnoth_eclipse_plugin.utils.WorkspaceUtils;
|
||||
|
||||
/**
|
||||
* This is a sample new wizard. Its role is to create a new file
|
||||
|
@ -183,9 +184,8 @@ public class ScenarioNewWizard extends Wizard implements INewWizard {
|
|||
|
||||
if (template == null)
|
||||
{
|
||||
MessageBox box = new MessageBox(this.getShell());
|
||||
box.setMessage(String.format("Template for \"scenario\" not found."));
|
||||
box.open();
|
||||
GUIUtils.showMessageBox(WorkspaceUtils.getWorkbenchWindow(),
|
||||
"Template for \"scenario\" not found.");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue