List of usage examples for org.eclipse.jface.dialogs MessageDialog openQuestion
public static boolean openQuestion(Shell parent, String title, String message)
From source file:com.liferay.ide.project.ui.upgrade.animated.UpgradeView.java
License:Open Source License
private void restartUpgradeTool() { boolean openNewLiferayProjectWizard = MessageDialog.openQuestion(UIUtil.getActiveShell(), "Restart code upgrade?", "All previous configuration files will be deleted. Do you want to restart the code upgrade tool?"); if (openNewLiferayProjectWizard) { CustomJspConverter.clearConvertResults(); try {// ww w. j a va 2 s. c om MigrationProblemsContainer container = UpgradeAssistantSettingsUtil .getObjectFromStore(MigrationProblemsContainer.class); if (container != null) { UpgradeAssistantSettingsUtil.setObjectToStore(MigrationProblemsContainer.class, null); } } catch (IOException excepiton) { ProjectUI.logError(excepiton); } IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); UpgradeView view = (UpgradeView) UIUtil.findView(UpgradeView.ID); CustomJspConverter.clearConvertResults(); page.hideView(view); UpgradeSettingsUtil.resetStoreProperties(); try { page.showView(UpgradeView.ID); } catch (PartInitException e1) { e1.printStackTrace(); } } }
From source file:com.liferay.ide.project.ui.wizard.ValidProjectChecker.java
License:Open Source License
public void checkValidProjectTypes() { IProject[] projects = CoreUtil.getAllProjects(); boolean hasValidProjectTypes = false; boolean hasJsfFacet = false; for (IProject project : projects) { if (ProjectUtil.isLiferayFacetedProject(project)) { Set<IProjectFacetVersion> facets = ProjectUtil.getFacetedProject(project).getProjectFacets(); if (validProjectTypes != null && facets != null) { String[] validTypes = validProjectTypes.split(StringPool.COMMA); for (String validProjectType : validTypes) { for (IProjectFacetVersion facet : facets) { String id = facet.getProjectFacet().getId(); if (isJsfPortlet && id.equals("jst.jsf")) //$NON-NLS-1$ {/*from ww w . j a va2 s. c om*/ hasJsfFacet = true; } if (id.startsWith("liferay.") && id.equals("liferay." + validProjectType)) //$NON-NLS-1$ //$NON-NLS-2$ { hasValidProjectTypes = true; } } } } } } if (isJsfPortlet) { hasValidProjectTypes = hasJsfFacet && hasValidProjectTypes; } if (!hasValidProjectTypes) { final Shell activeShell = Display.getDefault().getActiveShell(); Boolean openNewLiferayProjectWizard = MessageDialog.openQuestion(activeShell, NLS.bind(Msgs.newElement, wizardName), NLS.bind(Msgs.noSuitableLiferayProjects, wizardName)); if (openNewLiferayProjectWizard) { final Action defaultAction = NewPluginProjectDropDownAction.getPluginProjectAction(); if (defaultAction != null) { defaultAction.run(); this.checkValidProjectTypes(); } } } }
From source file:com.liferay.ide.sdk.ui.InstalledSDKsCompostite.java
License:Open Source License
protected void removeSelectedSDKs() { IStructuredSelection selection = (IStructuredSelection) getSelection(); SDK[] selectedSdks = new SDK[selection.size()]; Iterator<?> iterator = selection.iterator(); int i = 0;//from w w w .j a va 2 s .c om while (iterator.hasNext()) { SDK sdk = null; Object next = iterator.next(); if (next instanceof SDK) { sdk = (SDK) next; } else if (next instanceof IStructuredSelection) { sdk = (SDK) ((IStructuredSelection) next).getFirstElement(); } selectedSdks[i++] = sdk; } List<SDK> sdksList = Arrays.asList(selectedSdks); // IDE-6 check to make sure that no existing projects use this SDK List<SDK> sdksToRemove = new ArrayList<SDK>(); sdksToRemove.addAll(sdksList); List<SDK> checkedSDks = new ArrayList<SDK>(); IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); for (IProject project : projects) { SDK sdk = SDKUtil.getSDK(project); if (sdksList.contains(sdk)) { if (checkedSDks.contains(sdk)) { continue; } else { boolean remove = MessageDialog.openQuestion(this.getShell(), Msgs.installedSDKs, MessageFormat.format(Msgs.sdkRemovalConfirmation, sdk.getName())); if (!remove) { sdksToRemove.remove(sdk); } checkedSDks.add(sdk); } } } removeSDKs(sdksToRemove.toArray(new SDK[sdksToRemove.size()])); }
From source file:com.liferay.ide.server.ui.ServerStartup.java
License:Open Source License
private AbstractNotification createImportGlobalSettingsNotification() { final Date date = new Date(); return new AbstractUiNotification("com.liferay.ide.server.ui.importglobalsettings") { @SuppressWarnings({ "rawtypes", "unchecked" }) public Object getAdapter(Class adapter) { return null; }//w w w . j ava 2 s. com @Override public Date getDate() { return date; } @Override public String getDescription() { return "Click above to learn more about importing those settings."; } @Override public String getLabel() { return "Previous Liferay IDE settings have been detected"; } @Override public Image getNotificationImage() { return LiferayServerUI.getDefault().getImageRegistry().get(LiferayServerUI.IMG_NOTIFICATION); } @Override public Image getNotificationKindImage() { return null; } @Override public void open() { boolean importSettings = MessageDialog.openQuestion( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Previous Liferay IDE Settings Detected", "Settings from a previous Liferay IDE workspace have been detected such as: Plugins SDKS, Liferay runtimes, or Liferay servers. Do you want to import these settings now?"); if (importSettings) { importGlobalSettings(); } } }; }
From source file:com.liferay.ide.ui.util.UIUtil.java
License:Open Source License
public static boolean promptQuestion(final String title, final String message) { final boolean[] retval = new boolean[1]; Display.getDefault().syncExec(new Runnable() { public void run() { retval[0] = MessageDialog.openQuestion(getActiveShell(), title, message); }/* w w w . j av a 2 s.c o m*/ }); return retval[0]; }
From source file:com.ls.mappwidget.slicingtool.views.MainView.java
License:Apache License
protected boolean checkDir(Composite parent, String dir, String name) { String sign = ""; if (!dir.endsWith("\\")) { sign = "\\"; }// w w w.j av a2 s . c o m String fileName = dir + sign + name; File file = new File(fileName); if (file.exists()) { boolean answer = MessageDialog.openQuestion(parent.getShell(), ATTENTION, "Directory \"" + fileName + "\"" + " already exist. Do you want to continue(its will remove old files!)?"); if (answer) { FileUtils.deleteDir(file); } return answer; } return true; }
From source file:com.mansfield.pde.api.tools.internal.ui.preferencepages.TargetBaselinePreferencePage.java
License:Open Source License
public boolean performOk() { // Check state conditions if (!is_Dirty) { return true; }//ww w. j av a2 s . com ITargetPlatformService service = getTargetService(); if (service == null) { return false; } // perform preload changes if (!applyChanges()) { return false; } compilers_ConfigBlock.performOK(); // Since it is only possible to create new targets and not baselines // retrieve the baseline from the new definition (if any) and add // only that to the baseline manager IApiBaseline activeBaseline = null; try { activeBaseline = getBaselineFromDefinition(newDefinitionId); } catch (CoreException e) { setErrorMessage(e.getMessage()); return false; } if (activeDefinitionId != newDefinitionId || active_ContentChanged) { baseline_Manager.setDefaultApiBaseline(activeBaseline.getName()); if (rebuild_Count < 1) { rebuild_Count++; IProject[] projects = Util.getApiProjects(); // do not even ask if there are no projects to build if (projects != null) { if (MessageDialog.openQuestion(getShell(), PreferenceMessages.ApiProfilesPreferencePage_6, PreferenceMessages.ApiProfilesPreferencePage_7)) { Util.getBuildJob(projects).schedule(); } } } } activeDefinitionId = newDefinitionId; is_Dirty = false; active_ContentChanged = false; return super.performOk(); }
From source file:com.metaaps.eoclipse.common.Util.java
License:Open Source License
public static boolean questionMessage(String title, String message) { Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell(); return MessageDialog.openQuestion(shell, title, message); }
From source file:com.microsoft.applicationinsights.ui.config.AIProjConfigWizardDialog.java
License:Open Source License
private void handleWebXML(IProject proj, AILibraryHandler handler) throws Exception { if (proj.getFile(webxmlPath).exists()) { handler.parseWebXmlPath(proj.getFile(webxmlPath).getLocation().toOSString()); handler.setAIFilterConfig();//from w w w. ja v a2 s.c om } else { // create web.xml boolean choice = MessageDialog.openQuestion(this.getShell(), Messages.depDescTtl, Messages.depDescMsg); if (choice) { String path = AILibraryUtil.createFileIfNotExists(Messages.depFileName, depDirLoc, Messages.resFileLoc); handler.parseWebXmlPath(path); } else { throw new Exception(": Application Insights cannot be configured without creating web.xml "); } } }
From source file:com.microsoft.tfs.client.common.ui.controls.connect.ServerListControl.java
License:Open Source License
private void onDeleteButtonSelected(final SelectionEvent e) { final ServerListConfigurationEntry[] serverListEntries = serverListTable.getSelectedServerListEntries(); final String title; final String message; if (serverListEntries.length == 1) { title = Messages.getString("ServerListControl.RemoveServerTitle"); //$NON-NLS-1$ message = MessageFormat.format(Messages.getString("ServerListControl.RemoveServerPromptFormat"), //$NON-NLS-1$ serverListEntries[0].getName()); } else {/*from ww w . j a va 2 s. co m*/ title = Messages.getString("ServerListControl.RemoveServersTitle"); //$NON-NLS-1$ message = Messages.getString("ServerListControl.RemoveServersPrompt"); //$NON-NLS-1$ } if (MessageDialog.openQuestion(getShell(), title, message) == false) { return; } removeCredentials(serverListEntries); for (int i = 0; i < serverListEntries.length; i++) { final ServerListConfigurationEntry serverListEntry = serverListEntries[i]; serverList.remove(serverListEntry); if (lastAddedServerListEntry == serverListEntry) { lastAddedServerListEntry = null; lastAddedConnection = null; } } refreshTable(); serverListTable.setFocus(); }