本文整理匯總了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;
}
示例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;
}
示例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();
}
}
}
示例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();
}
}
}
示例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();
}