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.nokia.s60ct.gui.editors.ConfigurationBrowser.java
License:Open Source License
private void checkUndefinedTypes() { for (Resource resource : editingDomain.getResourceSet().getResources()) { try {// ww w . jav a 2 s. com Object obj = resource.getContents().get(0); if (obj instanceof RootConf) { RootConf rootConf = (RootConf) obj; for (Setting setting : rootConf.getAllSettings()) { if (setting.getType().getValue() == TYPE.UNDEFINED_VALUE) { IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); MessageDialog.openWarning(workbenchWindow.getShell(), getString("_UI_Warning_title"), getString("_UI_UndefinedTypeWarning_message")); return; } } } } catch (Exception exception) { } } }
From source file:com.nokia.s60tools.compatibilityanalyser.ui.dialogs.BaselineEditor.java
License:Open Source License
/** * To check the details entered by the user are correct or not. * @return/*from ww w.ja v a 2s.c om*/ */ public boolean isProfileDataCorrect() { boolean value = true; if (sdkCmb.getItemCount() == 0) { MessageDialog.openWarning(Display.getCurrent().getActiveShell(), Messages.getString("BaselineEditor.Warning"), //$NON-NLS-1$ Messages.getString("BaselineEditor.NOSDKsInstalledError")); //$NON-NLS-1$ value = false; } else if (sdkCmb.getText().length() == 0) { MessageDialog.openWarning(Display.getCurrent().getActiveShell(), Messages.getString("BaselineEditor.Warning"), //$NON-NLS-1$ "No SDK selected. Please select a SDK from the list"); //$NON-NLS-1$ value = false; } else if (versionCmb.getText().length() == 0) { MessageDialog.openWarning(Display.getCurrent().getActiveShell(), Messages.getString("BaselineEditor.Warning"), Messages.getString("BaselineEditor.SelectS60Version")); value = false; } else if (radio_Hdr_dir.getSelection() == true && hdr_dir_list.getItemCount() == 0) { MessageDialog.openWarning(Display.getCurrent().getActiveShell(), Messages.getString("BaselineEditor.Warning"), Messages.getString("BaselineEditor.InvalidHdrDirectory")); value = false; } else if (radio_build_target.getSelection() && list_build_Config.getSelectionCount() == 0) { MessageDialog.openWarning(Display.getCurrent().getActiveShell(), Messages.getString("BaselineEditor.Warning"), Messages.getString("BaselineEditor.SelectBuildConfig")); value = false; } else if (radio_dir_Libs.getSelection() == true && dso_dir_list.getItemCount() == 0) { MessageDialog.openWarning(Display.getCurrent().getActiveShell(), Messages.getString("BaselineEditor.Warning"), Messages.getString("BaselineEditor.InvalidLibraryDirectory")); value = false; } else if (radio_dir_Libs.getSelection() == true && dll_dir_list.getItemCount() == 0) { MessageDialog.openWarning(Display.getCurrent().getActiveShell(), Messages.getString("BaselineEditor.Warning"), Messages.getString("BaselineEditor.InvalidDllDirectory")); value = false; } return value; }
From source file:com.nokia.s60tools.compatibilityanalyser.ui.dialogs.BaselineEditor.java
License:Open Source License
/** * It retrieves all the details entered by the user. And stores them in local file system using * seriealization.//from w w w .ja v a 2s. com * */ public void saveProfile() { BaselineProfile profile = new BaselineProfile(); if (profileCmb.getText().length() == 0) { MessageDialog.openWarning(Display.getCurrent().getActiveShell(), Messages.getString("BaselineEditor.Warning"), //$NON-NLS-1$ Messages.getString("BaselineEditor.InvalidProfileName")); //$NON-NLS-1$ return; } profile.setProfileName(profileCmb.getText()); profile.setSdkName(sdkCmb.getText()); profile.setS60version(versionCmb.getText()); profile.setSdkEpocRoot(sdkItems[sdkCmb.getSelectionIndex()].getEPOCROOT()); if (radio_default_Hdr.getSelection() == true) { profile.setRadio_default_hdr(radio_default_Hdr.getSelection()); } else { profile.setRadio_default_hdr(false); profile.setRadio_dir_hdr(radio_Hdr_dir.getSelection()); profile.setHdr_dir_path(hdr_dir_list.getItems()); } if (list_systemInc.getItemCount() > 0) profile.setSystemInc_dirs(list_systemInc.getItems()); if (forced_hdrs_list.getItemCount() > 0) profile.setForced_headers(forced_hdrs_list.getItems()); if (radio_default_build_target.getSelection()) { profile.setRadio_default_build_target(true); profile.setRadio_build_target(false); profile.setRadio_dir_libs(false); } else if (radio_build_target.getSelection()) { profile.setRadio_build_target(true); profile.setRadio_default_build_target(false); profile.setRadio_dir_libs(false); int selected_platforms = list_build_Config.getSelectionCount(); if (selected_platforms > 0) { profile.setBuild_config(list_build_Config.getSelection()); ISymbianSDK selectedSdk = CompatibilityAnalyserPlugin.fetchLoadedSdkList() .get(sdkCmb.getSelectionIndex()); String[] lib_dirs = new String[selected_platforms]; String[] dll_dirs = new String[selected_platforms]; for (int i = 0; i < selected_platforms; i++) { lib_dirs[i] = CompatibilityAnalyserEngine.getLibsPathFromPlatform(selectedSdk, profile.getBuild_config()[i]); dll_dirs[i] = CompatibilityAnalyserEngine.getDllPathFromPlatform(selectedSdk, profile.getBuild_config()[i]); } profile.setLib_dir(lib_dirs); profile.setDll_dir(dll_dirs); } } else { profile.setRadio_default_build_target(false); profile.setRadio_build_target(false); profile.setRadio_dir_libs(radio_dir_Libs.getSelection()); profile.setLib_dir(dso_dir_list.getItems()); profile.setDll_dir(dll_dir_list.getItems()); } BaselineProfileUtils.saveProfileOnFileSystem(profile); }
From source file:com.nokia.s60tools.creator.dialogs.AbstractDialog.java
License:Open Source License
/** * Show an warning dialog/*from w ww.j a va2s.com*/ * @param title * @param message */ protected void showWarningDialog(String title, String message) { Shell sh; if (getShell() != null) { try { sh = getShell(); } catch (SWTException e) { sh = CreatorActivator.getCurrentlyActiveWbWindowShell(); } } else { sh = CreatorActivator.getCurrentlyActiveWbWindowShell(); } MessageDialog.openWarning(sh, title, message); }
From source file:com.nokia.sdt.symbian.workspace.impl.DesignFileDeletedJob.java
License:Open Source License
IStatus handleRootDesignDeleted(IProgressMonitor monitor) { IFile designFile = specifier.getModelFile(); if (!WorkbenchUtils.isJUnitRunning()) { String title = Messages.getString("DesignerDataModelSpecifier.dialogTitle"); //$NON-NLS-1$ String fmt = Messages.getString("DesignerDataModelSpecifier.deleteRootModelWarning"); //$NON-NLS-1$ Object params[] = { designFile.getFullPath().toString() }; String msg = MessageFormat.format(fmt, params); MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), title, msg); }//from w w w . j av a 2 s . c o m specifier.dispose(); return Status.OK_STATUS; }
From source file:com.nokia.sdt.symbian.workspace.impl.DesignFileMovedJob.java
License:Open Source License
IStatus handleRootDesignMoved(IProgressMonitor monitor) { if (!WorkbenchUtils.isJUnitRunning()) { String title = Messages.getString("DesignerDataModelSpecifier.dialogTitle"); //$NON-NLS-1$ String fmt = Messages.getString("DesignerDataModelSpecifier.moveRootModelWarning"); //$NON-NLS-1$ IFile designFile = specifier.getModelFile(); Object params[] = { designFile.getFullPath().toString() }; String msg = MessageFormat.format(fmt, params); MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), title, msg); }/*w w w. jav a 2 s. co m*/ specifier.dispose(); return Status.OK_STATUS; }
From source file:com.nokia.tools.s60.editor.actions.ConvertAndEditSVGInBitmapEditorAction.java
License:Open Source License
@Override public void doRun(Object element) { final Object _element = element; IPreferenceStore iPreferenceStore = ((AbstractUIPlugin) UtilsPlugin.getDefault()).getPreferenceStore(); boolean ask = !iPreferenceStore.getBoolean(IMediaConstants.PREF_SILENT_SVG_CONVERSION); final IImageHolder holder = getImageHolder(_element); // changed loadImages to true to generate raw image. final ILayer layer = getLayer(true, _element); final IAnimationFrame frame = (IAnimationFrame) (element instanceof IAnimationFrame ? element : null); final boolean _layer = layer != null, _holder = holder != null, _animation = frame != null && !_holder; final boolean _animatedParent = _layer && layer.getParent() instanceof IAnimatedImage; try {//from ww w .j ava 2 s . c o m int result = Window.OK; SVG2BitmapConversionConfirmationDialog dialog = null; Rectangle rect = new Rectangle(); if (ask) { // display warning dialog about conversion Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); if (_layer) { AbstractGraphicalEditPart _ep = null; if (sizeFromEditPart) { _ep = getGraphicalEditPart(_element); } if (_ep != null && !layer.getParent().isPart()) { Rectangle nr = _ep.getFigure().getBounds(); rect.width = nr.width; rect.height = nr.height; } else { rect.width = layer.getParent().getWidth(); rect.height = layer.getParent().getHeight(); } dialog = new SVG2BitmapConversionConfirmationDialog(shell, rect, layer.supportMask(), layer.supportSoftMask(), true); } else if (_holder) { rect.width = holder.getWidth(); rect.height = holder.getHeight(); dialog = new SVG2BitmapConversionConfirmationDialog(shell, rect, true, true, true); } else if (_animation) { rect.width = frame.getWidth(); rect.height = frame.getHeight(); dialog = new SVG2BitmapConversionConfirmationDialog(shell, rect, false, false, true); } result = dialog.open(); } else { if (_layer) { if (_layer && getGraphicalEditPart(_element) != null && !layer.getParent().isPart()) { Rectangle nr = ((AbstractGraphicalEditPart) getGraphicalEditPart(_element)).getFigure() .getBounds(); rect.width = nr.width; rect.height = nr.height; } else { rect.width = layer.getParent().getWidth(); rect.height = layer.getParent().getHeight(); } } else if (_holder) { rect.width = holder.getWidth(); rect.height = holder.getHeight(); } else if (_animation) { rect.width = frame.getWidth(); rect.height = frame.getHeight(); } } if (result == Window.OK) { int w = rect.width, h = rect.height; if (dialog != null) { w = dialog.getSelectedWidth(); h = dialog.getSelectedHeight(); } boolean _keepMask = !ask ? (iPreferenceStore.getBoolean(IMediaConstants.PREF_SVG_CONVERSION_PRESERVE_MASK)) : dialog.isMaskPreserve(); // ask' = true if (!ask && !iPreferenceStore.getBoolean(IMediaConstants.PREF_SVG_CONVERSION_PRESERVE_MASK)) { _keepMask = true; } // if elements don't supports mask, keepMask = false if (_layer && !_animatedParent) if (!layer.supportMask() && !layer.supportSoftMask()) _keepMask = false; final boolean keepMask = _keepMask; CoreImage rasterized = CoreImage.create(); if (_layer) { // convert SVG to appropriate dimensions IImage img = layer.getParent().getAnotherInstance(w, h); rasterized.init(img.getLayer(layer.getName()).getRAWImage()); // special processing for colour indication items try { IContentData icd = getContentData(element); ISkinnableEntityAdapter ska = (ISkinnableEntityAdapter) icd .getAdapter(ISkinnableEntityAdapter.class); if (ska.isColourIndication()) { rasterized.extractMaskForColourIndicationItem().invertSingleBandMask(); } } catch (Exception e) { e.printStackTrace(); } } else if (_holder) { rasterized.init(holder.getRAWImage(w, h, false)); } else if (_animation) { rasterized.init(frame.getRAWImage(false)); } CoreImage _mask = null; if (keepMask) { // extract mask try { _mask = rasterized.copy().extractMask(true); if (_layer && !layer.supportSoftMask() && !_animatedParent) { _mask = _mask.convertSoftMaskToHard(true); } } catch (Exception es) { es.printStackTrace(); } if (_mask == null) { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); MessageDialog.openWarning(shell, "Warning", Messages.ExtractMaskAction_error); } } final RenderedImage extractedMask = (_mask == null) ? (null) : (_mask.getAwt()); // remove transparency from image - paint on white BG rasterized.reduceToThreeBand(); RunnableWithParameter callback = new BaseRunnable() { public void run() { if (_holder) { if (getParameter() != null) { EditPart ep = getEditPart(_element); execute(new UndoableImageHolderActionCommand(holder, new Runnable() { public void run() { try { holder.paste(getParameter(), null); if (keepMask) { holder.pasteMask(extractedMask); } } catch (Exception e) { e.printStackTrace(); } } }), ep); } } else if (_layer) { // called from animation editor try { if (_animatedParent) { ((IAnimatedImage) layer.getParent()).getAnimationFrames()[0] .paste(getParameter(), null); } else { layer.paste(getParameter()); } if (keepMask) { if (_animatedParent) { ((IAnimatedImage) layer.getParent()).getAnimationFrames()[0] .pasteMask(extractedMask); } else { layer.pasteMask(extractedMask); } } if (getContentData(_element) != null) { updateGraphicWithCommand(layer, _element); } } catch (Exception e) { e.printStackTrace(); } } else if (_animation) { if (getParameter() != null) { try { frame.paste(getParameter(), null); if (keepMask) { frame.pasteMask(extractedMask); } } catch (Exception e) { e.printStackTrace(); } } } } }; if (_layer) { paintProcessThreads .add(FileChangeWatchThread.open3rdPartyEditor(IMediaConstants.PREF_BITMAP_EDITOR, rasterized.getAwt(), layer.getParent().getId(), callback, true)); } else if (_holder) { String prefix = holder.getImageFile().getName().substring(0, holder.getImageFile().getName().lastIndexOf('.')); paintProcessThreads.add(FileChangeWatchThread.open3rdPartyEditor(null, rasterized.getAwt(), prefix, callback, true)); } else if (_animation) { String prefix = frame.getParent().getId() + frame.getSeqNo(); paintProcessThreads.add(FileChangeWatchThread.open3rdPartyEditor( IMediaConstants.PREF_BITMAP_EDITOR, rasterized.getAwt(), prefix, callback, true)); } } } catch (Throwable e) { handleProcessException(e); } }
From source file:com.nokia.tools.s60ct.confml.actions.AddSequenceItemAction.java
License:Open Source License
@Override public void run() { // if (everySecondEvent == false) { // everySecondEvent = true; // return;//from w w w. java 2s.co m // } // everySecondEvent = false; IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); if (page != null) { IEditorPart activeEditor = page.getActiveEditor(); ConfmlEditor editor = null; if (activeEditor != null && activeEditor instanceof ConfmlEditor) { editor = (ConfmlEditor) activeEditor; CommandStack commandStack = editor.getCommandStack(); ISelection selection = editor.getSelection(); int position = -1; if (selection instanceof StructuredSelection) { StructuredSelection structuredSelection = (StructuredSelection) selection; Object[] selections = structuredSelection.toArray(); for (int i = 0; i < selections.length; i++) { Object next = selections[i]; if (next instanceof ESetting) { // WRONG HERE!!! ESetting setting = (ESetting) next; EObject container = setting.eContainer(); if (container instanceof ESequenceValueItemImpl) { ESequenceSetting si = (ESequenceSetting) setting.eContainer(); ESequenceSetting sqSetting = (ESequenceSetting) si.eContainer(); int index = sqSetting.getSubTypes().indexOf(si); if (position < index) { position = index; } } } } } Object data = widget.getData(); ((SequenceWidget) widget).setCollapsed(false); if (data instanceof ESequenceSettingImpl) { ESequenceSettingImpl eSeqSetImpl = (ESequenceSettingImpl) data; ESequenceValueItem template = ((ESequenceValue) eSeqSetImpl.getDefaultValue()).getTemplate(); int realPosition = 0; if (template == null && eSeqSetImpl.getItems().size() > 0) { // template = eSeqSetImpl.getItems().get(0); template = ((ESequenceValue) eSeqSetImpl.getDefaultValue()).getItems().get(0); } if (template != null) { ESequenceValueItem templateCopy = (ESequenceValueItem) EcoreUtil.copy(template); templateCopy.setEditable(true); URIEditorInput editorInput = (URIEditorInput) editor.getEditorInput(); URI editorUri = editorInput.getURI(); templateCopy .setFrameLocationUri(URI.createURI(editorUri.scheme() + ":" + editorUri.path())); realPosition = (position == -1) ? eSeqSetImpl.getItems().size() : position + 1; Command addCommand = new AddSequenceItemCommand(eSeqSetImpl, templateCopy, realPosition); commandStack.execute(addCommand); final ConfmlEditor finalEditor = editor; Display.getCurrent().asyncExec(new Runnable() { public void run() { finalEditor.getViewer().refresh(); } }); } else { MessageDialog.openWarning(widget.getShell(), "Warning", "Sequence setting doesn't have tepmlate or any data."); } /* * * ESubSettingValue settingToSelect = * eSeqSetImpl.getItems(). * get(realPosition).getSubSettings().get(0); * StructuredSelection structuredSelection = new * StructuredSelection( settingToSelect); * editor.setSelection(structuredSelection); */ } } } }
From source file:com.nokia.tools.s60ct.report.dialog.ReportDialog.java
License:Open Source License
private void generateReport() { try {//ML // View project = getProject(); EConfMLLayer layer = getLastLayer(); //if (project instanceof View) { //ML // View view = project; System.out.println("Creating ReportGenerator!"); //ML ReportGenerator rg = new ReportGenerator(); System.out.println("Creating ReportGenerator DONE"); //ML rg.setKeyword(((filter & ReportGenerator.TEXT_FILTER) != 0) ? keywordField.getText() : null); //ML String report = rg.generate(layer, filter, iPreferenceStore.getString(PROP_FILE_PATH)); if (report != null) { File f = new File(iPreferenceStore.getString(PROP_FILE_PATH)); try { FileOutputStream fo = new FileOutputStream(f); fo.write(report.getBytes()); fo.close();//from w ww. ja v a 2 s. com if ((filter & 64) == 0) { MessageDialog.openInformation(getShell(), "Report created", "Report was successfully created to your specified location."); } if (rg.canOpen(filter)) { try { Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL " + f); } catch (IOException e1) { e1.printStackTrace(); } } } catch (IOException e) { MessageDialog.openInformation(getShell(), "File not found", "File can not be opened."); } } else { MessageDialog.openWarning(getShell(), "Report not created", "Report was not created, because no setting meets given criteria."); } // storeDialogSettings(); ReportPlugin.getSelectedProject().refreshLocal(IResource.DEPTH_ONE, null); // } //ML } catch (Exception e) {//ML e.printStackTrace(); } }
From source file:com.nokia.tools.theme.s60.parser.ThemeDetailsParser.java
License:Open Source License
/** * Parses the xml file for general information. Called by both parseLean and * parseFat functions// w w w. j a v a2 s.c o m * * @param theme The S60Theme object in which the gathered information is * stored. * @throws ThemeAppParserException If not able to successfully parse the xml * file. */ public Theme parseLean() throws ThemeException { Set<String> modelIds = getModelIds(); if (model == null) { int i = 0; IThemeModelDescriptor descriptor = null; for (String modelId : modelIds) { descriptor = ThemePlatform.getThemeModelDescriptorById(modelId); if (descriptor != null) { break; } i++; } if (descriptor == null) { descriptor = ThemePlatform.getDefaultThemeModelDescriptor(IThemeConstants.THEME_CONTAINER_ID); } if (descriptor == null) { // shows the error messages in the UI environment throw new ThemeException(Messages.Theme_Configuration_Error); } if (i != 0) { final String msg = NLS.bind(Messages.Theme_Configuration_Warning_Message, new Object[] { modelIds.isEmpty() ? "" : modelIds.iterator().next(), descriptor.getId() }); // this warning will be propagated to the caller final org.eclipse.swt.widgets.Display display = org.eclipse.swt.widgets.Display.getDefault(); display.syncExec(new Runnable() { public void run() { // make sure we're in the GUI mode Shell shell = display.getActiveShell(); if (shell != null) { MessageDialog.openWarning(shell, Messages.Theme_Configuration_Warning_Title, msg); } } }); } model = ThemePlatform.getThemeManagerByThemeModelId(descriptor.getId()).getModel(descriptor.getId(), monitor); theme = (Theme) model.clone(); } else { theme = model; } theme.setThemeFile(FileUtils.getFile(url)); // Get the name of the skin (it is an attribute of the root element // itself) Map<Object, Object> rootAttr = DomHelperFunctions.getAttributes(document.getDocumentElement()); theme.setAttribute(rootAttr); String name = (String) rootAttr.get(ThemeTag.ATTR_ENG_NAME); theme.setThemeName(name); return theme; }