本文整理汇总了Java中org.eclipse.e4.ui.workbench.UIEvents类的典型用法代码示例。如果您正苦于以下问题:Java UIEvents类的具体用法?Java UIEvents怎么用?Java UIEvents使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UIEvents类属于org.eclipse.e4.ui.workbench包,在下文中一共展示了UIEvents类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleEvent
import org.eclipse.e4.ui.workbench.UIEvents; //导入依赖的package包/类
@Override
public void handleEvent(Event event) {
if (window == null)
return;
MUIElement changedElement = (MUIElement) event.getProperty(UIEvents.EventTags.ELEMENT);
if (!(changedElement instanceof MPerspective))
return;
MPerspective perspective = (MPerspective) changedElement;
if (!perspective.isToBeRendered())
return;
MWindow perspectiveWindow = perspective.getContext().get(MWindow.class);
if (window != perspectiveWindow)
return;
String attName = (String) event.getProperty(UIEvents.EventTags.ATTNAME);
Object newValue = event.getProperty(UIEvents.EventTags.NEW_VALUE);
control.updateAttributeFor(perspective, attName, newValue);
}
示例2: subscribeTopicSelectedElement
import org.eclipse.e4.ui.workbench.UIEvents; //导入依赖的package包/类
@Inject
@Optional
public void subscribeTopicSelectedElement(
@UIEventTopic(UIEvents.ElementContainer.TOPIC_SELECTEDELEMENT) Event event,
MApplication application) {
Object newValue = event.getProperty(EventTags.NEW_VALUE);
if (newValue instanceof MPerspective) {
boolean isPerspectiveOne = ((MPerspective) newValue).getElementId().equals(PERSPECTIVE_ONE);
MTrimBar top = (MTrimBar) modelService.find("org.eclipse.ui.trimbar.top", application.getChildren().get(0));
for (MTrimElement item : top.getChildren()) {
if ((isPerspectiveOne && item.getElementId().equals(SECOND_TOOLBAR))
|| !isPerspectiveOne && item.getElementId().equals(FIRST_TOOLBAR)) {
item.setVisible(false);
}
else if ((!isPerspectiveOne && item.getElementId().equals(SECOND_TOOLBAR))
|| isPerspectiveOne && item.getElementId().equals(FIRST_TOOLBAR)) {
item.setVisible(true);
}
}
}
}
示例3: postContextCreate
import org.eclipse.e4.ui.workbench.UIEvents; //导入依赖的package包/类
@PostContextCreate
void postContextCreate(final IEventBroker eventBroker, IApplicationContext context) {
// configure log4j
BasicConfigurator.configure();
Logger.getRootLogger().setLevel(Level.INFO);
// register for startup completed event
eventBroker.subscribe(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE, new EventHandler() {
@Override
public void handleEvent(Event event) {
// close dynamic splash screen
Loading.close();
eventBroker.unsubscribe(this);
}
});
// close static splash screen
context.applicationRunning();
// open dynamic splash screen
Loading.open();
}
示例4: selectedElement
import org.eclipse.e4.ui.workbench.UIEvents; //导入依赖的package包/类
@Inject
@Optional
public void selectedElement(@EventTopic(UIEvents.ElementContainer.TOPIC_SELECTEDELEMENT) Event event, EModelService modelService) {
if (!UIEvents.isSET(event)) {
return;
}
Object newlySelectedPerspective = event.getProperty(EventTags.NEW_VALUE);
if (newlySelectedPerspective instanceof MPerspective) {
MPerspective perspectiveToBeCloned = (MPerspective) newlySelectedPerspective;
MWindow topLevelWindow = modelService.getTopLevelWindowFor(perspectiveToBeCloned);
// try to find already existing snippet
if (null == modelService.findSnippet(topLevelWindow, perspectiveToBeCloned.getElementId())) {
// clone perspective in case there is no snippet yet
modelService.cloneElement(perspectiveToBeCloned, topLevelWindow);
}
}
}
示例5: name
import org.eclipse.e4.ui.workbench.UIEvents; //导入依赖的package包/类
@Inject
@Optional
public void name(@UIEventTopic(UIEvents.UILifeCycle.ACTIVATE) Event event) {
if(!preferencesInitialized) {
preferencesInitialized = true;
configureJDTUi();
configureJDTCore();
configurePDEUi();
configureIde();
configureWorkbench();
configurePerformanceMonitoring();
configureDebug();
configureEditor();
configureXMLEditor();
configureMemoryMonitorActive();
}
}
示例6: init
import org.eclipse.e4.ui.workbench.UIEvents; //导入依赖的package包/类
void init() {
// Handles the UI element changes (label, tooltip, icon)
eventBroker.subscribe(UIEvents.UILabel.TOPIC_ALL, labelHandler);
// Handles the model's list of renderable elements
eventBroker.subscribe(UIEvents.UIElement.TOPIC_TOBERENDERED, toBeRenderedHandler);
// Handles the changes in the selected element
eventBroker.subscribe(UIEvents.ElementContainer.TOPIC_SELECTEDELEMENT, selectionHandler);
// Handles when whole perspective stacks are added and removed
eventBroker.subscribe(UIEvents.ElementContainer.TOPIC_CHILDREN, childrenHandler);
}
示例7: updateAttributeFor
import org.eclipse.e4.ui.workbench.UIEvents; //导入依赖的package包/类
@Override
public void updateAttributeFor(MPerspective perspective, String attName,
Object newValue) {
ToolItem item = getToolItemFor(perspective);
if (showShortcutText && UIEvents.UILabel.LABEL.equals(attName)) {
String newName = (String) newValue;
item.setText(newName != null ? newName : _null);
} else if (UIEvents.UILabel.TOOLTIP.equals(attName)) {
String newTip = (String) newValue;
item.setToolTipText(newTip);
} else if (UIEvents.UILabel.ICONURI.equals(attName)) {
ImageDescriptor descriptor = getIconFor((String) newValue);
Image newIcon = null;
Image oldIcon = item.getImage();
if (descriptor != null)
newIcon = descriptor.createImage();
item.setImage(newIcon);
if (oldIcon != null) {
oldIcon.dispose();
oldIcon = null;
}
if (!showShortcutText) {
String label = null;
if (item.getData() instanceof MPerspective)
label = ((MPerspective) item.getData()).getLocalizedLabel();
else
label = item.getText();
item.setText(item.getImage() == null ? label : _null);
}
}
}
示例8: passDataToMPart
import org.eclipse.e4.ui.workbench.UIEvents; //导入依赖的package包/类
private void passDataToMPart(final PositionWithOrderAndArticleInfoDTO positionViewDTO, final MPart mPart) {
eventBroker.subscribe(UIEvents.Context.TOPIC_CONTEXT, new EventHandler() {
@Override
public void handleEvent(final Event event) {
Object elementObj = event.getProperty(UIEvents.EventTags.ELEMENT);
Object newObj = event.getProperty(UIEvents.EventTags.NEW_VALUE);
if (elementObj == mPart && newObj instanceof IEclipseContext) {
IEclipseContext castedContext = (IEclipseContext) newObj;
castedContext.set(PositionWithOrderAndArticleInfoDTO.class, positionViewDTO);
eventBroker.unsubscribe(this);
}
}
});
}
示例9: subscribeTopicChildAdded
import org.eclipse.e4.ui.workbench.UIEvents; //导入依赖的package包/类
@Inject
@Optional
private void subscribeTopicChildAdded(@UIEventTopic(ElementContainer.TOPIC_CHILDREN) Event event) {
if (event.getProperty(UIEvents.EventTags.ELEMENT) instanceof MPerspectiveStack) {
System.out.println("perspective added");
if (UIEvents.isADD(event)) {
}
}
}
示例10: handleEvent
import org.eclipse.e4.ui.workbench.UIEvents; //导入依赖的package包/类
@Override
public void handleEvent(final Event inEvent) {
if (!UIEvents.isSET(inEvent)) {
return;
}
final Object lElement = inEvent.getProperty(UIEvents.EventTags.ELEMENT);
if (!(lElement instanceof MWindow)) {
return;
}
final MWindow lWindow = (MWindow) lElement;
if ("com.dgex.offspring.application.mainwindow".equals(lWindow
.getElementId())) {
logger.trace(UIEvents.Context.TOPIC_CONTEXT);
if (lWindow.equals(inEvent.getProperty("ChangedElement"))
&& lWindow.getContext() != null) {
lWindow.getContext().runAndTrack(new RunAndTrack() {
@Override
public boolean changed(final IEclipseContext inContext) {
final Object lHandler = inContext.get(IWindowCloseHandler.class);
if (!quitHandler.equals(lHandler)) {
inContext.set(IWindowCloseHandler.class, quitHandler);
}
return true;
}
});
}
}
}
示例11: hookListeners
import org.eclipse.e4.ui.workbench.UIEvents; //导入依赖的package包/类
@PostConstruct
void hookListeners(INxtService nxt, Display display, IDataProviderPool pool) {
this.nxt = nxt;
this.display = display;
this.pool = pool;
broker.subscribe(UIEvents.Context.TOPIC_CONTEXT, eventHandler);
}
示例12: hookListeners
import org.eclipse.e4.ui.workbench.UIEvents; //导入依赖的package包/类
@PostConstruct
void hookListeners(MApplication application, IUserService userService,
IWallet wallet, IDataProviderPool pool, INxtService nxt,
IAssetExchange exchange) {
this.application = application;
this.userService = userService;
this.wallet = wallet;
this.pool = pool;
this.nxt = nxt;
this.exchange = exchange;
broker.subscribe(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE, eventHandler);
}
示例13: partActivation
import org.eclipse.e4.ui.workbench.UIEvents; //导入依赖的package包/类
@Inject
@Optional
public void partActivation(
@UIEventTopic(UIEvents.UILifeCycle.ACTIVATE) Event event) {
if (viewer != null && !viewer.getControl().isDisposed()) {
viewer.refresh();
}
}
示例14: partActivation
import org.eclipse.e4.ui.workbench.UIEvents; //导入依赖的package包/类
@Inject
@Optional
public void partActivation(
@UIEventTopic(UIEvents.UILifeCycle.ACTIVATE) Event event) {
if (assetsViewer != null && !assetsViewer.getControl().isDisposed()) {
assetsViewer.refresh();
}
}
示例15: partActivation
import org.eclipse.e4.ui.workbench.UIEvents; //导入依赖的package包/类
/**
* remove selection on other tabs if any tab was activated
*
* @param event
*/
@Inject
@Optional
public void partActivation(@UIEventTopic(UIEvents.UILifeCycle.ACTIVATE) Event event) {
if (event != null && event.getPropertyNames() != null) {
// get active part
Object obj = event.getProperty(event.getPropertyNames()[0]);
if (obj instanceof MPart) {
MPart part = (MPart) obj;
// TODO do not do it many times
// clear selection for non-active tabs
if (part.getObject() != this) {
if (log.isDebugEnabled()) {
log.debug("part {} was activated", //$NON-NLS-1$
String.valueOf(tabService.getTabId(part)));
}
IEclipseContext activeWindowContext = application.getContext().getActiveChild();
if (activeWindowContext != null) {
// clear selection on opposite part
tabService.clearSelection(partService.getOppositePart(activePart));
}
}
// restore selection
else {
}
}
}
}