本文整理汇总了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();
}