當前位置: 首頁>>代碼示例>>Java>>正文


Java Display.getActiveShell方法代碼示例

本文整理匯總了Java中org.eclipse.swt.widgets.Display.getActiveShell方法的典型用法代碼示例。如果您正苦於以下問題:Java Display.getActiveShell方法的具體用法?Java Display.getActiveShell怎麽用?Java Display.getActiveShell使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.swt.widgets.Display的用法示例。


在下文中一共展示了Display.getActiveShell方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: runSetup

import org.eclipse.swt.widgets.Display; //導入方法依賴的package包/類
public static boolean runSetup() {
	Display display = Display.getDefault();
	WizardDialog wizardDialog = new WizardDialog(display.getActiveShell(), new SetupWizard()) {
		
		@Override
		protected void configureShell(Shell shell) {
			super.configureShell(shell);
			shell.setSize(730, 700);
			setReturnCode(WizardDialog.CANCEL);
		}
		
	};
	
	int ret = wizardDialog.open(); 
	
	return ret == WizardDialog.OK;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:18,代碼來源:SetupAction.java

示例2: save

import org.eclipse.swt.widgets.Display; //導入方法依賴的package包/類
/**
 * Saves a project.
 *
 * @return <code>false</code> if the save process has been canceled by user.
 */
public boolean save(boolean bDialog) {
	boolean ret = true;
	
	Display display = Display.getDefault();
	Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);		
	
	Shell shell = display.getActiveShell();
	if (shell != null) {
		shell.setCursor(waitCursor);
		
		try {
			if (hasChanged()) {
				Project project = getObject();
				String projectName = project.getName();
				
				int response = SWT.YES;
				if (bDialog) {
					MessageBox messageBox = new MessageBox(shell,SWT.YES | SWT.NO | SWT.ICON_QUESTION | SWT.APPLICATION_MODAL);
					messageBox.setMessage("The project \"" + projectName + "\" has not been saved. Do you want to save your work now?");
					response = messageBox.open();
				}
				
				if (response == SWT.YES) {
					ConvertigoPlugin.logInfo("Saving the project '" + projectName + "'");

					Engine.theApp.databaseObjectsManager.exportProject(project);
					
					hasBeenModified(false);
					ConvertigoPlugin.logInfo("Project '" + projectName + "' saved!");
					
					getIProject().refreshLocal(IResource.DEPTH_ONE, null);
				}
			}
		} catch (Exception e) {
			ConvertigoPlugin.logException(e, "Unable to save the project!");
			ConvertigoPlugin.logInfo("Project NOT saved!");
		} finally {
			shell.setCursor(null);
			waitCursor.dispose();
		}
	}
	
	return ret;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:50,代碼來源:ProjectTreeObject.java

示例3: createBapiTransactions

import org.eclipse.swt.widgets.Display; //導入方法依賴的package包/類
private void createBapiTransactions(final TableItem[] items)
{
	Display display = Display.getDefault();
	Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);		
	Shell shell = display.getActiveShell();
	if (shell != null) {
		try {
			shell.setCursor(waitCursor);
			
			for (int i=0; i < items.length; i++) {
				TableItem item = items[i];
				String bapiName = item.getText(0);
				String bapiDesc = item.getText(1);
				ConvertigoPlugin.logDebug("Creating transaction for BAPI '"+bapiName+"' ...");
				sapConnector.removeSerializedData(bapiName);
				SapJcoTransaction sapJcoTransaction = SapJcoConnector.createSapJcoTransaction(sapConnector, bapiName);
				if (sapJcoTransaction != null) {
					Transaction transaction = sapConnector.getTransactionByName(bapiName);
					if (transaction != null) {
						try {
							File xsdFile = new File(transaction.getSchemaFilePath());
							if (xsdFile.exists()) {
								xsdFile.delete();
							}
						}
						catch (Exception e) {}
						sapConnector.remove(transaction);			
					}
					sapJcoTransaction.setComment(bapiDesc);
					sapConnector.add(sapJcoTransaction);
					fireObjectChanged(new CompositeEvent(sapConnector));
					ConvertigoPlugin.logDebug("Transaction added.");
				}
			}
		} catch (Exception ee) {
			ConvertigoPlugin.logException(ee, "Error while creating transaction(s)");
		} finally {
			shell.setCursor(null);
			waitCursor.dispose();
		}
	}
	
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:44,代碼來源:SapJcoConnectorDesignComposite.java

示例4: createSqlTransactions

import org.eclipse.swt.widgets.Display; //導入方法依賴的package包/類
protected void createSqlTransactions(final TableItem[] items) {
	Display display = Display.getDefault();
	Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);		
	Shell shell = display.getActiveShell();
	if (shell != null) {
		try {
			shell.setCursor(waitCursor);
			for (int i=0; i < items.length; i++) {
				TableItem item = items[i];
				String callableName = item.getText(0);
				String callableDesc = item.getText(1);
				String specific_name = (String) item.getData("specific_name");
				ConvertigoPlugin.logDebug("Creating transaction for CALL '"+callableName+"' ...");
				
				if (specific_name.isEmpty()) {
					specific_name = callableName;
				}
				
				SqlTransaction sqlTransaction = SqlConnector.createSqlTransaction(sqlConnector, callableName, specific_name);
				if (sqlTransaction != null) {
					Transaction transaction = sqlConnector.getTransactionByName(sqlTransaction.getName());
					if (transaction != null) {
						try {
							File xsdFile = new File(transaction.getSchemaFilePath());
							if (xsdFile.exists()) {
								xsdFile.delete();
							}
						}
						catch (Exception e) {}
						sqlConnector.remove(transaction);			
					}
					sqlTransaction.setComment(callableDesc);
					sqlConnector.add(sqlTransaction);
					fireObjectChanged(new CompositeEvent(sqlConnector));
					ConvertigoPlugin.logDebug("Transaction added.");
				}
			}
		} catch (Exception ee) {
			ConvertigoPlugin.logException(ee, "Error while creating transaction(s)");
		} finally {
			shell.setCursor(null);
			waitCursor.dispose();
		}
	}
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:46,代碼來源:SqlConnectorDesignComposite.java

示例5: getShell

import org.eclipse.swt.widgets.Display; //導入方法依賴的package包/類
/**
 * Returns with the active {@link Shell shell} from the {@link #getDisplay() display}. May return with {@code null}
 * if called from non-UI thread.
 *
 * @return the active shell, or {@code null} if invoked from non-UI thread.
 */
public static Shell getShell() {
	final Display display = getDisplay();
	return null == display ? null : display.getActiveShell();
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:11,代碼來源:UIUtils.java


注:本文中的org.eclipse.swt.widgets.Display.getActiveShell方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。