当前位置: 首页>>代码示例>>Java>>正文


Java SWT.CANCEL属性代码示例

本文整理汇总了Java中org.eclipse.swt.SWT.CANCEL属性的典型用法代码示例。如果您正苦于以下问题:Java SWT.CANCEL属性的具体用法?Java SWT.CANCEL怎么用?Java SWT.CANCEL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.swt.SWT的用法示例。


在下文中一共展示了SWT.CANCEL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: closeTranscription

/**
 * @return true if the transcription was closed, false if the operation was
 *         cancelled
 */
protected boolean closeTranscription() {
	if (!textEditor.isDisposed()) {
		if (textEditor.isChanged()) {
			MessageBox diag = new MessageBox(shell,
					SWT.APPLICATION_MODAL | SWT.ICON_QUESTION | SWT.YES | SWT.NO | SWT.CANCEL);
			diag.setMessage("You have unsaved changes, would you like to save them?");
			int opt = diag.open();
			if (opt == SWT.YES)
				saveTranscription();
			if (opt == SWT.CANCEL)
				return false;
		}
		textEditor.clear();
		transcriptionFile = null;
	}
	return true;
}
 
开发者ID:juanerasmoe,项目名称:pmTrans,代码行数:21,代码来源:PmTrans.java

示例2: reset

public void reset() {
	JavelinConnector javelinConnector = (JavelinConnector) connector;
	Javelin javelin = javelinConnector.javelin;

	int emulatorID = (int) javelinConnector.emulatorID;

	switch (emulatorID) {
	case Session.EmulIDSNA:
	case Session.EmulIDAS400:
		MessageBox messageBox = new MessageBox(getShell(), SWT.OK | SWT.CANCEL | SWT.ICON_QUESTION
				| SWT.APPLICATION_MODAL);
		String message = "This will send a KEY_RESET to the emulator.";
		messageBox.setMessage(message);
		int ret = messageBox.open();
		if (ret == SWT.OK) {
			javelin.doAction("KEY_RESET");
			Engine.logEmulators
					.info("KEY_RESET has been sent to the emulator, because of an user request.");
		}
		break;
	default:
		ConvertigoPlugin
				.warningMessageBox("The Reset function is only available for IBM emulators (3270 and AS/400).");
		break;
	}
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:26,代码来源:JavelinConnectorComposite.java

示例3: run

public void run() {
	Display display = Display.getDefault();
	Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);		
	
	Shell shell = getParentShell();
	shell.setCursor(waitCursor);
       
	try {
   		ProjectExplorerView explorerView = getProjectExplorerView();
   		if (explorerView != null) {
   			TraceTreeObject traceObject = (TraceTreeObject)explorerView.getFirstSelectedTreeObject();
   			
			MessageBox messageBox = new MessageBox(shell,SWT.YES | SWT.NO | SWT.CANCEL | SWT.ICON_QUESTION | SWT.APPLICATION_MODAL);
			String message = java.text.MessageFormat.format("Do you really want to delete the trace \"{0}\"?", new Object[] {traceObject.getName()});
        	messageBox.setMessage(message);
        	if (messageBox.open() == SWT.YES) {
        		File file = (File) traceObject.getObject();
        		if (file.exists()) {
        			if (file.delete()) {
        				TreeParent treeParent = traceObject.getParent();
        				treeParent.removeChild(traceObject);
        				explorerView.refreshTreeObject(treeParent);
        			}
        			else {
        				throw new Exception("Unable to delete file \""+ file.getAbsolutePath() + "\"");
        			}
        		}
        	}
   			
   		}
	}
	catch (Throwable e) {
		ConvertigoPlugin.logException(e, "Unable to delete the trace file!");
	}
       finally {
		shell.setCursor(null);
		waitCursor.dispose();
       }
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:39,代码来源:TraceDeleteAction.java

示例4: showOkCancelErrorDialog

/**
 * Display a dialog box with the error icon and a ok/cancel button selection.
 */
public static int showOkCancelErrorDialog(Shell shell, String title, String message) {
	MessageBox messageBox = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK | SWT.CANCEL);
	messageBox.setText(title);
	messageBox.setMessage(message);
	return messageBox.open();
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:9,代码来源:SwtUtil.java

示例5: saveParameters

private boolean saveParameters() {
	String currentFilePath = (String) parameterTableViewer
			.getData(MultiParameterFileDialogConstants.CURRENT_PARAM_FILE);
	if (!StringUtils.isEmpty(currentFilePath)) {
		
		Map<String, String> parameterMap = new LinkedHashMap<>();
		for (Parameter parameter : parameters) {
			if(StringUtils.isEmpty(parameter.getParameterName())){
				MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_WARNING | SWT.OK | SWT.CANCEL);
				messageBox.setText(ErrorMessages.WARNING);
				messageBox.setMessage(ErrorMessages.BLANK_PARAMETER_WILL_BE_LOST);
				int response = messageBox.open();
				if (response != SWT.OK) {
					return false;
				}
			}else{
			parameterMap.put(parameter.getParameterName(),
					parameter.getParameterValue());
			}
		}
		try {
			ParameterFileManager.getInstance().storeParameters(parameterMap, null, currentFilePath);
			ifNotified = false;
		} catch (IOException e1) {
			e1.printStackTrace();
		}
	}

	populateParameterSearchBox();
	return true;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:31,代码来源:MultiParameterFileDialog.java

示例6: createMessageBox

private void createMessageBox(){
	Shell shell=container.getShell();
	int style = SWT.APPLICATION_MODAL | SWT.OK | SWT.CANCEL | SWT.ICON_QUESTION;
	messageBox = new MessageBox(shell,style);
	messageBox.setText("Confirm"); //$NON-NLS-1$
	messageBox.setMessage(Messages.MessageBeforeClosingWindow);
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:7,代码来源:ConfirmCancelMessageBox.java

示例7: cancelPressed

@Override
protected void cancelPressed() {
	if (isAnyUpdatePerformed) {
		int style = SWT.APPLICATION_MODAL | SWT.OK | SWT.CANCEL |SWT.ICON_INFORMATION;
		MessageBox messageBox = new MessageBox(getShell(), style);
		messageBox.setText(Messages.INFORMATION); //$NON-NLS-1$
		messageBox.setMessage(Messages.MessageBeforeClosingWindow);
		if (messageBox.open() == SWT.OK) {
			closeDialog = super.close();
		}
	} else {
		closeDialog = super.close();
	}

}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:15,代码来源:HivePartitionKeyValueDialog.java

示例8: messageDialog

private int messageDialog() {
	MessageBox box = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_QUESTION | SWT.YES
			| SWT.CANCEL | SWT.NO);
	box.setMessage(Messages.TOOL_EXT_MESSAGE);
	box.setText(Messages.TOOL_EXIT_MESSAGE_BOX_TITLE);
	return box.open();
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:7,代码来源:ApplicationWorkbenchWindowAdvisor.java

示例9: getButtonVal

private int getButtonVal(int buttonPos) {
	if (buttonVals == null) {
		return buttonPos;
	}
	if (buttonPos < 0 || buttonPos >= buttonVals.length) {
		return SWT.CANCEL;
	}
	return buttonVals[buttonPos].intValue();
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:9,代码来源:MessageBoxShell.java

示例10: askCanOverwrite

private static boolean askCanOverwrite(File file) {
	MessageBoxShell mb = new MessageBoxShell(SWT.OK | SWT.CANCEL,
			MessageText.getString("FilesView.rename.confirm.delete.title"),
			MessageText.getString("FilesView.rename.confirm.delete.text",
					new String[] {
						file.toString()
					}));
	mb.setDefaultButtonUsingStyle(SWT.OK);
	mb.setRememberOnlyIfButton(0);
	mb.setRemember("FilesView.messagebox.rename.id", true, null);
	mb.setLeftImage(SWT.ICON_WARNING);
	mb.open(null);
	return mb.waitUntilClosed() == SWT.OK;
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:14,代码来源:FilesViewMenuUtil.java

示例11: setButtonVals

public void setButtonVals(Integer[] buttonVals) {
	this.buttonVals = buttonVals;
	int cancelPos = -1;
	for (int i = 0; i < buttonVals.length; i++) {
		Integer val = buttonVals[i];
		if (val == SWT.CANCEL) {
			cancelPos = i;
			break;
		}
	}
	if (cancelPos >= 0) {
		if (Constants.isOSX && cancelPos != 0) {
			String cancelButton = buttonIDs[cancelPos];

			for (int i = cancelPos; i > 0; i--) {
				if (defaultButtonPos == i) {
					defaultButtonPos = i - 1;
				}
				this.buttonIDs[i] = this.buttonIDs[i - 1];
				this.buttonVals[i] = this.buttonVals[i - 1];
			}
			if (defaultButtonPos == 0) {
				defaultButtonPos = 1;
			}
			buttonIDs[0] = cancelButton;
			buttonVals[0] = SWT.CANCEL;
		} // else if (cancelPos != buttons.length - 1) { // TODO: move to end
	}
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:29,代码来源:StandardButtonsArea.java

示例12: getButtonVal

public int getButtonVal(int buttonPos) {
	if (buttonVals == null) {
		return buttonPos;
	}
	if (buttonPos < 0 || buttonPos >= buttonVals.length) {
		return SWT.CANCEL;
	}
	return buttonVals[buttonPos].intValue();
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:9,代码来源:StandardButtonsArea.java

示例13: run

public void run() {
	Display display = Display.getDefault();
	Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);		
	
	Shell shell = getParentShell();
	shell.setCursor(waitCursor);
	
       try {
       	boolean bDeploy = true;
   		ProjectExplorerView explorerView = getProjectExplorerView();
   		if (explorerView != null) {
   			ProjectTreeObject projectTreeObject = (ProjectTreeObject)explorerView.getFirstSelectedTreeObject();
           	Project project = projectTreeObject.getObject();
           	
   			ProjectVersionUpdateDialog dlg = new ProjectVersionUpdateDialog(shell, project.getVersion());
           	if (dlg.open() == Window.OK) {
           		project.setVersion(dlg.result);
           		project.hasChanged = true;
           		projectTreeObject.save(false);
           		explorerView.refreshTree();
           	}
   			
   			if (projectTreeObject.getModified()) {
				MessageBox messageBox = new MessageBox(shell, SWT.OK | SWT.CANCEL | SWT.ICON_WARNING | SWT.APPLICATION_MODAL);
				messageBox.setMessage("The project \"" + projectTreeObject.getName() + "\" has not been saved.\n Do you want to save it before deployment?");
				int ret = messageBox.open();
				if (ret == SWT.OK) {
    				projectTreeObject.save(false);
       				explorerView.refreshTree();
				}
				else
					bDeploy = false;
   			}
   			
   			ProjectChooseTestCasesDialog dlgTC = null;
           	List<TestCase> listTestCasesSelected = new ArrayList<TestCase>();
           	boolean checkTestCases = dlg.isCheckTestCases();
           	
           	if (checkTestCases) {
           		dlgTC = new ProjectChooseTestCasesDialog(shell, project);
				if (dlgTC.open() == Window.OK) {
					listTestCasesSelected = dlgTC.getTestCasesMap();
				}
           	}
   			
   			if (bDeploy) {
            	ProjectDeployDialog projectDeployDialog = new ProjectDeployDialog(shell, ProjectDeployDialogComposite.class, 
            			"Deploy a Convertigo project", listTestCasesSelected);
            	projectDeployDialog.open();
            	
        		if (projectDeployDialog.getReturnCode() != Window.CANCEL) { 
        			
        		}
   			}
   		}
       }
       catch (Throwable e) {
       	ConvertigoPlugin.logException(e, "Unable to deploy the project!");
       }
       finally {
		shell.setCursor(null);
		waitCursor.dispose();
       }        
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:64,代码来源:ProjectDeployAction.java

示例14: showEditor

private void showEditor(Differ differ) throws PartInitException {
    if (differ.getScript().isDangerDdl(
            !mainPrefs.getBoolean(DB_UPDATE_PREF.DROP_TABLE_STATEMENT),
            !mainPrefs.getBoolean(DB_UPDATE_PREF.ALTER_COLUMN_STATEMENT),
            !mainPrefs.getBoolean(DB_UPDATE_PREF.DROP_COLUMN_STATEMENT),
            !mainPrefs.getBoolean(DB_UPDATE_PREF.RESTART_WITH_STATEMENT))){
        MessageBox mb = new MessageBox(parent.getShell(), SWT.ICON_WARNING | SWT.OK | SWT.CANCEL);
        mb.setText(Messages.sqlScriptDialog_warning);
        mb.setMessage(Messages.sqlScriptDialog_script_contains_statements_that_may_modify_data);
        if (mb.open() != SWT.OK){
            return;
        }
    }

    try {
        boolean inProj = false;
        String creationMode = mainPrefs.getString(DB_UPDATE_PREF.CREATE_SCRIPT_IN_PROJECT);
        // if select "YES" with toggle
        if (creationMode.equals(MessageDialogWithToggle.ALWAYS)) {
            inProj = true;
            // if not select "NO" with toggle, show choice message dialog
        } else if (!creationMode.equals(MessageDialogWithToggle.NEVER)) {
            MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(parent.getShell(),
                    Messages.ProjectEditorDiffer_script_creation_title, Messages.ProjectEditorDiffer_script_creation_message,
                    Messages.remember_choice_toggle, false, mainPrefs, DB_UPDATE_PREF.CREATE_SCRIPT_IN_PROJECT);
            if (dialog.getReturnCode() == IDialogConstants.YES_ID) {
                inProj = true;
            }
        }

        String content = differ.getDiffDirect();
        String filename = generateScriptName();
        if (inProj) {
            IEditorInput file = createProjectScriptFile(content, filename);
            if (loadedRemote instanceof DbInfo) {
                SQLEditor.saveLastDb((DbInfo) loadedRemote, file);
            }
            getSite().getPage().openEditor(file, EDITOR.SQL);
        } else {
            FileUtilsUi.saveOpenTmpSqlEditor(content, filename);
        }
    } catch (CoreException | IOException ex) {
        ExceptionNotifier.notifyDefault(
                Messages.ProjectEditorDiffer_error_creating_file, ex);
    }
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:46,代码来源:ProjectEditorDiffer.java

示例15: doUserConfirmsToOverRide

private int doUserConfirmsToOverRide() {
	MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO|SWT.CANCEL);
	messageBox.setMessage("File already exists in project, do you want to overwrite?");
	return messageBox.open();
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:5,代码来源:MultiParameterFileDialog.java


注:本文中的org.eclipse.swt.SWT.CANCEL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。