本文整理汇总了Java中org.eclipse.jface.window.Window类的典型用法代码示例。如果您正苦于以下问题:Java Window类的具体用法?Java Window怎么用?Java Window使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Window类属于org.eclipse.jface.window包,在下文中一共展示了Window类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openEditorDialog
import org.eclipse.jface.window.Window; //导入依赖的package包/类
/**
* Open the config editor dialog for editing an existing configuration.
* This is called, when edit button is pressed.
*/
private void openEditorDialog() {
List list = getListControl(parent);
int index = list.getSelectionIndex();
if (index < 0) {
// no item selected from the list, do nothing
return;
}
String name = list.getItem(index);
if (name == null || name.length() == 0) {
// no name for the item, can't load config
return;
}
registry.setActiveViewer(name.substring(0, name.indexOf('(')-1));
ViewerConfigDialog dialog = new ViewerConfigDialog(editButton.getShell(),
(ViewerAttributeRegistry) registry.clone());
int code = dialog.open();
if (code == Window.OK) {
registry.mergeWith(dialog.getRegistry());
list.setItem(index, registry.getActiveViewer() + " (" + registry.getCommand() + ")");
}
}
示例2: setupDialog
import org.eclipse.jface.window.Window; //导入依赖的package包/类
private void setupDialog() {
browseButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
SingleClassSelectionDialog dialog = singleClassSelectionDialogProvider.get();
dialog.setInitialPattern(model.getSuperClass().getFullSpecifier());
dialog.open();
if (dialog.getReturnCode() == Window.CANCEL) {
return;
}
Object result = dialog.getFirstResult();
if (result instanceof IEObjectDescription) {
IEObjectDescription objectDescription = (IEObjectDescription) result;
URI objectUri = ((IEObjectDescription) result).getEObjectURI();
model.setSuperClass(
new ClassifierReference(objectDescription.getQualifiedName(), objectUri));
}
}
});
}
示例3: showErrorDialogWithStackTrace
import org.eclipse.jface.window.Window; //导入依赖的package包/类
/**
* Shows JFace ErrorDialog but improved by constructing full stack trace in detail area.
*
* @return true if OK was pressed
*/
public static boolean showErrorDialogWithStackTrace(String msg, Throwable throwable) {
// Temporary holder of child statuses
List<Status> childStatuses = new ArrayList<>();
for (StackTraceElement stackTraceElement : throwable.getStackTrace()) {
childStatuses.add(new Status(IStatus.ERROR, "N4js-plugin-id", stackTraceElement.toString()));
}
MultiStatus ms = new MultiStatus("N4js-plugin-id", IStatus.ERROR,
childStatuses.toArray(new Status[] {}), // convert to array of statuses
throwable.getLocalizedMessage(), throwable);
final AtomicBoolean result = new AtomicBoolean(true);
Display.getDefault()
.syncExec(
() -> result.set(
ErrorDialog.openError(null, "Error occurred while organizing ", msg, ms) == Window.OK));
return result.get();
}
示例4: createWorkingSet
import org.eclipse.jface.window.Window; //导入依赖的package包/类
private void createWorkingSet() {
if (manager instanceof MutableWorkingSetManager) {
final WorkingSetNewWizard wizard = ((MutableWorkingSetManager) manager).createNewWizard();
// set allWorkingSets according to dialog to use it as a base for validation
wizard.setAllWorkingSets(allWorkingSets);
final WizardDialog dialog = new WizardDialog(getShell(), wizard);
if (dialog.open() == Window.OK) {
final WorkingSet workingSet = wizard.getWorkingSet().orNull();
if (workingSet != null) {
diffBuilder.add(workingSet);
getShell().getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
allWorkingSets.add(workingSet);
tableViewer.add(workingSet);
tableViewer.setChecked(workingSet, true);
}
});
}
}
}
}
示例5: pickDevice
import org.eclipse.jface.window.Window; //导入依赖的package包/类
private IDevice pickDevice() {
List<IDevice> devices = DebugBridge.getDevices();
if (devices.size() == 0) {
MessageDialog.openError(mViewer.getShell(),
"Error obtaining Device Screenshot",
"No Android devices were detected by adb.");
return null;
} else if (devices.size() == 1) {
return devices.get(0);
} else {
DevicePickerDialog dlg = new DevicePickerDialog(mViewer.getShell(), devices);
if (dlg.open() != Window.OK) {
return null;
}
return dlg.getSelectedDevice();
}
}
示例6: triggerEditDialog
import org.eclipse.jface.window.Window; //导入依赖的package包/类
protected void triggerEditDialog ( final ISelection selection )
{
if ( selection.isEmpty () || ! ( selection instanceof IStructuredSelection ) )
{
return;
}
final Object o = ( (IStructuredSelection)selection ).getFirstElement ();
final Map.Entry<?, ?> entry = AdapterHelper.adapt ( o, Map.Entry.class );
if ( entry == null )
{
return;
}
final EntryEditDialog dlg = new EntryEditDialog ( getSite ().getShell (), entry );
if ( dlg.open () == Window.OK )
{
updateEntry ( "" + entry.getKey (), dlg.getKey (), dlg.getValue () );
}
}
示例7: selectMaster
import org.eclipse.jface.window.Window; //导入依赖的package包/类
private MasterSelectionDialog selectMaster () throws CoreException
{
final World world = findInfrastructureWorld ();
if ( world == null )
{
return null;
}
final MasterSelectionDialog dlg = new MasterSelectionDialog ( getShell (), world );
if ( dlg.open () == Window.OK )
{
return dlg;
}
else
{
return null;
}
}
示例8: selectDriver
import org.eclipse.jface.window.Window; //导入依赖的package包/类
private Driver selectDriver () throws CoreException
{
final World world = findInfrastructureWorld ();
if ( world == null )
{
return null;
}
final DriverSelectionDialog dlg = new DriverSelectionDialog ( getShell (), world );
if ( dlg.open () == Window.OK )
{
return dlg.getDriver ();
}
else
{
return null;
}
}
示例9: createCriteriasFromSelection
import org.eclipse.jface.window.Window; //导入依赖的package包/类
public void createCriteriasFromSelection(Document dom) throws EngineException {
String className = "com.twinsoft.convertigo.beans.core.Criteria";
// Retrieve selected criterias xpath
String criteriaXpath = xpathEvaluator.getSelectionXpath();
// Retrieve parent ScreenClass
HtmlScreenClass parentObject = getParentHtmlScreenClass();
NewObjectWizard newObjectWizard = new NewObjectWizard(parentObject, className, criteriaXpath, dom);
WizardDialog wzdlg = new WizardDialog(Display.getCurrent().getActiveShell(), newObjectWizard);
wzdlg.setPageSize(850, 650);
wzdlg.open();
if (wzdlg.getReturnCode() != Window.CANCEL) {
Criteria criteria = (Criteria)newObjectWizard.newBean;
// Reload parent ScreenClass in Tree
fireObjectChanged(new CompositeEvent(parentObject));
// Set selection on last created criteria (will expand tree to new criteria)
if (criteria != null) fireObjectSelected(new CompositeEvent(criteria));
// Set back selection on parent ScreenClass
fireObjectSelected(new CompositeEvent(parentObject));
}
}
示例10: chooseGW4EProject
import org.eclipse.jface.window.Window; //导入依赖的package包/类
public static IJavaProject chooseGW4EProject(IJavaProject javaProject) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
IJavaProject[] projects = getGW4EProjects();
ILabelProvider labelProvider = new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, labelProvider);
dialog.setTitle(MessageUtil.getString("projectdialog_title"));
dialog.setMessage(MessageUtil.getString("projectdialog_message"));
dialog.setElements(projects);
if (javaProject != null) {
dialog.setInitialSelections(new Object[] { javaProject });
}
if (dialog.open() == Window.OK) {
return (IJavaProject) dialog.getFirstResult();
}
return null;
}
示例11: getJocciClient
import org.eclipse.jface.window.Window; //导入依赖的package包/类
/**
* Get the jOCCI client.
* It is created the first time.
* @return the jOCCI client.
*/
private Client getJocciClient()
{
if(jocciClient == null) {
Shell shell = Display.getCurrent().getActiveShell();
OcciServerDialog occiServerDialog = new OcciServerDialog(shell);
occiServerDialog.create();
if (occiServerDialog.open() == Window.OK) {
String occiServerUrl = occiServerDialog.getOcciServerUrl();
if(occiServerUrl == null || occiServerUrl.isEmpty()) {
return null;
}
try {
// Create a jOCCI client.
jocciClient = Importer.newJocciClient(occiServerUrl);
} catch(CommunicationException ce) {
reportException(ce);
jocciClient = null;
}
}
}
return jocciClient;
}
示例12: showComponentTypeSelectionDialog
import org.eclipse.jface.window.Window; //导入依赖的package包/类
public static Optional<ComponentType> showComponentTypeSelectionDialog(Shell parentShell) throws CoreException {
ElementListSelectionDialog dialog = new ElementListSelectionDialog(parentShell, new LabelProvider());
dialog.setElements(loadAllComponentTypes().toArray(new String[0]));
dialog.setTitle("Select subcomponent's type");
// user pressed cancel
if (dialog.open() == Window.OK) {
Object[] objects = dialog.getResult();
for (Object result : objects) {
System.out.println("result = " + result);
}
String typeName = objects[0].toString();
ComponentType type = loadComponentType(typeName);
return Optional.of(type);
}
return Optional.empty();
}
示例13: addRepo
import org.eclipse.jface.window.Window; //导入依赖的package包/类
public void addRepo() throws MetaStoreException, XulException {
MetaStoreFactory<GitRepository> repoFactory = getRepoFactory();
GitRepository repo = new GitRepository();
EditRepositoryDialog dialog = new EditRepositoryDialog( getShell(), repo );
if ( dialog.open() == Window.OK ) {
repoFactory.saveElement( repo );
XulConfirmBox confirmBox = (XulConfirmBox) document.createElement( "confirmbox" );
confirmBox.setTitle( "Success" );
confirmBox.setMessage( "Open now?" );
confirmBox.setAcceptLabel( BaseMessages.getString( PKG, "Dialog.Ok" ) );
confirmBox.setCancelLabel( BaseMessages.getString( PKG, "Dialog.Cancel" ) );
confirmBox.addDialogCallback( (XulDialogLambdaCallback<Object>) ( sender, returnCode, retVal ) -> {
if ( returnCode == Status.ACCEPT ) {
gitController.openGit( repo );
}
} );
confirmBox.open();
}
}
示例14: editRepo
import org.eclipse.jface.window.Window; //导入依赖的package包/类
public void editRepo() throws MetaStoreException {
MetaStoreFactory<GitRepository> repoFactory = getRepoFactory();
List<String> names = repoFactory.getElementNames();
Collections.sort( names );
EnterSelectionDialog esd = new EnterSelectionDialog( getShell(), names.toArray( new String[names.size()] ), "Select Repository", "Select the repository to edit..." );
String name = esd.open();
if ( name == null ) {
return;
}
GitRepository repo = repoFactory.loadElement( name );
EditRepositoryDialog dialog = new EditRepositoryDialog( getShell(), repo );
if ( dialog.open() == Window.OK ) {
repoFactory.saveElement( repo );
}
}
示例15: cloneRepo
import org.eclipse.jface.window.Window; //导入依赖的package包/类
public void cloneRepo() {
GitRepository repo = new GitRepository();
CloneRepositoryDialog dialog = getCloneRepositoryDialog( repo );
if ( dialog.open() == Window.OK ) {
if ( !new File( dialog.getDirectory() ).exists() ) {
showMessageBox( "Error", dialog.getDirectory() + " does not exist" );
return;
}
String url = dialog.getURL();
String directory = null;
directory = dialog.getDirectory() + File.separator + dialog.getCloneAs();
IVCS vcs = getVCS( repo );
vcs.setShell( getShell() );
if ( vcs.cloneRepo( directory, url ) ) {
showMessageBox( "Success", "Success" );
saveRepository( repo );
gitController.openGit( repo );
}
}
}