List of usage examples for org.eclipse.jface.dialogs MessageDialog openError
public static void openError(Shell parent, String title, String message)
From source file:br.unb.cic.rtgoretoprism.action.RunJadexAgentAction.java
License:Open Source License
public void run(IAction action) { //get current shell Shell shell = targetPart.getSite().getShell(); //get the path to the Jadex library directory String bx = AgentTemplateCreatorPlugin.getDefault().getPluginPreferences() .getString(AgentTemplateCreatorPlugin.JADEX_BASE_PATH) + "/"; try {/* w w w . j ava 2 s . c o m*/ //Note: this should be generalized String folderName = selectedFolder.getName(); //we expect something like BASIC_AGENT_PACKAGE_PREFIX_XXX //get the name of the agent to be started String agentName = folderName.substring(PathLocation.BASIC_AGENT_PACKAGE_PREFIX.length()); //get the corresponding bin directory (with classes file) of this source one (src). This //assume that the project use the bin/src directory (as good practices suggest...) String bin = "\"" + selectedFolder.getProject().getFolder("bin").getLocation().toString() + "\""; // .toOSString(); //construct the required CLASSPATH path (at least the one for //Jade 3.4 and Jadex 0.96). //Note: this should be really generalized String libs = ".;\"" + bx + "jadeTools.jar" + "\";\"" + bx + "jade.jar" + "\";\"" + bx + "iiop.jar" + "\";\"" + bx + "http.jar" + "\";\"" + bx + "commons-codec-1.3.jar" + "\";\"" + bx + "jadex_rt.jar" + "\";\"" + bx + "jadex_jadeadapter.jar" + "\";\"" + bx + "jibx-run.jar" + "\";\"" + bx + "jadex_rt.jar" + "\";\"" + bx + "xpp3.jar" + "\";\"" + bx + "GraphLayout.jar" + "\";\"" + bx + "jhall.jar" + "\";\"" + bx + "jadex_tools.jar\""; //launch the agent in a new container String cmd = "java -cp " + libs + ";" + bin + " jade.Boot -container My" + agentName + ":jadex.adapter.jade.JadeAgentAdapter(" + folderName + "." + agentName + " default)"; //get the output console for this agent MessageConsole myConsole = ConsoleUtil.findConsole(agentName); MessageConsoleStream out = myConsole.newMessageStream(); //run the process Spawn spawn = new Spawn(cmd, out, out); spawn.start(); } catch (Exception e) { MessageDialog.openError(shell, "Error starting the selected Agent", e.toString()); } }
From source file:ca.edchipman.silverstripepdt.dialogs.FilteredTypesSelectionDialog.java
License:Open Source License
protected void setResult(List newResult) { List resultToReturn = new ArrayList(); for (int i = 0; i < newResult.size(); i++) { if (newResult.get(i) instanceof TypeNameMatch) { IType type = ((TypeNameMatch) newResult.get(i)).getType(); if (type.exists()) { // items are added to history in the // org.eclipse.ui.dialogs.FilteredItemsSelectionDialog#computeResult() // method resultToReturn.add(type); } else { TypeNameMatch typeInfo = (TypeNameMatch) newResult.get(i); IProjectFragment root = typeInfo.getProjectFragment(); IDLTKUILanguageToolkit uiToolkit = DLTKUILanguageManager .getLanguageToolkit(fToolkit.getNatureId()); ScriptElementLabels labels = uiToolkit.getScriptElementLabels(); String containerName = labels.getElementLabel(root, ScriptElementLabels.ALL_FULLY_QUALIFIED); String message = Messages.format(DLTKUIMessages.FilteredTypesSelectionDialog_dialogMessage, new String[] { typeInfo.getFullyQualifiedName(), containerName }); MessageDialog.openError(getShell(), fTitle, message); getSelectionHistory().remove(typeInfo); }//from w w w .j a v a 2 s .co m } } super.setResult(resultToReturn); }
From source file:ca.mcgill.cs.swevo.qualyzer.ApplicationWorkbenchWindowAdvisor.java
License:Open Source License
@Override public void postWindowCreate() { PreferenceManager pm = PlatformUI.getWorkbench().getPreferenceManager(); pm.remove("net.sf.colorer.eclipse.PreferencePage"); //$NON-NLS-1$ IPreferenceNode node = pm.remove("org.eclipse.ui.preferencePages.Workbench"); //$NON-NLS-1$ for (IPreferenceNode sub : node.getSubNodes()) { if (sub.getId().equals("org.eclipse.ui.preferencePages.Keys")) //$NON-NLS-1$ {/*from www . ja v a2s . c om*/ pm.addToRoot(sub); } } String upgradeMessage = QualyzerActivator.getDefault().getUpgradeMessage(); if (upgradeMessage != null) { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); boolean error = QualyzerActivator.getDefault().isUpgradeMessageError(); if (error) { MessageDialog.openError(shell, Messages.getString("QualyzerActivator.upgradedTitle"), //$NON-NLS-1$ upgradeMessage); //$NON-NLS-1$ } else { MessageDialog.openInformation(shell, Messages.getString("QualyzerActivator.upgradedTitle"), //$NON-NLS-1$ upgradeMessage); } } }
From source file:ca.mcgill.cs.swevo.qualyzer.dialogs.TranscriptPropertiesDialog.java
License:Open Source License
@Override public void okPressed() { save();/* ww w.j a va2 s. c om*/ if (fAudioPath.startsWith(fProjectName + File.separator + "audio" + File.separator)) //$NON-NLS-1$ { IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(fProjectName); fAudioPath = project.getLocation() + fAudioPath.substring(fAudioPath.indexOf(File.separatorChar)); } File file = new File(fAudioPath); if (fAudioPath.isEmpty() || file.exists()) { super.okPressed(); } else { MessageDialog.openError(getShell(), Messages.getString("dialogs.TranscriptPropertiesDialog.fileError"), //$NON-NLS-1$ Messages.getString("dialogs.TranscriptPropertiesDialog.doesNotExist")); //$NON-NLS-1$ } }
From source file:ca.mcgill.cs.swevo.qualyzer.editors.pages.CodeEditorPage.java
License:Open Source License
/** * Handles the selection of the Delete Code Action on the table. * Checks if there are any memos stopping the deletion. * Then finds all the fragments that contain the code. * Displays a warning/confirmation.//from w w w .j av a 2 s .c o m * Removes the code from all associated fragments and then deletes the code. * @return */ private SelectionAdapter deleteCodeSelected() { return new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection selection = (IStructuredSelection) fTableViewer.getSelection(); Code toDelete = ((CodeTableRow) selection.getFirstElement()).getCode(); List<Memo> hardConflicts = detectHardConflicts(toDelete); if (!hardConflicts.isEmpty()) { String message = buildErrorString(hardConflicts); MessageDialog.openError(getSite().getShell(), Messages.getString("editors.pages.CodeEditorPage.unableToDelete"), message); //$NON-NLS-1$ return; } List<Fragment> conflicts = detectConflicts(toDelete); boolean check = false; check = MessageDialog.openConfirm(getSite().getShell(), DELETE_CODE, getConfirmMessage(conflicts.size())); if (check && conflicts.size() > 0) { removeCodeFromFragments(toDelete, conflicts); } if (check) { Facade.getInstance().deleteCode(toDelete); CommonNavigator view = (CommonNavigator) PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getActivePage().findView(QualyzerActivator.PROJECT_EXPLORER_VIEW_ID); view.getCommonViewer().refresh(); } } }; }
From source file:ca.mcgill.cs.swevo.qualyzer.editors.TranscriptEditor.java
License:Open Source License
@Override public void createPartControl(Composite parent) { //This controls displaying of the top button bar. parent.setLayout(new GridLayout(1, true)); fTopBar = new Composite(parent, SWT.BORDER); fTopBar.setLayoutData(new GridData(SWT.FILL, SWT.NULL, true, false)); fTopBar.setLayout(new GridLayout(NUM_COLS, false)); createFormatButtonBar(fTopBar);//w w w. j av a 2 s . c om createMusicBar(fTopBar); super.createPartControl(parent); parent.getChildren()[1].setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); if (((Transcript) getDocument()).getAudioFile() == null) { setEnable(fTopBar, false); fAudioPlayer = null; } else { Transcript trans = (Transcript) getDocument(); IProject project = ResourcesPlugin.getWorkspace().getRoot() .getProject(trans.getProject().getFolderName()); String audioFile = project.getLocation() + File.separator + trans.getAudioFile().getRelativePath(); try { fAudioPlayer = new AudioPlayer(audioFile, this); } catch (QualyzerException e) { MessageDialog.openError(getSite().getShell(), Messages.getString("editors.TranscriptEditor.audioPlayerError"), e.getMessage()); //$NON-NLS-1$ setEnable(fTopBar, false); } } hookupButtonActions(); Facade.getInstance().getListenerManager().registerTranscriptListener(getDocument().getProject(), this); }
From source file:ca.mcgill.cs.swevo.qualyzer.editors.TranscriptEditor.java
License:Open Source License
private void openErrorDialog(String errorMessage) { MessageDialog.openError(getSite().getShell(), Messages.getString("editors.TranscriptEditor.audioError"), //$NON-NLS-1$ errorMessage);//from w ww . ja v a 2s. co m }
From source file:ca.mcgill.cs.swevo.qualyzer.handlers.DeleteInvestigatorHandler.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); CommonNavigator view = (CommonNavigator) page.findView(QualyzerActivator.PROJECT_EXPLORER_VIEW_ID); ISelection selection = view.getCommonViewer().getSelection(); Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); if (selection != null && selection instanceof IStructuredSelection) { List<String> conflicts = new ArrayList<String>(); List<Investigator> toDelete = new ArrayList<Investigator>(); List<Project> projects = new ArrayList<Project>(); for (Object element : ((IStructuredSelection) selection).toArray()) { if (element instanceof Investigator) { Investigator investigator = (Investigator) element; Project project = investigator.getProject(); if (!projects.contains(project)) { projects.add(project); }//from w ww .ja va 2 s.c o m conflicts.addAll(checkForConflicts(investigator)); toDelete.add(investigator); } } if (projects.size() > 1) { MessageDialog.openError(shell, Messages.getString("handlers.DeleteInvestigatorHandler.deleteFailed"), //$NON-NLS-1$ Messages.getString("handlers.DeleteInvestigatorHandler.multipleProjects")); //$NON-NLS-1$ } else if (projects.get(0).getInvestigators().size() == toDelete.size()) { MessageDialog.openError(shell, Messages.getString("handlers.DeleteInvestigatorHandler.deleteFailed"), //$NON-NLS-1$ Messages.getString("handlers.DeleteInvestigatorHandler.tooManyInves")); //$NON-NLS-1$ } else if (conflicts.size() > 0) { String errorMsg = printErrors(conflicts); MessageDialog.openError(shell, Messages.getString("handlers.DeleteInvestigatorHandler.cannotDelete"), errorMsg); //$NON-NLS-1$ } else { proceedWithDeletion(page, shell, toDelete); } } return null; }
From source file:ca.mcgill.cs.swevo.qualyzer.handlers.DeleteMemoHandler.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); CommonNavigator view = (CommonNavigator) page.findView(QualyzerActivator.PROJECT_EXPLORER_VIEW_ID); ISelection selection = view.getCommonViewer().getSelection(); Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); if (selection != null && selection instanceof IStructuredSelection) { List<Memo> toDelete = new ArrayList<Memo>(); List<Project> projects = new ArrayList<Project>(); for (Object element : ((IStructuredSelection) selection).toArray()) { if (element instanceof Memo) { Memo memo = (Memo) element; if (!projects.contains(memo.getProject())) { projects.add(memo.getProject()); }//ww w . j a va 2s . co m toDelete.add(memo); } } if (projects.size() > 1) { String warningMessage = Messages.getString("handlers.DeleteMemoHandler.tooManyProjects"); //$NON-NLS-1$ fLogger.warn(warningMessage); MessageDialog.openError(shell, Messages.getString("handlers.DeleteMemoHandler.unableToDelete"), //$NON-NLS-1$ warningMessage); } else { proceedWithDeletion(page, shell, toDelete); } } return null; }
From source file:ca.mcgill.cs.swevo.qualyzer.handlers.DeleteParticipantHandler.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); CommonNavigator view = (CommonNavigator) page.findView(QualyzerActivator.PROJECT_EXPLORER_VIEW_ID); ISelection selection = view.getCommonViewer().getSelection(); Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); if (selection != null && selection instanceof IStructuredSelection) { List<String> conflicts = new ArrayList<String>(); List<Participant> toDelete = new ArrayList<Participant>(); List<Project> projects = new ArrayList<Project>(); for (Object element : ((IStructuredSelection) selection).toArray()) { if (element instanceof Participant) { Participant participant = (Participant) element; Project project = participant.getProject(); if (!projects.contains(project)) { projects.add(project); }//from ww w. j a v a2 s . c om conflicts.addAll(checkForConflicts(participant, project)); toDelete.add(participant); } } if (projects.size() > 1) { MessageDialog.openError(shell, Messages.getString("handlers.DeleteParticipantHandler.deleteFailed"), //$NON-NLS-1$ Messages.getString("handlers.DeleteParticipantHandler.multipleProjects")); //$NON-NLS-1$ } else if (conflicts.size() > 0) { String errorMsg = printErrors(conflicts); MessageDialog.openError(shell, Messages.getString("handlers.DeleteParticipantHandler.cannotDelete"), //$NON-NLS-1$ errorMsg); } else { proceedWithDeletion(page, shell, toDelete); } } return null; }