org.eclipse.e4.ui.di.UISynchronize Java Examples
The following examples show how to use
org.eclipse.e4.ui.di.UISynchronize.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CoreUiUtil.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
@Inject @Optional public void subscribeAppStartupComplete( @UIEventTopic(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE) Event event, UISynchronize sync){ synchronized (lock) { Object property = event.getProperty("org.eclipse.e4.data"); if (property instanceof MApplication) { MApplication application = (MApplication) property; // A RAP application has one application context per client // the resp. context service implementation considers this contextService.getRootContext().setNamed("applicationContext", application.getContext()); if (!delayedInjection.isEmpty()) { for (Object object : delayedInjection) { sync.asyncExec(() -> { injectServices(object); }); } delayedInjection.clear(); } } } }
Example #2
Source File: TransactionsControl.java From offspring with MIT License | 6 votes |
public TransactionsControl(Composite parent, int style, Long accountId, INxtService nxt, IStylingEngine engine, IUserService userService, UISynchronize sync) { super(parent, style); GridLayoutFactory.fillDefaults().numColumns(1).spacing(5, 2).margins(0, 0) .applyTo(this); paginationContainer = new PaginationContainer(this, SWT.NONE); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true) .applyTo(paginationContainer); transactionViewer = new TransactionsViewer( paginationContainer.getViewerParent(), accountId, null, nxt, engine, userService, sync); paginationContainer.setTableViewer(transactionViewer, 300); transactionViewer.getControl().pack(); }
Example #3
Source File: GeneratedBlocksControl.java From offspring with MIT License | 6 votes |
public GeneratedBlocksControl(Composite parent, int style, Long accountId, IStylingEngine engine, INxtService nxt, IUserService userService, UISynchronize sync, IContactsService contactsService) { super(parent, style); GridLayoutFactory.fillDefaults().numColumns(1).spacing(5, 2).margins(0, 0) .applyTo(this); paginationContainer = new PaginationContainer(this, SWT.NONE); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true) .applyTo(paginationContainer); generatedBlocksViewer = new GeneratedBlocksViewer( paginationContainer.getViewerParent(), accountId, engine, nxt, userService, sync, contactsService); paginationContainer.setTableViewer(generatedBlocksViewer, 300); }
Example #4
Source File: MyTradesPart.java From offspring with MIT License | 6 votes |
@PostConstruct public void postConstruct(Composite parent, INxtService nxt, final IUserService userService, IStylingEngine engine, UISynchronize sync, IAssetExchange exchange) { mainComposite = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(1).spacing(5, 2).margins(0, 0) .applyTo(mainComposite); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true) .applyTo(mainComposite); paginationContainer = new PaginationContainer(mainComposite, SWT.NONE); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true) .applyTo(paginationContainer); // tradesViewer = new TradeTableViewer(mainComposite, exchange); tradesViewer = new MyTradesViewer(paginationContainer.getViewerParent(), nxt, ContactsService.getInstance(), engine, userService, sync, exchange); paginationContainer.setTableViewer(tradesViewer, 100); }
Example #5
Source File: AssetsControl.java From offspring with MIT License | 6 votes |
public AssetsControl(Composite parent, int style, Long accountId, INxtService nxt, IUserService userService, IContactsService contactsService, UISynchronize sync, IStylingEngine engine) { super(parent, style); this.accountId = accountId; // this.user = userService.findUser(accountId); GridLayoutFactory.fillDefaults().spacing(10, 5).numColumns(1).applyTo(this); paginationContainer = new PaginationContainer(this, SWT.NONE); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true) .applyTo(paginationContainer); assetsViewer = new AssetsViewer(paginationContainer.getViewerParent(), accountId, nxt, userService, contactsService, sync, engine); paginationContainer.setTableViewer(assetsViewer, 100); }
Example #6
Source File: MergeProcessorUtil.java From MergeProcessor with Apache License 2.0 | 6 votes |
/** * Opens a dialog with the given message and the option to retry or cancel. * * @param message * @return <code>true</code> if the user chose to retry. */ public static boolean bugUserToFixProblem(final String message, final String messageScrollable) { final AtomicBoolean retVal = new AtomicBoolean(); E4CompatibilityUtil.getApplicationContext().get(UISynchronize.class).syncExec(() -> { MessageDialogScrollable dialog = new MessageDialogScrollable(ApplicationUtil.getApplicationShell(), Messages.MergeProcessorUtil_BugUserToFixProblem_Title, null, message, messageScrollable, MessageDialogScrollable.ERROR, new String[] { Messages.MergeProcessorUtil_BugUserToFixProblem_Retry, Messages.MergeProcessorUtil_BugUserToFixProblem_Cancel }, 0); boolean retry = dialog.open() == 0; if (retry) { LOGGER.fine(String.format("User wants to retry. message=%s, messageScrollable=%s", message, //$NON-NLS-1$ messageScrollable)); } else { LOGGER.fine(String.format("User wants to cancel. message=%s, messageScrollable=%s", message, //$NON-NLS-1$ messageScrollable)); } retVal.set(retry); }); return retVal.get(); }
Example #7
Source File: TradesPart.java From offspring with MIT License | 6 votes |
@PostConstruct public void postConstruct(Composite parent, INxtService nxt, final IUserService userService, IStylingEngine engine, UISynchronize sync) { mainComposite = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(1).spacing(5, 2).margins(0, 0) .applyTo(mainComposite); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true) .applyTo(mainComposite); paginationContainer = new PaginationContainer(mainComposite, SWT.NONE); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true) .applyTo(paginationContainer); tradesViewer = new TradesViewer(paginationContainer.getViewerParent(), nxt, ContactsService.getInstance(), engine, userService, sync); paginationContainer.setTableViewer(tradesViewer, 100); }
Example #8
Source File: SellOrderTableViewer.java From offspring with MIT License | 6 votes |
public SellOrderTableViewer(Composite parent, UISynchronize sync) { super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); this.contentProvider = new SellOrderContentProvider(sync); this.comparator = new SellOrderComparator(); setUseHashlookup(false); setContentProvider(contentProvider); setComparator(comparator); createColumns(); /* Pack the columns */ for (TableColumn column : getTable().getColumns()) column.pack(); Table table = getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); }
Example #9
Source File: BuyOrderTableViewer.java From offspring with MIT License | 6 votes |
public BuyOrderTableViewer(Composite parent, UISynchronize sync) { super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); this.contentProvider = new BuyOrderContentProvider(sync); this.comparator = new BuyOrderComparator(); setUseHashlookup(false); setContentProvider(contentProvider); setComparator(comparator); createColumns(); /* Pack the columns */ for (TableColumn column : getTable().getColumns()) column.pack(); Table table = getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); }
Example #10
Source File: CreateAccountHandler.java From offspring with MIT License | 6 votes |
@Execute public void execute(Display display, IWallet wallet, INxtService nxt, IUserService userService, UISynchronize sync) { AddAccountDialog dialog = new AddAccountDialog(display.getActiveShell(), wallet, nxt); if (dialog.open() == Window.OK) { try { boolean select = userService.getActiveUser() == null; for (IWalletAccount walletAccount : wallet.getAccounts()) { if (walletAccount instanceof INXTWalletAccount) { userService.createUser(walletAccount.getLabel(), ((INXTWalletAccount) walletAccount).getPrivateKey(), ((INXTWalletAccount) walletAccount).getAccountNumber()); } } if (select && userService.getUsers().size() > 0) userService.setActiveUser(userService.getUsers().get(0)); } catch (WalletNotInitializedException e) { logger.error("Wallet not initialized", e); } } }
Example #11
Source File: GitMergeUtil.java From MergeProcessor with Apache License 2.0 | 6 votes |
/** * Resolve the conflicts by showing the information to the user and ask him to * fix them. * * @param conflicts the conflicts to fix by the user * @return the handling the user selected */ private UserHandling resolveConflictsByUser(final Collection<String> conflicts) { final AtomicInteger result = new AtomicInteger(); E4CompatibilityUtil.getApplicationContext().get(UISynchronize.class).syncExec(() -> { final String[] buttons = { UserHandling.OPEN_REPOSITORY.getLabel(), UserHandling.RETRY.getLabel(), UserHandling.CANCEL.getLabel() }; final StringBuilder sb = new StringBuilder(); for (String conflict : conflicts) { sb.append(conflict).append(System.lineSeparator()); } final MessageDialogScrollable dialog = new MessageDialogScrollable( ApplicationUtil.getApplicationShell(), "Merge Conflict", null, "Fix the merge conflict.", "The following files contain merge conflicts:" + System.lineSeparator() + sb.toString(), MessageDialogScrollable.QUESTION, buttons, 1); result.set(dialog.open()); }); switch (result.get()) { case 0: return UserHandling.OPEN_REPOSITORY; case 1: return UserHandling.RETRY; case 2: default: return UserHandling.CANCEL; } }
Example #12
Source File: GitMergeUtil.java From MergeProcessor with Apache License 2.0 | 6 votes |
/** * Opens a dialog asking the user what to do. * * @param e the exception to report to the user * @return the selection of the user how to continue */ private static UserHandling handleByUser(final Exception e) { final AtomicInteger result = new AtomicInteger(); E4CompatibilityUtil.getApplicationContext().get(UISynchronize.class).syncExec(() -> { final String[] buttons = { UserHandling.RETRY.getLabel(), UserHandling.REVERT_AND_RETRY.getLabel(), UserHandling.CANCEL.getLabel() }; final GitMergeErrorDialog dialog = new GitMergeErrorDialog(e, buttons, 0); result.set(dialog.open()); }); switch (result.get()) { case 0: return UserHandling.RETRY; case 1: return UserHandling.REVERT_AND_RETRY; case 2: default: return UserHandling.CANCEL; } }
Example #13
Source File: InspectBlockDialog.java From offspring with MIT License | 5 votes |
public InspectBlockDialog(Shell shell, Long blockId, INxtService nxt, IStylingEngine engine, IUserService userService, UISynchronize sync, IContactsService contactsService) { super(shell); this.blockId = blockId; this.engine = engine; this.nxt = nxt; this.userService = userService; this.sync = sync; this.contactsService = contactsService; }
Example #14
Source File: HandlerDisplayIgnored.java From MergeProcessor with Apache License 2.0 | 5 votes |
@Execute public void execute(MItem item, MPart part, IConfiguration configuration, UISynchronize uiSynch) { LogUtil.entering(item, part, configuration, uiSynch); configuration.setDisplayIgnored(item.isSelected()); final Object object = part.getObject(); if (object instanceof Dashboard) { final Dashboard view = (Dashboard) object; uiSynch.syncExec(view::refresh); } LogUtil.exiting(); }
Example #15
Source File: InspectBlockDialog.java From offspring with MIT License | 5 votes |
/** * Static method that opens a new dialog or switches the existing dialog to * another block id. The dialog shows back and forward buttons to navigate * between accounts inspected. * * @param blockId * @return */ public static void show(final Long blockId, final INxtService nxt, final IStylingEngine engine, final IUserService userService, final UISynchronize sync, final IContactsService contactsService) { sync.syncExec(new Runnable() { @Override public void run() { Shell shell = Display.getCurrent().getActiveShell(); if (shell != null) { while (shell.getParent() != null) { shell = shell.getParent().getShell(); } } if (INSTANCE == null) { INSTANCE = new InspectBlockDialog(shell, blockId, nxt, engine, userService, sync, contactsService); INSTANCE.history.add(blockId); INSTANCE.historyCursor = 0; INSTANCE.open(); } else { INSTANCE.history.add(blockId); INSTANCE.historyCursor = INSTANCE.history.size() - 1; INSTANCE.setBlockId(blockId); INSTANCE.getShell().forceActive(); } } }); }
Example #16
Source File: InspectAccountDialog.java From offspring with MIT License | 5 votes |
public InspectAccountDialog(Shell shell, Long accountId, INxtService nxt, IStylingEngine engine, IUserService userService, UISynchronize sync, IContactsService contactsService) { super(shell); this.nxt = nxt; this.engine = engine; this.accountId = accountId; this.userService = userService; this.sync = sync; this.contactsService = contactsService; }
Example #17
Source File: AskOrdersViewer.java From offspring with MIT License | 5 votes |
public AskOrdersViewer(Composite parent, INxtService nxt, IContactsService contactsService, IStylingEngine engine, IUserService userService, UISynchronize sync) { super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER); this.nxt = nxt; this.contactsService = contactsService; this.engine = engine; this.userService = userService; this.sync = sync; setGenericTable(new IGenericTable() { @Override public int getDefaultSortDirection() { return GenericComparator.ASSCENDING; } @Override public IGenericTableColumn getDefaultSortColumn() { return columnPrice; } @Override public IStructuredContentProvider getContentProvider() { return contentProvider; } @Override public IGenericTableColumn[] getColumns() { return new IGenericTableColumn[] { columnTotal, columnPrice, columnQuantity, columnSeller }; } }); refresh(); }
Example #18
Source File: MyAssetsViewer.java From offspring with MIT License | 5 votes |
public MyAssetsViewer(Composite parent, INxtService nxt, IUserService userService, IContactsService contactsService, UISynchronize sync, IStylingEngine engine) { super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER); this.nxt = nxt; this.userService = userService; this.contactsService = contactsService; this.sync = sync; this.engine = engine; setGenericTable(new IGenericTable() { @Override public int getDefaultSortDirection() { return GenericComparator.DESCENDING; } @Override public IGenericTableColumn getDefaultSortColumn() { return columnName; } @Override public IStructuredContentProvider getContentProvider() { return contentProvider; } @Override public IGenericTableColumn[] getColumns() { return new IGenericTableColumn[] { columnName, columnBalance, columnQuantity, columnIssuer, columnDescription }; } }); setInput(1); }
Example #19
Source File: RecentBlocksViewer.java From offspring with MIT License | 5 votes |
public RecentBlocksViewer(Composite parent, INxtService nxt, IStylingEngine engine, IUserService userService, UISynchronize sync, IContactsService contactsService) { super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER); this.nxt = nxt; this.engine = engine; this.userService = userService; this.sync = sync; this.contactsService = contactsService; setGenericTable(new IGenericTable() { @Override public int getDefaultSortDirection() { return 0; // not used } @Override public IGenericTableColumn getDefaultSortColumn() { return null; } @Override public IStructuredContentProvider getContentProvider() { return contentProvider; } @Override public IGenericTableColumn[] getColumns() { return new IGenericTableColumn[] { columnHeight, columnDate, columnID, columnFee, columnAmount, columnTransactionCount, columnEmpty }; } }); refresh(); }
Example #20
Source File: MyTradesViewer.java From offspring with MIT License | 5 votes |
public MyTradesViewer(Composite parent, INxtService nxt, IContactsService contactsService, IStylingEngine engine, IUserService userService, UISynchronize sync, IAssetExchange exchange) { super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER); this.nxt = nxt; this.contactsService = contactsService; this.engine = engine; this.userService = userService; this.sync = sync; this.exchange = exchange; setGenericTable(new IGenericTable() { @Override public int getDefaultSortDirection() { return GenericComparator.DESCENDING; } @Override public IGenericTableColumn getDefaultSortColumn() { return columnPrice; } @Override public IStructuredContentProvider getContentProvider() { return contentProvider; } @Override public IGenericTableColumn[] getColumns() { return new IGenericTableColumn[] { columnDate, columnPrice, columnQuantity, columnAskOrder, columnBidOrder }; } }); refresh(); }
Example #21
Source File: SendMessageHandler.java From offspring with MIT License | 5 votes |
@Execute public void execute(Shell shell, INxtService nxt, IUserService userService, UISynchronize sync, IStylingEngine engine) { new WizardDialog(shell, new SendMessageWizard(userService, nxt, null, null, true)) .open(); }
Example #22
Source File: RecentTransactionsViewer.java From offspring with MIT License | 5 votes |
public RecentTransactionsViewer(Composite parent, INxtService nxt, IStylingEngine engine, IUserService userService, UISynchronize sync, IContactsService contactsService) { super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER); this.nxt = nxt; this.engine = engine; this.userService = userService; this.sync = sync; this.contactsService = contactsService; setGenericTable(new IGenericTable() { @Override public int getDefaultSortDirection() { return 0; // not used } @Override public IGenericTableColumn getDefaultSortColumn() { return null; } @Override public IStructuredContentProvider getContentProvider() { return contentProvider; } @Override public IGenericTableColumn[] getColumns() { return new IGenericTableColumn[] { columnHeight, columnDate, columnID, columnSender, columnReceiver, columnAmount, columnFee, columnTransactionType, columnEmpty }; } }); refresh(); }
Example #23
Source File: LookupTransactionHandler.java From offspring with MIT License | 5 votes |
@Execute public void execute(INxtService nxt, IStylingEngine engine, IUserService userService, UISynchronize sync) { InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "Lookup Transaction", "Enter transaction id", "", new TransactionValidator()); if (dialog.open() == Window.OK) { Long id = Convert.parseUnsignedLong(dialog.getValue()); InspectTransactionDialog.show(id, nxt, engine, userService, sync, ContactsService.getInstance()); } }
Example #24
Source File: AuthTokenHandler.java From offspring with MIT License | 5 votes |
@Execute public void execute(Shell shell, IUserService userService, INxtService nxt, UISynchronize sync) { AuthTokenDialog dialog = new AuthTokenDialog(shell, nxt, userService); dialog.create(); dialog.setBlockOnOpen(true); if (dialog.open() == Window.OK) { } }
Example #25
Source File: LookupBlockHandler.java From offspring with MIT License | 5 votes |
@Execute public void execute(INxtService nxt, IStylingEngine engine, IUserService userService, UISynchronize sync) { InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "Lookup Block", "Enter block id", "", new BlockValidator()); if (dialog.open() == Window.OK) { Long id = Convert.parseUnsignedLong(dialog.getValue()); InspectBlockDialog.show(id, nxt, engine, userService, sync, ContactsService.getInstance()); } }
Example #26
Source File: LookupAccountHandler.java From offspring with MIT License | 5 votes |
@Execute public void execute(INxtService nxt, IStylingEngine engine, IUserService userService, UISynchronize sync) { InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "Lookup Account", "Enter account number", "", new AccountValidator()); if (dialog.open() == Window.OK) { Long id = Convert.parseUnsignedLong(dialog.getValue()); InspectAccountDialog.show(id, nxt, engine, userService, sync, ContactsService.getInstance()); } }
Example #27
Source File: TradesViewer.java From offspring with MIT License | 5 votes |
public TradesViewer(Composite parent, INxtService nxt, IContactsService contactsService, IStylingEngine engine, IUserService userService, UISynchronize sync) { super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER); this.nxt = nxt; this.contactsService = contactsService; this.engine = engine; this.userService = userService; this.sync = sync; setGenericTable(new IGenericTable() { @Override public int getDefaultSortDirection() { return GenericComparator.DESCENDING; } @Override public IGenericTableColumn getDefaultSortColumn() { return columnPrice; } @Override public IStructuredContentProvider getContentProvider() { return contentProvider; } @Override public IGenericTableColumn[] getColumns() { return new IGenericTableColumn[] { columnDate, columnPrice, columnQuantity, columnAskOrder, columnBidOrder }; } }); refresh(); }
Example #28
Source File: OffspringChartComposite.java From offspring with MIT License | 5 votes |
public OffspringChartComposite(Composite parent, int style, UISynchronize sync) { super(parent, style); setLayout(new FillLayout()); this.sync = sync; chartComposite = new ChartComposite(this, SWT.BORDER, null, true); chartComposite.setDisplayToolTips(true); chartComposite.setHorizontalAxisTrace(true); chartComposite.setVerticalAxisTrace(true); }
Example #29
Source File: UpdateHandler.java From offspring with MIT License | 5 votes |
@Execute public void execute(Display display, Shell shell, UISynchronize sync, IProvisioningAgent agent, INxtService nxt, IDataProviderPool pool, IWorkbench workbench) { UpdateDialog dialog = new UpdateDialog(display, shell, sync, agent, pool, workbench); dialog.create(); dialog.open(); }
Example #30
Source File: QuitHandler.java From offspring with MIT License | 5 votes |
@Execute public void execute(Display display, IEventBroker broker, INxtService nxt, IDataProviderPool pool, IWorkbench workbench, UISynchronize sync) { if (Shutdown.execute(display.getActiveShell(), broker, sync, nxt, pool)) { workbench.close(); } }