org.eclipse.jface.dialogs.MessageDialog Java Examples

The following examples show how to use org.eclipse.jface.dialogs.MessageDialog. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DeveloperStudioPerspective.java    From devstudio-tooling-ei with Apache License 2.0 6 votes vote down vote up
/**
 * hide open dashboards
 */
private void hideDashboards() {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    try {
        IWorkbenchPage page = window.getActivePage();
        List<IEditorReference> openEditors = new ArrayList<IEditorReference>();
        IEditorReference[] editorReferences = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
                .getEditorReferences();
        for (IEditorReference iEditorReference : editorReferences) {
            if (DASHBOARD_VIEW_ID.equals(iEditorReference.getId())) {
                openEditors.add(iEditorReference);
            }
        }
        if (openEditors.size() > 0) {
            page.closeEditors(openEditors.toArray(new IEditorReference[] {}), false);
        }
    } catch (Exception e) {
        MessageDialog.openError(window.getShell(), "Could not hide dashboards for perspective", e.getMessage());
    }
}
 
Example #2
Source File: InlineAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void run(ITextSelection selection) {
	if (!ActionUtil.isEditable(fEditor))
		return;

	ITypeRoot typeRoot= SelectionConverter.getInput(fEditor);
	if (typeRoot == null)
		return;

	CompilationUnit node= RefactoringASTParser.parseWithASTProvider(typeRoot, true, null);

	if (typeRoot instanceof ICompilationUnit) {
		ICompilationUnit cu= (ICompilationUnit) typeRoot;
		if (fInlineTemp.isEnabled() && fInlineTemp.tryInlineTemp(cu, node, selection, getShell()))
			return;

		if (fInlineConstant.isEnabled() && fInlineConstant.tryInlineConstant(cu, node, selection, getShell()))
			return;
	}
	//InlineMethod is last (also tries enclosing element):
	if (fInlineMethod.isEnabled() && fInlineMethod.tryInlineMethod(typeRoot, node, selection, getShell()))
		return;

	MessageDialog.openInformation(getShell(), RefactoringMessages.InlineAction_dialog_title, RefactoringMessages.InlineAction_select);
}
 
Example #3
Source File: ConfigBluemixWizard.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
static public void launch() {
    // Check there's an open project
    if (ToolbarAction.project != null) {
        // Check that the Server details are configured
        if (BluemixUtil.isServerConfigured()) {
            // Check is the manifest open
            ManifestMultiPageEditor editor = BluemixUtil.getManifestEditor(ToolbarAction.project);
            if (editor != null) {
                MessageDialog.openWarning(null, _WIZARD_TITLE, 
                        "The Manifest for this application is open. You must close the Manifest before running the Configuration Wizard."); // $NLX-ConfigBluemixWizard.TheManifestforthisapplicat-1$ 
            } else {
                // Launch the Bluemix Config Wizard
                ConfigBluemixWizard wiz = new ConfigBluemixWizard();
                WizardDialog dialog = new WizardDialog(null, wiz);        
                dialog.addPageChangingListener(wiz);
                dialog.open();
            }
        }
        else {
            BluemixUtil.displayConfigureServerDialog();
        }
    } else {
        MessageDialog.openError(null, _WIZARD_TITLE, "No application has been selected or the selected application is not open.");  // $NLX-ConfigBluemixWizard.Noapplicationhasbeenselectedorthe-1$
    }
}
 
Example #4
Source File: CiviDialog.java    From civicrm-data-integration with GNU General Public License v3.0 6 votes vote down vote up
protected void getEntities() {
    try {
        if (civiCrmEntityList != null && civiCrmEntityList.size() > 0) {
            MessageDialog.setDefaultImage(GUIResource.getInstance().getImageSpoon());
            boolean goOn = MessageDialog.openConfirm(shell, BaseMessages.getString(PKG, "CiviCrmDialog.DoMapping.ReplaceFields.Title"),
                    BaseMessages.getString(PKG, "CiviCrmDialog.DoMapping.ReplaceFields.Msg"));
            if (!goOn) {
                return;
            }
        }

        String restUrl = variables.environmentSubstitute(wCiviCrmRestUrl.getText());
        String apiKey = variables.environmentSubstitute(wCiviCrmApiKey.getText());
        String siteKey = variables.environmentSubstitute(wCiviCrmSiteKey.getText());
        // String entity = wCiviCrmEntity.getText());

        CiviRestService crUtil = new CiviRestService(restUrl, apiKey, siteKey, "getfields", wCiviCrmEntity.getText());

        civiCrmEntityList = crUtil.getEntityList();
        String[] eArray = (String[]) civiCrmEntityList.toArray(new String[0]);
        wCiviCrmEntity.setItems(eArray);
    } catch (Exception e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "CiviCrmStep.Error.EntityListError"), e.toString().split(":")[0], e);
        logBasic(BaseMessages.getString(PKG, "CiviCrmStep.Error.APIExecError", e.toString()));
    }
}
 
Example #5
Source File: PickWorkspaceDialog.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
protected void cloneCurrentWorkspace() {
	final String currentLocation = WorkspacePreferences.getLastSetWorkspaceDirectory();
	if ( currentLocation == null || currentLocation.isEmpty() ) {
		MessageDialog.openError(Display.getDefault().getActiveShell(), "Error",
			"No current workspace exists. Can only clone from an existing workspace");
		return;
	}
	final String newLocation = workspacePathCombo.getText();
	// Fixes Issue #2848
	if ( newLocation.startsWith(currentLocation) ) {
		MessageDialog.openError(Display.getDefault().getActiveShell(), "Error",
			"The path entered is either that of the current wokspace or of a subdirectory of it. Neither can be used as a destination.");
		return;
	}
	cloning = true;
	try {
		okPressed();
	} finally {
		cloning = false;
	}
}
 
Example #6
Source File: ShowNextFuzzyHandler.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
public Object execute(ExecutionEvent event) throws ExecutionException {
	IEditorPart editor = HandlerUtil.getActiveEditor(event);
	if (!(editor instanceof XLIFFEditorImplWithNatTable)) {
		return null;
	}
	XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor;
	int[] selectedRows = xliffEditor.getSelectedRows();
	if (selectedRows.length < 1) {
		return null;
	}
	Arrays.sort(selectedRows);
	int lastSelectedRow = selectedRows[selectedRows.length - 1];
	XLFHandler handler = xliffEditor.getXLFHandler();

	int row = handler.getNextFuzzySegmentIndex(lastSelectedRow);
	if (row != -1) {
		xliffEditor.jumpToRow(row);
	} else {
		IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
		MessageDialog.openWarning(window.getShell(), "", "不存在下一模糊匹配文本段。");
	}

	return null;
}
 
Example #7
Source File: ShowPreviousUntranslatedHandler.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
public Object execute(ExecutionEvent event) throws ExecutionException {
	IEditorPart editor = HandlerUtil.getActiveEditor(event);
	if (!(editor instanceof XLIFFEditorImplWithNatTable)) {
		return null;
	}
	XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor;
	int[] selectedRows = xliffEditor.getSelectedRows();
	if (selectedRows.length < 1) {
		return null;
	}
	Arrays.sort(selectedRows);
	int firstSelectedRow = selectedRows[0];
	XLFHandler handler = xliffEditor.getXLFHandler();

	int row = handler.getPreviousUntranslatedSegmentIndex(firstSelectedRow);
	if (row != -1) {
		xliffEditor.jumpToRow(row);
	} else {
		IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
		MessageDialog.openWarning(window.getShell(), "", "不存在上一未翻译文本段。");
	}

	return null;
}
 
Example #8
Source File: BillingProposalWizardDialog.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void okPressed(){
	ProgressMonitorDialog progress = new ProgressMonitorDialog(getShell());
	QueryProposalRunnable runnable = new QueryProposalRunnable();
	try {
		progress.run(true, true, runnable);
		if (runnable.isCanceled()) {
			return;
		} else {
			proposal = runnable.getProposal();
		}
	} catch (InvocationTargetException | InterruptedException e) {
		LoggerFactory.getLogger(BillingProposalWizardDialog.class)
			.error("Error running proposal query", e);
		MessageDialog.openError(getShell(), "Fehler",
			"Fehler beim Ausführen des Rechnungs-Vorschlags.");
		return;
	}
	
	super.okPressed();
}
 
Example #9
Source File: EquivalentPage.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 验证用户输入的加权系数的正确性
 * @param equiTxt
 */
private void validEquiTxt(final Text equiTxt){
	final String defaultStr = "0.50";
	equiTxt.setText(defaultStr);
	equiTxt.addFocusListener(new FocusAdapter() {
		@Override
		public void focusLost(FocusEvent e) {
			String textStr = equiTxt.getText().trim();
			if (textStr == null || textStr.trim().length() == 0) {
				equiTxt.setText(defaultStr);
			}else {
				String regular = "1\\.(0){0,2}|0\\.\\d{0,2}";
				if (!textStr.matches(regular)) {
					MessageDialog.openInformation(getShell(), Messages.getString("preference.EquivalentPage.msgTitle"), 
						Messages.getString("preference.EquivalentPage.msg5"));
					equiTxt.setText(defaultStr);
				}
			}
		}
	});
}
 
Example #10
Source File: RenameResourceAndCloseEditorAction.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check if the supplied resource is read only or null. If it is then ask
 * the user if they want to continue. Return true if the resource is not
 * read only or if the user has given permission.
 * 
 * @return boolean
 */
private boolean checkReadOnlyAndNull(IResource currentResource) {
	// Do a quick read only and null check
	if (currentResource == null) {
		return false;
	}

	// Do a quick read only check
	final ResourceAttributes attributes = currentResource
			.getResourceAttributes();
	if (attributes != null && attributes.isReadOnly()) {
		return MessageDialog.openQuestion(shellProvider.getShell(), CHECK_RENAME_TITLE,
				MessageFormat.format(CHECK_RENAME_MESSAGE,
						new Object[] { currentResource.getName() }));
	}

	return true;
}
 
Example #11
Source File: PluginConfigManage.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
public void sendDocument(PluginConfigBean bean, IFile curXliff) {
	String curXliffLocation = curXliff.getLocation().toOSString();
	File f = new File(curXliffLocation);
	if (!f.exists()) {
		MessageDialog.openInformation(shell, Messages.getString("plugin.PluginConfigManage.msgTitle"),
				MessageFormat.format(Messages.getString("plugin.PluginConfigManage.msg9"), curXliff.getFullPath()
						.toOSString()));
		return;
	}

	String commandLine = bean.getCommandLine();

	String[] cmdArray = { commandLine, curXliffLocation };
	try {
		Process pluginProcess = Runtime.getRuntime().exec(cmdArray);
		if (bean.getInput().equals(PluginConstants.EXCHANGEFILE)) {
			pluginProcess.waitFor();
		}
	} catch (Exception e) {
		LOGGER.error("", e);
	}
}
 
Example #12
Source File: ExtractJob.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
protected Action getViewStatusAction(IStatus jobStatus) {
  final String statusTitle = "Extracted " + archive.getName();

  final String statusMessage = "Extracted: "
      + archive.getAbsolutePath()
      + "\n"
      + "into directory: "
      + targetDir.getAbsolutePath()
      + (jobStatus == Status.OK_STATUS ? "" : "\n" + "Status: "
          + jobStatus.getMessage());

  return new Action("view extract status") {
    @Override
    public void run() {
      MessageDialog.openInformation(
          PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
          statusTitle, statusMessage);
    }
  };
}
 
Example #13
Source File: StartEditLocalDocumentHandler.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
private void startEditLocal(Object object, ILocalDocumentService service, Shell parentShell){
	Optional<File> file = service.add(object, new IConflictHandler() {
		@Override
		public Result getResult(){
			if (MessageDialog.openQuestion(parentShell,
				Messages.StartEditLocalDocumentHandler_conflicttitle,
				Messages.StartEditLocalDocumentHandler_conflictmessage)) {
				return Result.KEEP;
			} else {
				return Result.OVERWRITE;
			}
		}
	});
	if (file.isPresent()) {
		Program.launch(file.get().getAbsolutePath());
	} else {
		MessageDialog.openError(parentShell, Messages.StartEditLocalDocumentHandler_errortitle,
			Messages.StartEditLocalDocumentHandler_errormessage);
	}
}
 
Example #14
Source File: StartAction.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
public void run(IAction action) {
	try {
		if(currentJavaProject!=null){
			currentProject=currentJavaProject.getProject();
		}
		DerbyServerUtils.getDefault().startDerbyServer(currentProject);
		
	}
	catch (CoreException e) {
		Shell shell = new Shell();
		MessageDialog.openInformation(
			shell,
			CommonNames.PLUGIN_NAME,
			Messages.D_NS_START_ERROR +
			com.pivotal.gemfirexd.internal.ui.util.SelectionUtil.getStatusMessages(e));
	}
}
 
Example #15
Source File: SplitTermHandler.java    From slr-toolkit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	ISelection selection = HandlerUtil.getCurrentSelectionChecked(event);
	if (selection == null || !(selection instanceof IStructuredSelection)) {
		return null;
	}
	IStructuredSelection currentSelection = (IStructuredSelection) selection;
	if (currentSelection.size() == 1) {
		Term termToSplit = (Term) currentSelection.getFirstElement();
		if (selectionValid(termToSplit)) {
			SplitTermDialog dialog = new SplitTermDialog(null, termToSplit.getName());
			if (dialog.open() == MessageDialog.OK && dialog.getReturnCode() == MessageDialog.OK) {
				TermSplitter.split(termToSplit, dialog.getDefaultTermName(), dialog.getFurtherTermNames());
			}
		} else {
			ErrorDialog.openError(null, "Error", null, new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Invalid selection. The selected term must not have children.", null));
		}
	}
	return null;
}
 
Example #16
Source File: ImportTracePackageWizardPage.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private int promptForTraceOverwrite(TracePackageTraceElement packageElement) {
    String name = packageElement.getDestinationElementPath();
    final MessageDialog dialog = new MessageDialog(getContainer().getShell(),
            Messages.ImportTracePackageWizardPage_AlreadyExistsTitle,
            null,
            MessageFormat.format(Messages.ImportTracePackageWizardPage_TraceAlreadyExists, name),
            MessageDialog.QUESTION, new String[] {
                    IDialogConstants.NO_TO_ALL_LABEL,
                    IDialogConstants.NO_LABEL,
                    IDialogConstants.YES_TO_ALL_LABEL,
                    IDialogConstants.YES_LABEL },
            3) {
        @Override
        protected int getShellStyle() {
            return super.getShellStyle() | SWT.SHEET;
        }
    };
    return dialog.open();
}
 
Example #17
Source File: AbstractDataSection.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
protected void moveData(final IStructuredSelection structuredSelection) {
    final MoveDataWizard moveDataWizard = new MoveDataWizard((DataAware) getEObject());
    if (new WizardDialog(Display.getDefault().getActiveShell(), moveDataWizard).open() == Dialog.OK) {
        final DataAware dataAware = moveDataWizard.getSelectedDataAwareElement();
        try {
            final MoveDataCommand cmd = new MoveDataCommand(getEditingDomain(), (DataAware) getEObject(), structuredSelection.toList(), dataAware);
            OperationHistoryFactory.getOperationHistory().execute(cmd, null, null);

            if (!(cmd.getCommandResult().getStatus().getSeverity() == Status.OK)) {
                final List<Object> data = (List<Object>) cmd.getCommandResult().getReturnValue();
                String dataNames = "";
                for (final Object d : data) {
                    dataNames = dataNames + ((Element) d).getName() + ",";
                }
                dataNames = dataNames.substring(0, dataNames.length() - 1);
                MessageDialog.openWarning(Display.getDefault().getActiveShell(), Messages.PromoteDataWarningTitle,
                        Messages.bind(Messages.PromoteDataWarningMessage, dataNames));
            }

        } catch (final ExecutionException e1) {
            BonitaStudioLog.error(e1);
        }
        refresh();
    }
}
 
Example #18
Source File: ResolveTreeConflictWizard.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public void partClosed(IWorkbenchPartReference partRef) {
	IWorkbenchPart part = partRef.getPart(false);
	if (part instanceof CompareEditor) {
		CompareEditor editor = (CompareEditor)part;
		IEditorInput input = editor.getEditorInput();
		String name = input.getName();
		if (name != null && name.startsWith(compareName)) {
			targetPart.getSite().getPage().removePartListener(this);
			if (MessageDialog.openQuestion(getShell(), Messages.ResolveTreeConflictWizard_editorClosed, Messages.ResolveTreeConflictWizard_promptToReolve + treeConflict.getResource().getName() + "?")) { //$NON-NLS-1$
				ResolveTreeConflictWizard wizard = new ResolveTreeConflictWizard(treeConflict, targetPart);
				WizardDialog dialog = new SizePersistedWizardDialog(Display.getDefault().getActiveShell(), wizard, "ResolveTreeConflict"); //$NON-NLS-1$
				dialog.open();
			}
		}
	}
}
 
Example #19
Source File: CheckBoxExpressionViewer.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
protected void switchEditorType() {
    if (!control.isVisible()) {
        switchToExpressionMode();
        bindExpression();
    } else {
        if (MessageDialog.openQuestion(mc.getShell(), Messages.eraseExpressionTitle, Messages.eraseExpressionMsg)) {
            switchToCheckBoxMode();
            //Reset checkbox to false
            final Expression falseExp = ExpressionFactory.eINSTANCE.createExpression();
            falseExp.setName(Boolean.FALSE.toString());
            falseExp.setContent(Boolean.FALSE.toString());
            falseExp.setReturnType(Boolean.class.getName());
            falseExp.setType(ExpressionConstants.CONSTANT_TYPE);
            updateSelection(null, falseExp);
            bindExpression();
        }
    }
    mc.layout(true, true);
}
 
Example #20
Source File: UpdatePolicy.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean continueWorkingWithOperation(ProfileChangeOperation operation, Shell shell) {

	Assert.isTrue(operation.getResolutionResult() != null);
	IStatus status = operation.getResolutionResult();
	// user cancelled
	if (status.getSeverity() == IStatus.CANCEL)
		return false;

	// Special case those statuses where we would never want to open a wizard
	if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
		MessageDialog.openInformation(shell, P2UpdateUtil.CHECK_UPDATE_JOB_NAME, P2UpdateUtil.UPDATE_PROMPT_INFO_NO_UPDATE);
		return false;
	}

	// there is no plan, so we can't continue. Report any reason found
	if (operation.getProvisioningPlan() == null && !status.isOK()) {
		StatusManager.getManager().handle(status, StatusManager.LOG | StatusManager.SHOW);
		return false;
	}

	// Allow the wizard to open otherwise.
	return true;
}
 
Example #21
Source File: ManageCustomParsersDialog.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private boolean checkNameConflict(CustomTraceDefinition def) {
    for (TraceTypeHelper helper : TmfTraceType.getTraceTypeHelpers()) {
        if (def.categoryName.equals(helper.getCategoryName()) &&
                def.definitionName.equals(helper.getName())) {
            String newName = findAvailableName(def);
            MessageDialog dialog = new MessageDialog(
                    getShell(),
                    null,
                    null,
                    NLS.bind(Messages.ManageCustomParsersDialog_ConflictMessage,
                            new Object[] { def.categoryName, def.definitionName, newName}),
                    MessageDialog.QUESTION,
                    new String[] { Messages.ManageCustomParsersDialog_ConflictRenameButtonLabel,
                        Messages.ManageCustomParsersDialog_ConflictSkipButtonLabel },
                    0);
            int result = dialog.open();
            if (result == 0) {
                def.definitionName = newName;
                return true;
            }
            return false;
        }
    }
    return true;
}
 
Example #22
Source File: ShowLocalHistory.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
protected IFileState[] getLocalHistory() {
	final IFile file = ResourceManager.getFile(getSelection().getFirstElement());
	IFileState states[] = null;
	try {
		if (file != null) {
			states = file.getHistory(null);
		}
	} catch (final CoreException ex) {
		MessageDialog.openError(WorkbenchHelper.getShell(), getPromptTitle(), ex.getMessage());
		return null;
	}

	if (states == null || states.length <= 0) {
		MessageDialog.openInformation(WorkbenchHelper.getShell(), getPromptTitle(),
				TeamUIMessages.ShowLocalHistory_0);
		return states;
	}
	return states;
}
 
Example #23
Source File: SmartImportBdmHandler.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell activeShell, RepositoryAccessor repositoryAccessor) {
    SmartImportBdmPage page = new SmartImportBdmPage(repositoryAccessor);
    Optional<BusinessDataModelEditor> openedEditor = retrieveBdmFileStore(repositoryAccessor)
            .map(BusinessObjectModelFileStore::getOpenedEditor);
    manageDirtyEditor(activeShell, openedEditor);
    Optional<IStatus> status = createWizard(newWizard(), page, repositoryAccessor).open(activeShell,
            Messages.importButtonLabel);
    if (status.isPresent()) {
        IStatus s = status.get();
        if (s.isOK()) {
            MessageDialog.openInformation(activeShell, Messages.bdmImportedTitle, Messages.bdmImported);
            updateWorkingCopy(openedEditor, repositoryAccessor);
        } else {
            MessageDialog.openError(activeShell, Messages.ImportError, s.getMessage());
        }
    }
}
 
Example #24
Source File: DeleteContactAction.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
public void runDeleteAction() {
  XMPPContact contact = null;
  List<XMPPContact> selectedRosterEntries =
      SelectionRetrieverFactory.getSelectionRetriever(XMPPContact.class).getSelection();
  if (selectedRosterEntries.size() == 1) {
    contact = selectedRosterEntries.get(0);
  }

  if (contact == null) {
    log.error("XMPPContact should not be null at this point!"); // $NON-NLS-1$
    return;
  }

  if (sessionManager != null) {
    // Is the chosen user currently in the session?
    ISarosSession sarosSession = sessionManager.getSession();
    if (sarosSession != null) {
      for (User p : sarosSession.getUsers()) {
        // If so, stop the deletion from completing
        if (contact.getBareJid().equals(p.getJID())) {
          MessageDialog.openError(
              null, Messages.DeleteContactAction_error_title, DELETE_ERROR_IN_SESSION);
          return;
        }
      }
    }
  }

  if (MessageDialog.openQuestion(
      null,
      Messages.DeleteContactAction_confirm_title,
      MessageFormat.format(
          Messages.DeleteContactAction_confirm_message, contact.getDisplayableNameLong()))) {

    contactsService.removeContact(contact);
  }
}
 
Example #25
Source File: CreateCamelProcess.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
public void run(IIntroSite site, Properties params) {
    IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
    if (factory.isUserReadOnlyOnCurrentProject()) {
        MessageDialog.openWarning(null, "User Authority", "Can't create Route! Current user is read-only on this project!");
    } else {
        PlatformUI.getWorkbench().getIntroManager().closeIntro(PlatformUI.getWorkbench().getIntroManager().getIntro());
        selectRootObject(params);
        doRun();
    }
}
 
Example #26
Source File: LibrarySuggestionController.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void onInstall() {
	try {
		getModel().installPickedLibraries();
		MessageDialog.openInformation(getView().getShell(), "Install",
				"The installation of the selected libraries has been finished successfully.");
		dispose();
	} catch (IOException | XmlPullParserException e) {
		e.printStackTrace();
		MessageDialog.openError(getView().getShell(), "Error", "Could not install the selected libraries.\n" + e);
	}
}
 
Example #27
Source File: DerbyServerUtils.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public void startDerbyServer( IProject proj) throws CoreException {
	String args = CommonNames.START_DERBY_SERVER;
	String vmargs="";
	DerbyProperties dprop=new DerbyProperties(proj);
	//Starts the server as a Java app
	args+=" -h "+dprop.getHost()+ " -p "+dprop.getPort();
	
	//Set Derby System Home from the Derby Properties
	if((dprop.getSystemHome()!=null)&& !(dprop.getSystemHome().equals(""))){
		vmargs=CommonNames.D_SYSTEM_HOME+dprop.getSystemHome();
	}
	String procName="["+proj.getName()+"] - "+CommonNames.DERBY_SERVER+" "+CommonNames.START_DERBY_SERVER+" ("+dprop.getHost()+ ", "+dprop.getPort()+")";
	ILaunch launch = DerbyUtils.launch(proj, procName ,		
	CommonNames.DERBY_SERVER_CLASS, args, vmargs, CommonNames.START_DERBY_SERVER);
	IProcess ip=launch.getProcesses()[0];
	//set a name to be seen in the Console list
	ip.setAttribute(IProcess.ATTR_PROCESS_LABEL,procName);
	
	// saves the mapping between (server) process and project
	//servers.put(launch.getProcesses()[0], proj);
	servers.put(ip, proj);
	// register a listener to listen, when this process is finished
	DebugPlugin.getDefault().addDebugEventListener(listener);
	//Add resource listener
	IWorkspace workspace = ResourcesPlugin.getWorkspace();
	
	workspace.addResourceChangeListener(rlistener);
	setRunning(proj, Boolean.TRUE);
	Shell shell = new Shell();
	MessageDialog.openInformation(
		shell,
		CommonNames.PLUGIN_NAME,
		Messages.D_NS_ATTEMPT_STARTED+dprop.getPort()+".");

}
 
Example #28
Source File: MissingSDKStatusHandler.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void handle(IStatus status) {
	boolean define = MessageDialog.openQuestion(AbstractStatusHandler.getShell(), "Missing Android SDK",
			"Location of the Android SDK must be defined. Define Now?");
	if(define){
		PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), AndroidPreferencePage.PAGE_ID, 
				null, null);
		dialog.open();
	}
}
 
Example #29
Source File: StartupDialog.java    From offspring with MIT License 5 votes vote down vote up
@Override
protected void buttonPressed(int id) {
  if (id == IDialogConstants.CANCEL_ID) {
    if (showOKButton) { // dialog is used for startup
      boolean exit = MessageDialog.openConfirm(getShell(), "Exit Offspring?",
          "Do you want to exit Offspring?");
      if (!exit)
        return;
    }
    monitor.setCanceled(true);
  }
  super.buttonPressed(id);
}
 
Example #30
Source File: RepositoryBranchTagAction.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
		ISVNRemoteResource[] resources = getSelectedRemoteResources();
    	BranchTagWizard wizard = new BranchTagWizard(resources);
    	WizardDialog dialog = new SizePersistedWizardDialog(getShell(), wizard, "BranchTag"); //$NON-NLS-1$
    	if (dialog.open() == WizardDialog.OK) {	
    	  SVNUrl[] sourceUrls = wizard.getUrls();
          SVNUrl destinationUrl = wizard.getToUrl();
          String message = wizard.getComment();
          SVNRevision revision = wizard.getRevision();
          boolean makeParents = wizard.isMakeParents();
		  ISVNClientAdapter client = null;
		  try {
			  ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(sourceUrls[0].toString());
			  if (repository != null)
			  	client = repository.getSVNClient();
			  if (client == null)
				client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
			  RepositoryBranchTagOperation branchTagOperation = new RepositoryBranchTagOperation(getTargetPart(), client, sourceUrls, destinationUrl, revision, message, makeParents);
			  branchTagOperation.setMultipleTransactions(wizard.isSameStructure());
			  branchTagOperation.run();
		  } catch (Exception e) {
			  MessageDialog.openError(getShell(), Policy.bind("BranchTagDialog.title"), e.getMessage());
		  } finally {
			  // BranchTagCommand will dispose.
//            SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
		  }
    	}
	}