List of usage examples for org.eclipse.jface.dialogs MessageDialog openWarning
public static void openWarning(Shell parent, String title, String message)
From source file:com.astra.ses.spell.gui.model.commands.SaveDictionary.java
License:Open Source License
/*************************************************************************** * The command has been executed, so extract extract the needed information * from the application context.//from ww w .j a va2 s.c o m **************************************************************************/ public CommandResult execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); String procId = event.getParameter(ARG_PROCID); String dictname = event.getParameter(ARG_DICTNAME); String path = event.getParameter(ARG_PATH); if (dictname != null && procId != null && path != null) { try { IContextProxy proxy = (IContextProxy) ServiceManager.get(IContextProxy.class); proxy.saveDataContainer(procId, dictname, path); } catch (ContextError ex) { MessageDialog.openWarning(window.getShell(), "Error retrieving dictionary", ex.getMessage()); return CommandResult.FAILED; } } return CommandResult.SUCCESS; }
From source file:com.astra.ses.spell.gui.model.commands.ShowReleaseInfo.java
License:Open Source License
public CommandResult execute(ExecutionEvent event) throws ExecutionException { // Search the release information file String spellData = System.getenv("SPELL_DATA"); if (spellData == null) { spellData = System.getenv("SPELL_HOME") + System.getProperty("file.separator") + "data"; }/*from ww w. ja va2 s . c om*/ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); String path = ""; // Try to find file in different cases File dir = new File(spellData); File releaseFile = null; String[] children = dir.list(); if (children != null) { for (int i = 0; i < children.length; i++) { // Get filename of file or directory String filename = children[i]; if (filename.toLowerCase().equals("release.txt")) { path = spellData + System.getProperty("file.separator") + filename; releaseFile = new File(path); break; } } } if ((releaseFile != null) && (releaseFile.exists() && releaseFile.canRead())) { ReleaseInfoDialog dialog = new ReleaseInfoDialog(window.getShell(), path); dialog.open(); return CommandResult.SUCCESS; } else { MessageDialog.openWarning(window.getShell(), "Release Information", "No release information available\n'" + path + "'"); return CommandResult.NO_EFFECT; } }
From source file:com.astra.ses.spell.gui.model.jobs.ConnectServerJob.java
License:Open Source License
public void run(IProgressMonitor monitor) { ServerProxy proxy = (ServerProxy) ServiceManager.get(ServerProxy.ID); ConfigurationManager cfg = (ConfigurationManager) ServiceManager.get(ConfigurationManager.ID); if (proxy.isConnected()) { MessageDialog.openWarning(m_window.getShell(), "Connect to server", "Already connected to server"); result = CommandResult.NO_EFFECT; } else {/* www .j a v a2 s .co m*/ try { ServerInfo info = (ServerInfo) cfg.getSelection(IConfig.ID_SERVER_SELECTION); if (info != null) { monitor.setTaskName("Connecting to server"); if (info.getUser() != null) { // Ask the user for password StringDialog dialog = new StringDialog(m_window.getShell(), "Tunneled connection to " + info.getName(), "Access to this server requires secure access", "Access to this server requires secure access\n" + "please enter password for user '" + info.getUser() + "'", true); int dresult = dialog.open(); if (dresult == StringDialog.CANCEL) { MessageDialog.openError(m_window.getShell(), "Connect to server", "Cannot connect to server without password"); result = CommandResult.FAILED; monitor.done(); return; } String password = dialog.getAnswer(); info.setPwd(password); } proxy.changeServer(info); proxy.connect(); result = CommandResult.SUCCESS; } else { MessageDialog.openWarning(m_window.getShell(), "Connect to server", "No server selected"); result = CommandResult.NO_EFFECT; } } catch (ServerError err) { MessageDialog.openError(m_window.getShell(), "Connect to server", "Cannot connect to server:\n\n" + err.getLocalizedMessage()); result = CommandResult.FAILED; } catch (Exception e) { e.printStackTrace(); result = CommandResult.FAILED; } } monitor.done(); }
From source file:com.astra.ses.spell.gui.model.jobs.ControlRemoteProcedureJob.java
License:Open Source License
@Override public void performTask(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { IProcedureManager mgr = (IProcedureManager) ServiceManager.get(IProcedureManager.class); try {/*from w w w .j a v a 2s . co m*/ Logger.debug("Controlling procedure task for " + m_instanceId, Level.PROC, this); monitor.setTaskName("Control procedure " + m_instanceId); AsRunReplayResult ar = new AsRunReplayResult(); mgr.controlProcedure(m_instanceId, ar, monitor); Logger.info("Monitoring process finished: " + ar.status, Level.GUI, this); Logger.info("Cancel flag : " + monitor.isCanceled(), Level.GUI, this); Logger.info("Monitoring process message : " + ar.message, Level.GUI, this); if (ar.status.equals(AsRunProcessing.PARTIAL)) { if (monitor.isCanceled()) { String message = "Retrieval of ASRUN information was not complete: canceled by user"; MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Control Procedure", message); result = CommandResult.CANCELLED; } else { String message = "Retrieval of ASRUN information was not complete: " + ar.message; MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Control Procedure", message); result = CommandResult.SUCCESS; } } else if (ar.status.equals(AsRunProcessing.FAILED)) { String message = "Retrieval of ASRUN information failed: " + ar.message; MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Control Procedure", message); result = CommandResult.FAILED; } else { result = CommandResult.SUCCESS; } Logger.debug("Controlling procedure task for " + m_instanceId + " success", Level.PROC, this); } catch (LoadFailed ex) { ex.printStackTrace(); message = "Could not control procedure:\n\n" + ex.getLocalizedMessage(); result = CommandResult.FAILED; } catch (NotConnected ex) { message = "Could not control procedure, not connected to context"; result = CommandResult.FAILED; } monitor.done(); }
From source file:com.astra.ses.spell.gui.model.jobs.MonitorRemoteProcedureJob.java
License:Open Source License
@Override public void performTask(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { IProcedureManager mgr = (IProcedureManager) ServiceManager.get(IProcedureManager.class); try {// w w w . j av a 2 s . co m monitor.setTaskName("Monitoring procedure " + m_instanceId); AsRunReplayResult ar = new AsRunReplayResult(); mgr.monitorProcedure(m_instanceId, ar, monitor); if (ar.status.equals(AsRunProcessing.PARTIAL)) { if (monitor.isCanceled()) { String message = "Retrieval of ASRUN information was not complete: canceled by user"; MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Monitor Procedure", message); result = CommandResult.CANCELLED; } else { String message = "Retrieval of ASRUN information was not complete: " + ar.message; MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Monitor Procedure", message); result = CommandResult.SUCCESS; } } else if (ar.status.equals(AsRunProcessing.FAILED)) { String message = "Retrieval of ASRUN information failed: " + ar.message; MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Monitor Procedure", message); result = CommandResult.FAILED; } else { result = CommandResult.SUCCESS; } } catch (LoadFailed ex) { ex.printStackTrace(); message = "Could not monitor procedure:\n\n" + ex.getLocalizedMessage(); result = CommandResult.FAILED; } catch (NotConnected ex) { message = "Could not monitor procedure, not connected to context"; result = CommandResult.FAILED; } monitor.done(); }
From source file:com.astra.ses.spell.gui.model.jobs.StartContextJob.java
License:Open Source License
@Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); ServerProxy proxy = (ServerProxy) ServiceManager.get(ServerProxy.ID); ConfigurationManager cfg = (ConfigurationManager) ServiceManager.get(ConfigurationManager.ID); ContextInfo info = (ContextInfo) cfg.getSelection(IConfig.ID_CONTEXT_SELECTION); if (info == null) { MessageDialog.openWarning(window.getShell(), "Start context", "Cannot start context: no context selected"); result = CommandResult.NO_EFFECT; }/* w ww. j ava 2 s . c o m*/ if (!proxy.isConnected()) { MessageDialog.openWarning(window.getShell(), "Start context", "Cannot start context, not connected to server"); result = CommandResult.FAILED; } else { try { monitor.setTaskName("Starting context " + info.getName()); proxy.openContext(info.getName()); result = CommandResult.SUCCESS; } catch (ServerError ex) { MessageDialog.openError(window.getShell(), "Start context", "Cannot start context:\n\n" + ex.getLocalizedMessage()); result = CommandResult.FAILED; } } monitor.done(); }
From source file:com.astra.ses.spell.gui.model.jobs.StopContextJob.java
License:Open Source License
@Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); ServerProxy proxy = (ServerProxy) ServiceManager.get(ServerProxy.ID); ConfigurationManager cfg = (ConfigurationManager) ServiceManager.get(ConfigurationManager.ID); ContextInfo info = (ContextInfo) cfg.getSelection(IConfig.ID_CONTEXT_SELECTION); if (info == null) { MessageDialog.openWarning(window.getShell(), "Stop context", "Cannot stop context: no context selected"); result = CommandResult.NO_EFFECT; }//ww w. ja v a 2s . c o m if (!info.isRunning()) { MessageDialog.openWarning(window.getShell(), "Stop context", "Context already stopped"); result = CommandResult.NO_EFFECT; } else { try { monitor.setTaskName("Stopping context " + info.getName()); proxy.closeContext(info.getName()); result = CommandResult.SUCCESS; } catch (ServerError ex) { MessageDialog.openError(window.getShell(), "Stop context", "Cannot stop context:\n\n" + ex.getLocalizedMessage()); result = CommandResult.FAILED; } } monitor.done(); }
From source file:com.astra.ses.spell.gui.services.ViewManager.java
License:Open Source License
@Override public void procedureModelUnloaded(String instanceId, boolean doneLocally) { if (m_procViewList.containsKey(instanceId)) { if (!doneLocally) { Shell shell = m_procViewList.get(instanceId).getSite().getShell(); MessageDialog.openWarning(shell, "Procedure closed", "Procedure '" + instanceId + "' has been closed by the controlling client"); }/*from w w w . j av a2s .c o m*/ m_procViewList.get(instanceId).setCloseMode(ProcedureView.CloseMode.NONE); closeProcedureView(instanceId); } }
From source file:com.astra.ses.spell.gui.views.controls.master.executors.ExecutorComposite.java
License:Open Source License
@Override public void notifyRemoteProcedureOpen(String procId, String guiKey) { Logger.debug("Procedure open: " + procId, Level.GUI, this); refresh();//from w w w .ja va 2 s . c om if (!guiKey.equals(s_proxy.getClientKey())) { if (!s_procMgr.getOpenLocalProcedures().isEmpty()) { MessageDialog.openWarning(getShell(), "Procedure Open", "Another procedure has been open in the current context.\n\n" + "It could interfere with the operations being performed\n" + "by your procedures.\n\n" + "It should be recommended to check the Master View for details."); } } }
From source file:com.atlassian.connector.eclipse.team.ui.TeamUiMessageUtils.java
License:Open Source License
private static void internalOpenUnsupportedTeamProviderErrorMessage( final UnsupportedTeamProviderException exception) { String message = NLS.bind("Unsupported team provider ({0}).\n\n" + "Supported team providers are:\n" + StringUtils.join(TeamUiUtils.getSupportedTeamConnectors(), ", ") + "\nSee the " + " web site for future updates.", exception.getMessage()); MessageDialog.openWarning(null, MESSAGE_DIALOG_TITLE, message); }