List of usage examples for org.eclipse.jface.dialogs MessageDialog openConfirm
public static boolean openConfirm(Shell parent, String title, String message)
From source file:com.aptana.ide.intro.IntroStartup.java
License:Open Source License
/** * Install any missing features/*from w ww. j a v a 2 s .c o m*/ */ protected void installFeatures() { final IPreferenceStore store = IntroPlugin.getDefault().getPreferenceStore(); boolean check = store.getBoolean(IPreferenceConstants.INSTALL_PRO_AND_REQUIRED_FEATURES); if (!check) { return; } List<FeatureDescriptor> features = new ArrayList<FeatureDescriptor>(); List<IPlugin> installedFeatures = FeatureUtil.getInstalledFeatures(); String[] installedFeatureIds = new String[installedFeatures.size()]; int index = 0; for (IPlugin feature : installedFeatures) { installedFeatureIds[index++] = feature.getId(); } // Using the list of installed and ignored features, filter out // possible install items that were previously ignored, or would // conflict with currently installed items. String[] ignored = store.getString(IPreferenceConstants.IGNORE_INSTALL_FEATURES).split(","); //$NON-NLS-1$ final List<FeatureDescriptor> featuresToInstall = new ArrayList<FeatureDescriptor>(); for (Iterator<FeatureDescriptor> iterator = features.iterator(); iterator.hasNext();) { FeatureDescriptor featureDescriptor = iterator.next(); if (!FeatureRegistry.isFeatureIgnored(featureDescriptor.getId(), ignored) && !FeatureRegistry.doesFeatureConflict(featureDescriptor, installedFeatureIds)) { featuresToInstall.add(featureDescriptor); } } // Don't show dialog if user has previously opted not to see if // again if (featuresToInstall.size() > 0 && !store.getString(IPreferenceConstants.HIDE_DIALOG_INSTALL_PROMPT) .equals(MessageDialogWithToggle.NEVER)) { String tmp_str = ""; //$NON-NLS-1$ for (FeatureDescriptor featureDesc : featuresToInstall) { tmp_str += "\n\t" + featureDesc.getName(); //$NON-NLS-1$ } final String str_features = tmp_str; UIJob job = new UIJob(Messages.IntroStartup_Job_InstallFeatures) { public IStatus runInUIThread(IProgressMonitor monitor) { int returnCode = DialogUtils.openIgnoreMessageDialogConfirm( Display.getCurrent().getActiveShell(), Messages.IntroStartup_InstallTitle, MessageFormat.format(Messages.IntroStartup_InstallMessage, str_features), store, IPreferenceConstants.HIDE_DIALOG_INSTALL_PROMPT); if (returnCode == MessageDialog.CANCEL) { return Status.OK_STATUS; } new FeatureInstallJob(featuresToInstall).schedule(0); return Status.OK_STATUS; } }; job.setRule(MutexJobRule.getInstance()); job.schedule(20000); } final List<FeatureDescriptor> featuresToUpdate = FeatureRegistry.gatherInstalledRequiredFeatures(); if (featuresToUpdate.size() > 0) { final StringBuilder featureToUpdateStr = new StringBuilder(); for (FeatureDescriptor featureDesc : featuresToUpdate) { featureToUpdateStr.append("\n\t" + featureDesc.getName()); //$NON-NLS-1$ } UIJob job = new UIJob(Messages.IntroStartup_Job_UpdateFeatures) { public IStatus runInUIThread(IProgressMonitor monitor) { boolean returnCode = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), Messages.IntroStartup_UpdateTitle, MessageFormat .format(Messages.IntroStartup_UpdateMessage, featureToUpdateStr.toString())); if (!returnCode) { return Status.OK_STATUS; } new FeatureInstallJob(featuresToUpdate).schedule(0); return Status.OK_STATUS; } }; job.setRule(MutexJobRule.getInstance()); job.schedule(20000); } }
From source file:com.aptana.ide.scripting.Global.java
License:Open Source License
/** * Popup an confirm box with the specified message * /* ww w . jav a 2s . c om*/ * @param message * The message to display at the confirmation prompt * @return boolean */ public boolean confirm(final String message) { /** * inner class for result */ class Answer { public boolean result = false; } // create instance of inner class final Answer a = new Answer(); // get reply from user final Display currentDisplay = Display.getCurrent(); if (currentDisplay != null) { currentDisplay.syncExec(new Runnable() { public void run() { Shell shell = currentDisplay.getActiveShell(); if (shell != null) { a.result = MessageDialog.openConfirm(shell, "Aptana Studio", message); //$NON-NLS-1$ } } }); } return a.result; }
From source file:com.aptana.ide.syncing.ui.dialogs.SiteConnectionsEditorDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { Composite dialogArea = (Composite) super.createDialogArea(parent); setTitle(Messages.SiteConnectionsEditorDialog_Title); setMessage(Messages.SiteConnectionsEditorDialog_Message); Composite container = new Composite(dialogArea, SWT.NONE); container.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); container.setLayout(GridLayoutFactory.swtDefaults() .margins(convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN), convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN)) .spacing(convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING), convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING)) .create());/* ww w .j a v a 2s . c om*/ SashForm sashForm = new SashForm(container, SWT.HORIZONTAL); sashForm.setLayoutData(GridDataFactory.fillDefaults().hint(SWT.DEFAULT, 400).grab(true, true).create()); /* column 1 - the list of connections */ Group group = new Group(sashForm, SWT.NONE); group.setText(Messages.SiteConnectionsEditorDialog_LBL_ConnectionGroup); group.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); group.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).create()); sitesViewer = new ListViewer(group, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); sitesViewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(2, 1).create()); sitesViewer.setContentProvider(ArrayContentProvider.getInstance()); sitesViewer.setLabelProvider(new SitesLabelProvider()); sitesViewer.setComparator(new SitesSorter()); sitesViewer.setInput(sites); addButton = new Button(group, SWT.PUSH); addButton.setLayoutData(GridDataFactory.swtDefaults().create()); addButton.setImage(SWTUtils.getImage(UIPlugin.getDefault(), "/icons/add.gif")); //$NON-NLS-1$ addButton.setToolTipText(StringUtil.ellipsify(CoreStrings.ADD)); removeButton = new Button(group, SWT.PUSH); removeButton.setLayoutData(GridDataFactory.swtDefaults().create()); removeButton.setImage(SWTUtils.getImage(UIPlugin.getDefault(), "/icons/delete.gif")); //$NON-NLS-1$ removeButton.setToolTipText(CoreStrings.REMOVE); /* column 2 - the details of the selected connection */ Composite composite = new Composite(sashForm, SWT.NONE); composite.setLayout(GridLayoutFactory.fillDefaults().create()); sitePropertiesWidget = new SiteConnectionPropertiesWidget(composite, SWT.NONE, this); sitePropertiesWidget.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); sitePropertiesWidget.setSource(null); sashForm.setWeights(new int[] { 30, 70 }); /* -- */ sitesViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { ISiteConnection selection = (ISiteConnection) ((IStructuredSelection) event.getSelection()) .getFirstElement(); if (selection != sitePropertiesWidget.getSource()) { if (doSelectionChange()) { sitePropertiesWidget.setSource(selection); } else { sitesViewer.setSelection(new StructuredSelection(sitePropertiesWidget.getSource()), true); } } removeButton.setEnabled( !event.getSelection().isEmpty() && selection != DefaultSiteConnection.getInstance()); } }); MenuManager menuManager = new MenuManager(); createActions(menuManager); sitesViewer.getControl().setMenu(menuManager.createContextMenu(sitesViewer.getControl())); addButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (doSelectionChange()) { setCreateNew(Messages.SiteConnectionsEditorDialog_LBL_NewConnection, null, null); } else { sitesViewer.setSelection(new StructuredSelection(sitePropertiesWidget.getSource()), true); } } }); removeButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (!sitesViewer.getSelection().isEmpty()) { if (MessageDialog.openConfirm(getShell(), Messages.SiteConnectionsEditorDialog_DeleteConfirm_Title, Messages.SiteConnectionsEditorDialog_DeleteConfirm_Message)) { ISiteConnection selection = (ISiteConnection) ((IStructuredSelection) sitesViewer .getSelection()).getFirstElement(); int newSelectionIndex = sitesViewer.getList().getSelectionIndex() - 1; SyncingPlugin.getSiteConnectionManager().removeSiteConnection(selection); sites.remove(selection); sitePropertiesWidget.setSource(null); sitesViewer.refresh(); if (newSelectionIndex > -1 && newSelectionIndex < sitesViewer.getList().getItemCount()) { setSelection((newSelectionIndex == 0) ? DefaultSiteConnection.getInstance() : sites.get(newSelectionIndex - 1)); } } } } }); return dialogArea; }
From source file:com.aptana.ide.syncing.ui.wizards.SyncExportPage.java
License:Open Source License
/** * @return true if operation succeeded//from w w w . j a v a 2 s .c o m */ public boolean performFinish() { String path = pathText.getText(); boolean overwrite = overwriteButton.getSelection(); File file = new File(path); if (file.exists()) { if (!overwrite) { if (!MessageDialog.openConfirm(getShell(), Messages.SyncExportPage_Overwrite, StringUtils.format(Messages.SyncExportPage_Confirm_Overwrite, file.getAbsolutePath()))) { return false; } } if (!file.canWrite()) { MessageDialog.openError(pathText.getShell(), Messages.SyncExportPage_Error, StringUtils.format(Messages.SyncExportPage_NOT_WRITABLE, file.getAbsolutePath())); return false; } } // CoreIOPlugin.getConnectionPointManager().saveState(new Path(path)); SyncingPlugin.getSiteConnectionManager().saveState(new Path(path)); getPreferenceStore().setValue(IPreferenceConstants.EXPORT_INITIAL_PATH, path); getPreferenceStore().setValue(IPreferenceConstants.EXPORT_OVEWRITE_FILE_WITHOUT_WARNING, overwrite); return true; }
From source file:com.aptana.ide.ui.io.actions.DeleteConnectionAction.java
License:Open Source License
public void run(IAction action) { IConnectionPoint[] connections = getSelectedConnectionPoints(); if (connections.length == 0) { return;/*ww w . j a va 2 s . co m*/ } final List<IConnectionPoint> connectionsToDelete = new ArrayList<IConnectionPoint>(); for (IConnectionPoint connection : connections) { if (MessageDialog.openConfirm(UIUtils.getActiveShell(), Messages.DeleteConnectionAction_Confirm_Title, MessageFormat.format(Messages.DeleteConnectionAction_Confirm_Message, connection))) { connectionsToDelete.add(connection); } } Job job = new Job(Messages.DeleteConnectionAction_DeletingConnections) { @Override protected IStatus run(IProgressMonitor monitor) { for (IConnectionPoint connection : connectionsToDelete) { monitor.subTask(MessageFormat.format(Messages.DeleteConnectionAction_Deleting, connection)); CoreIOPlugin.getConnectionPointManager().removeConnectionPoint(connection); if (connection.canDisconnect()) { try { connection.disconnect(monitor); } catch (CoreException e) { IdeLog.logError(IOUIPlugin.getDefault(), Messages.DeleteConnectionAction_FailedToDisconnect, e); } } } return Status.OK_STATUS; } }; job.setUser(true); job.setPriority(Job.LONG); job.setRule((ISchedulingRule) connectionPoint.getAdapter(ISchedulingRule.class)); job.schedule(); }
From source file:com.aptana.ide.ui.io.IOUIPlugin.java
License:Open Source License
/** * Watches the local file for changes and saves it back to the original remote file when the editor is saved. * //from ww w.jav a2 s . c om * @param editorPart * the editor part the file is opened on */ private void attachSaveListener(final IEditorPart editorPart) { final IEditorInput editorInput = editorPart.getEditorInput(); if (!(editorInput instanceof UniformFileStoreEditorInput) || !((UniformFileStoreEditorInput) editorInput).isRemote()) { // the original is a local file; no need to re-save it return; } editorPart.addPropertyListener(new IPropertyListener() { public void propertyChanged(Object source, int propId) { if (propId == EditorPart.PROP_DIRTY && source instanceof EditorPart) { EditorPart ed = (EditorPart) source; if (ed.isDirty()) { return; } Job job = saveRemoteJobs.get(editorInput); if (job != null) { // a job saving the remote file is already running return; } job = new Job(Messages.EditorUtils_MSG_RemotelySaving + ed.getPartName()) { protected IStatus run(final IProgressMonitor monitor) { UniformFileStoreEditorInput input = (UniformFileStoreEditorInput) editorInput; final IFileStore localCacheFile = input.getLocalFileStore(); IFileStore originalFile = input.getFileStore(); IFileInfo originalFileInfo = input.getFileInfo(); try { IFileInfo currentFileInfo = originalFile.fetchInfo(EFS.NONE, monitor); if (currentFileInfo.exists() && (currentFileInfo.getLastModified() != originalFileInfo.getLastModified() || currentFileInfo.getLength() != originalFileInfo.getLength())) { if (!UIUtils.showPromptDialog(Messages.EditorUtils_OverwritePrompt_Title, MessageFormat.format(Messages.EditorUtils_OverwritePrompt_Message, originalFile.getName()))) { return Status.CANCEL_STATUS; } } SyncUtils.copy(localCacheFile, null, originalFile, EFS.NONE, monitor); } catch (final CoreException e) { // save failed; offers user to save the file locally instead final String filename = originalFile.getName(); UIUtils.getDisplay().asyncExec(new Runnable() { public void run() { if (MessageDialog.openConfirm(UIUtils.getActiveShell(), MessageFormat.format( Messages.IOUIPlugin_ErrorSavingRemoteFile_Title, filename), MessageFormat.format( Messages.IOUIPlugin_ErrorSavingRemoteFile_Message, e.getLocalizedMessage()))) { FileDialog dialog = new FileDialog(UIUtils.getActiveShell(), SWT.SAVE); dialog.setFileName(filename); String filepath = dialog.open(); if (filepath != null) { IFileStore localFileStore = EFS.getLocalFileSystem() .fromLocalFile(new File(filepath)); try { SyncUtils.copy(localCacheFile, null, localFileStore, EFS.NONE, monitor); } catch (CoreException e1) { UIUtils.showErrorMessage(MessageFormat.format( Messages.IOUIPlugin_ErrorSavingRemoteFile_Title, filename), e); } } } } }); } finally { // update cached remote file info try { input.setFileInfo(originalFile.fetchInfo(EFS.NONE, monitor)); } catch (CoreException e) { IdeLog.logWarning(IOUIPlugin.getDefault(), e); } } return Status.OK_STATUS; } }; saveRemoteJobs.put(editorInput, job); job.addJobChangeListener(new JobChangeAdapter() { public void done(IJobChangeEvent event) { saveRemoteJobs.remove(editorInput); }; }); job.schedule(); } } }); }
From source file:com.aptana.ide.ui.io.navigator.actions.NewExternalFileWizard.java
License:Open Source License
@Override public boolean performFinish() { final IFileStore parentStore = getSelectedDirectory(); final IFileStore newFile = parentStore.getChild(mainPage.getFileName()); if (Utils.exists(newFile)) { if (!MessageDialog.openConfirm(getShell(), Messages.NewFileAction_Confirm_Title, Messages.NewFileAction_Confirm_Message)) { return false; }/*from ww w .j av a 2 s . c om*/ } final InputStream in = getInitialContents(Path.fromOSString(newFile.toString())); // run the file creation in a job Job job = new Job(Messages.NewFileAction_JobTitle) { @Override protected IStatus run(IProgressMonitor monitor) { try { OutputStream out = newFile.openOutputStream(EFS.NONE, monitor); if (in != null) { // creates the initial contents try { IOUtil.pipe(in, out); } catch (IOException e) { IdeLog.logError(IOUIPlugin.getDefault(), e); } finally { try { in.close(); } catch (IOException e) { IdeLog.logError(IOUIPlugin.getDefault(), e); } } } try { out.close(); } catch (IOException e) { IdeLog.logError(IOUIPlugin.getDefault(), e); } // opens it in the editor EditorUtils.openFileInEditor(newFile, null); // refreshes the parent folder final IFileStore fileStore = Utils.getFileStore(selectedElement); boolean selectionIsDirectory = Utils.isDirectory(selectedElement); if (selectionIsDirectory) { IOUIPlugin.refreshNavigatorView(selectedElement); } else { IOUIPlugin.refreshNavigatorView(fileStore.getParent()); } } catch (CoreException e) { showError(e); } return Status.OK_STATUS; } }; job.setUser(true); job.schedule(); return true; }
From source file:com.aptana.syncing.ui.wizards.ExportConnectionsWizard.java
License:Open Source License
@Override public boolean performFinish() { IPath path = mainPage.getLocation(); boolean isOverwriting = mainPage.isOverwritingExistingFile(); // saves the preferences IEclipsePreferences prefs = EclipseUtil.instanceScope().getNode(SyncingUIPlugin.PLUGIN_ID); prefs.put(IPreferenceConstants.EXPORT_INITIAL_PATH, path.toOSString()); prefs.putBoolean(IPreferenceConstants.EXPORT_OVEWRITE_FILE_WITHOUT_WARNING, isOverwriting); try {/*from w ww. j a v a2s .c o m*/ prefs.flush(); } catch (BackingStoreException e) { IdeLog.logError(SyncingUIPlugin.getDefault(), Messages.ExportConnectionsWizard_ERR_FailSaveExportPrefs, e); } File file = path.toFile(); if (file.exists()) { if (!isOverwriting) { if (!MessageDialog.openConfirm(getShell(), Messages.ExportConnectionsWizard_Overwrite_Title, MessageFormat.format(Messages.ExportConnectionsWizard_Overwrite_Message, file.getAbsolutePath()))) { return false; } } if (!file.canWrite()) { MessageDialog.openError(getShell(), Messages.ExportConnectionsWizard_Error_Title, MessageFormat .format(Messages.ExportConnectionsWizard_Error_Message, file.getAbsolutePath())); return false; } } CoreIOPlugin.getConnectionPointManager().saveState(path); return true; }
From source file:com.aptana.theme.preferences.ThemePreferencePage.java
License:Open Source License
public void widgetSelected(SelectionEvent e) { Object source = e.getSource(); if (source == fInvasiveThemeCheckbox) { IEclipsePreferences prefs = EclipseUtil.instanceScope().getNode(ThemePlugin.PLUGIN_ID); prefs.putBoolean(IPreferenceConstants.APPLY_TO_ALL_VIEWS, fInvasiveThemeCheckbox.getSelection()); try {//from ww w . j a v a 2 s. c o m prefs.flush(); } catch (BackingStoreException e1) { IdeLog.logError(ThemePlugin.getDefault(), e1); } } else if (source == fAptanaEditorsOnlyCheckbox) { IEclipsePreferences prefs = EclipseUtil.instanceScope().getNode(ThemePlugin.PLUGIN_ID); prefs.putBoolean(IPreferenceConstants.APPLY_TO_ALL_EDITORS, fAptanaEditorsOnlyCheckbox.getSelection()); try { prefs.flush(); } catch (BackingStoreException e1) { IdeLog.logError(ThemePlugin.getDefault(), e1); } } else if (source == fInvasiveFontCheckbox) { IEclipsePreferences prefs = EclipseUtil.instanceScope().getNode(ThemePlugin.PLUGIN_ID); prefs.putBoolean(IPreferenceConstants.INVASIVE_FONT, fInvasiveFontCheckbox.getSelection()); try { prefs.flush(); } catch (BackingStoreException e1) { IdeLog.logError(ThemePlugin.getDefault(), e1); } } else if (source == fThemeCombo) { setTheme(fThemeCombo.getText()); } else if (source == fAddThemeButton) { // Pop a dialog to ask for new name InputDialog dialog = new InputDialog(getShell(), Messages.ThemePreferencePage_NewThemeTitle, Messages.ThemePreferencePage_NewThemeMsg, getUniqueNewThemeName(fSelectedTheme.getName()), this); if (dialog.open() == Window.OK) { Theme newTheme = getTheme().copy(dialog.getValue()); // Add theme to theme list, make current theme this one getThemeManager().setCurrentTheme(newTheme); loadThemeNames(); setTheme(newTheme.getName()); } } else if (source == renameThemeButton) { // Pop a dialog to ask for new name InputDialog dialog = new InputDialog(getShell(), Messages.ThemePreferencePage_RenameThemeTitle, Messages.ThemePreferencePage_RenameThemeMsg, fSelectedTheme.getName(), this); if (dialog.open() == Window.OK) { Theme oldTheme = getTheme(); Theme newTheme = oldTheme.copy(dialog.getValue()); getThemeManager().setCurrentTheme(newTheme); oldTheme.delete(); loadThemeNames(); setTheme(newTheme.getName()); } } else if (source == deleteThemeButton) { boolean ok = MessageDialog.openConfirm(getShell(), MessageFormat.format(Messages.ThemePreferencePage_DeleteThemeTitle, fSelectedTheme.getName()), MessageFormat.format(Messages.ThemePreferencePage_DeleteThemeMsg, fSelectedTheme.getName())); if (ok) { getTheme().delete(); loadThemeNames(); setTheme(getThemeManager().getCurrentTheme().getName()); } } else if (source == fImportButton) { FileDialog fileDialog = new FileDialog(getShell(), SWT.OPEN); IDialogSettings editorSettings = ThemePlugin.getDefault().getDialogSettings(); String value = editorSettings.get(THEME_DIRECTORY); if (value != null) { fileDialog.setFilterPath(value); } fileDialog.setFilterExtensions(new String[] { "*.tmTheme" }); //$NON-NLS-1$ String path = fileDialog.open(); if (path == null) { return; } File themeFile = new File(path); editorSettings.put(THEME_DIRECTORY, themeFile.getParent()); Theme theme = new TextmateImporter().convert(themeFile); if (theme != null) { getThemeManager().addTheme(theme); getThemeManager().setCurrentTheme(theme); loadThemeNames(); setTheme(theme.getName()); } else { // FIXME Show an error dialog? } } else if (source == fExportButton) { FileDialog fileDialog = new FileDialog(getShell(), SWT.SAVE); IDialogSettings editorSettings = ThemePlugin.getDefault().getDialogSettings(); String value = editorSettings.get(THEME_EXPORT_DIRECTORY); if (value != null) { fileDialog.setFilterPath(value); } fileDialog.setFileName(getTheme().getName() + ".tmTheme"); //$NON-NLS-1$ String path = fileDialog.open(); if (path == null) { return; } File themeFile = new File(path); editorSettings.put(THEME_EXPORT_DIRECTORY, themeFile.getParent()); new ThemeExporter().export(themeFile, getTheme()); } else if (source == fAddTokenButton) { // Add a new row to the table by adding a basic token to the theme Theme theme = getTheme(); String newName = "untitled"; //$NON-NLS-1$ // Insert into the rules at the index after current selection in table! int index = tableViewer.getTable().getSelectionIndex(); if (index == -1) { index = tableViewer.getTable().getItemCount(); } else { index++; } theme.addNewDefaultToken(index, newName); setTheme(fSelectedTheme); // Have the new addition in an edit mode Object newElement = tableViewer.getElementAt(index); if (newElement != null) { tableViewer.editElement(newElement, 0); fScopeText.setText(""); //$NON-NLS-1$ } } else if (source == fRemoveTokenButton) { TableItem[] items = tableViewer.getTable().getSelection(); if (items == null || items.length == 0) { return; } Theme theme = getTheme(); for (TableItem tableItem : items) { ThemeRule entry = (ThemeRule) tableItem.getData(); theme.remove(entry); } theme.save(); setTheme(fSelectedTheme); } else if (source == tableViewer.getTable()) { TableItem item = (TableItem) e.item; ThemeRule token = (ThemeRule) item.getData(); fScopeText.setText(token.getScopeSelector().toString()); } }
From source file:com.aptana.ui.internal.commands.ClearLogCommandHandler.java
License:Open Source License
public Object execute(ExecutionEvent event) throws ExecutionException { String logFile = System.getProperty("osgi.logfile"); //$NON-NLS-1$ if (!MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), Messages.ClearLogConfirmTitle, Messages.ClearLogConfirmDescription)) { return null; }/* w w w . j a v a2s. c om*/ FileOutputStream outputStream = null; try { outputStream = new FileOutputStream(new File(logFile)); } catch (Exception e) { IdeLog.logError(UIPlugin.getDefault(), e); } finally { if (outputStream != null) { try { outputStream.close(); } catch (IOException e) { // ignores the exception } } } return null; }