当前位置: 首页>>代码示例>>Java>>正文


Java Event.getProperty方法代码示例

本文整理汇总了Java中org.osgi.service.event.Event.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Event.getProperty方法的具体用法?Java Event.getProperty怎么用?Java Event.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.osgi.service.event.Event的用法示例。


在下文中一共展示了Event.getProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleEvent

import org.osgi.service.event.Event; //导入方法依赖的package包/类
@Override
public void handleEvent(Event event) {
	String[] propertyNames = event.getPropertyNames();
	//System.out.println(event.getProperty(propertyNames[0]));
	IStyledTextGazeResponse response = (IStyledTextGazeResponse)event.getProperty(propertyNames[0]);
	Rectangle mBounds = ITrace.getDefault().getRootShell().getBounds();
       int screenX = (int) (response.getGaze().getX() * mBounds.width);
       int screenY = (int) (response.getGaze().getY() * mBounds.height);
       //Rectangle monitorBounds = ITrace.getDefault().monitorBounds;
       if(styledText.isDisposed()) return;
       Rectangle editorBounds = styledText.getBounds();
       Point screenPos = styledText.toDisplay(0, 0);
       editorBounds.x = screenPos.x - mBounds.x;
       editorBounds.y = screenPos.y - mBounds.y;
       if(editorBounds.contains(screenX, screenY)){
       	int relativeX = screenX-editorBounds.x;
       	int relativeY = screenY-editorBounds.y;
       	update(response.getLine()-1,response.getCol(), relativeX, relativeY);
       }
	
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:22,代码来源:TokenHighlighter.java

示例2: handleEvent

import org.osgi.service.event.Event; //导入方法依赖的package包/类
/**
 * Implemented from EventHandler to listen for blueprint events.
 *
 * @param event the event to handle
 */
@Override
public void handleEvent(final Event event) {
    if (EventConstants.TOPIC_CREATED.equals(event.getTopic())) {
        LOG.info("Blueprint container for bundle {} was successfully created",
                event.getProperty(EventConstants.BUNDLE));
        return;
    }

    // If the container timed out waiting for dependencies, we'll destroy it and start it again. This
    // is indicated via a non-null DEPENDENCIES property containing the missing dependencies. The
    // default timeout is 5 min and ideally we would set this to infinite but the timeout can only
    // be set at the bundle level in the manifest - there's no way to set it globally.
    if (EventConstants.TOPIC_FAILURE.equals(event.getTopic())
            && event.getProperty(EventConstants.DEPENDENCIES) != null) {
        Bundle bundle = (Bundle) event.getProperty(EventConstants.BUNDLE);

        List<Object> paths = findBlueprintPaths(bundle);
        if (!paths.isEmpty()) {
            LOG.warn("Blueprint container for bundle {} timed out waiting for dependencies - restarting it",
                    event.getProperty(EventConstants.BUNDLE));

            restartService.restartContainer(bundle, paths);
        }
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:31,代码来源:BlueprintBundleTracker.java

示例3: handleEvent

import org.osgi.service.event.Event; //导入方法依赖的package包/类
@Override
public void handleEvent(Event event) {
    String topic = event.getTopic();
    Object target = event.getProperty(MafiaBossConstants.PROPERTY_KEY_TARGET);

    switch (topic) {
        case MafiaBossConstants.TOPIC_CONVINCE:
            System.out.println("Ray: I helped in punching the shit out of" + target);
            break;
        case MafiaBossConstants.TOPIC_ENCASH:
            System.out.println("Ray: I helped getting the money from " + target);
            break;
        case MafiaBossConstants.TOPIC_SOLVE:
            System.out.println("Ray: I helped killing " + target);
            break;
        default: System.out.println("Ray: I helped with whatever was requested!");
    }
}
 
开发者ID:fipro78,项目名称:osgi-ds-getting-started-pde,代码行数:19,代码来源:Ray.java

示例4: handleEvent

import org.osgi.service.event.Event; //导入方法依赖的package包/类
@Override
public void handleEvent(Event event) {
	logger.debug("Started handling task status.");

	ITaskStatusMessage message = (ITaskStatusMessage) event.getProperty("message");
	ICommandExecutionResult result = (ICommandExecutionResult) event.getProperty("result");

	logger.info("Sending task status message to plugins. Task: {} Status: {}",
			new Object[] { message.getTaskId(), message.getResponseCode() });

	ITask task = result.getCommandExecution().getCommand().getTask();
	String key = buildKey(task.getPlugin().getName(), task.getPlugin().getVersion(), task.getCommandClsId());

	ITaskAwareCommand subscriber = subscribers != null ? subscribers.get(key.toUpperCase(Locale.ENGLISH)) : null;
	if (subscriber != null) {
		try {
			subscriber.onTaskUpdate(result);
			logger.debug("Notified subscriber: {} with task status: {}", new Object[] { subscriber, message });
		} catch (Throwable e) {
			logger.error(e.getMessage(), e);
		}
	}

	logger.info("Handled task status.");

}
 
开发者ID:Pardus-LiderAhenk,项目名称:lider,代码行数:27,代码来源:PluginNotifier.java

示例5: handleEvent

import org.osgi.service.event.Event; //导入方法依赖的package包/类
@Override
public void handleEvent(Event event) {
	logger.debug("Started handling task status.");

	ITaskStatusMessage message = (ITaskStatusMessage) event.getProperty("message");
	ICommandExecutionResult result = (ICommandExecutionResult) event.getProperty("result");

	String recipient = result.getCommandExecution().getCommand().getCommandOwnerUid();
	logger.info("Sending task status message to Lider Console. Task: {} Status: {} JID: {}",
			new Object[] { message.getTaskId(), message.getResponseCode(), recipient });

	try {
		ITaskStatusNotification notification = messageFactory.createTaskStatusNotification(recipient, result);
		messagingService.sendNotification(notification);
	} catch (Exception e) {
		logger.error(e.getMessage(), e);
	}

	logger.info("Handled task status.");
}
 
开发者ID:Pardus-LiderAhenk,项目名称:lider,代码行数:21,代码来源:LiderConsoleNotifier.java

示例6: handleEvent

import org.osgi.service.event.Event; //导入方法依赖的package包/类
@Override
public void handleEvent(Event event) {
	final BookmarkId bookmarkFolderId = new BookmarkId((String) event.getProperty(PROP_BOOKMARK_FOLDER_ID));
	new Job("Updating remote bookmark folder") {

		@Override
		protected IStatus run(IProgressMonitor monitor) {
			try {
				refreshRemoteFolderOperation.refresh(bookmarkFolderId, monitor);
				return Status.OK_STATUS;
			} catch (BookmarksException e) {
				return e.getStatus();
			}
		}

	}.schedule();
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:18,代码来源:RemoteBookmarksTreeChangeEventHandler.java

示例7: handleEvent

import org.osgi.service.event.Event; //导入方法依赖的package包/类
@Override
public void handleEvent(Event event) {
	switch (event.getTopic()) {
	case "event_text_relating_objects/loaded": {
		// eventReceivedRelatingObjectsLoadedEvents(event.getProperty("org.eclipse.e4.data"));
		break;
	}
	case "ui_secondarySelection/corpusNavigator": {
		Object o = event.getProperty("org.eclipse.e4.data");
		if (o instanceof BTSObject) {
			eventReceivedSecondarySelection((BTSObject) o);
		}
		break;
	}
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:17,代码来源:SearchSelectObjectDialog.java

示例8: handleEvent

import org.osgi.service.event.Event; //导入方法依赖的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);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:23,代码来源:EPerspectiveSwitcher.java

示例9: subscribeTopicSelectedElement

import org.osgi.service.event.Event; //导入方法依赖的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);
			}
		}
	}
}
 
开发者ID:fipro78,项目名称:e4-cookbook-migration-guide,代码行数:25,代码来源:PerspectiveSwitcherAddon.java

示例10: handleEvent

import org.osgi.service.event.Event; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void handleEvent(Event event) {
	String itemName = (String) event.getProperty("item");

	String topic = event.getTopic();
	String[] topicParts = topic.split(TOPIC_SEPERATOR);

	if (!(topicParts.length > 2) || !topicParts[0].equals(TOPIC_PREFIX)) {
		return; // we have received an event with an invalid topic
	}
	String operation = topicParts[1];

	if (operation.equals(EventType.COMMAND.toString())) {
		Command command = (Command) event.getProperty("command");
		if (command != null)
			receiveCommand(itemName, command);
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:21,代码来源:RuleEngine.java

示例11: handleEvent

import org.osgi.service.event.Event; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void handleEvent(Event event) {  
	String itemName = (String) event.getProperty("item");
	
	String topic = event.getTopic();
	String[] topicParts = topic.split(TOPIC_SEPERATOR);
	
	if(!(topicParts.length > 2) || !topicParts[0].equals(TOPIC_PREFIX)) {
		return; // we have received an event with an invalid topic
	}
	String operation = topicParts[1];
	
	if(operation.equals(EventType.UPDATE.toString())) {
		State newState = (State) event.getProperty("state");
		if(newState!=null) receiveUpdate(itemName, newState);
	}
	if(operation.equals(EventType.COMMAND.toString())) {
		Command command = (Command) event.getProperty("command");
		if(command!=null) receiveCommand(itemName, command);
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:24,代码来源:AbstractEventSubscriber.java

示例12: sendEvent

import org.osgi.service.event.Event; //导入方法依赖的package包/类
private void sendEvent(Event osgiEvent) {
	boolean trace = log.isTraceEnabled();
	ServiceReference ref = bundleContext.getServiceReference(EVENT_ADMIN);
	if (ref != null) {
		EventAdmin eventAdmin = (EventAdmin) bundleContext.getService(ref);
		if (eventAdmin != null) {
			if (trace) {
				StringBuilder sb = new StringBuilder();
				String[] names = osgiEvent.getPropertyNames();
				sb.append("{");
				for (int i = 0; i < names.length; i++) {
					String name = names[i];
					sb.append(name);
					sb.append("=");
					Object value = osgiEvent.getProperty(name);
					sb.append(ObjectUtils.getDisplayString(value));
					if (i < names.length - 1)
						sb.append(",");
				}
				sb.append("}");

				log.trace("Broadcasting OSGi event " + osgiEvent + " w/ props " + sb.toString());
			}
			publisher.publish(eventAdmin, osgiEvent);
		}
	} else {
		log.trace("No event admin found for broadcasting event " + osgiEvent);
	}
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:30,代码来源:OsgiEventDispatcher.java

示例13: handleEvent

import org.osgi.service.event.Event; //导入方法依赖的package包/类
@Override
public void handleEvent(Event event) {
	if(outFile == null) this.init();
	String[] propertyNames = event.getPropertyNames();
	IGazeResponse response = (IGazeResponse)event.getProperty(propertyNames[0]);
	this.process(response);
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:8,代码来源:JSONGazeExportSolver.java

示例14: handleEvent

import org.osgi.service.event.Event; //导入方法依赖的package包/类
@Override
public void handleEvent(Event event) {
	String[] propertyNames = event.getPropertyNames();
	Gaze gaze = (Gaze)event.getProperty(propertyNames[0]);
	Point leftEye = new Point((int)(gaze.getLeftX() * (screenSize.width/4)),(int)(gaze.getLeftY() * (screenSize.height/4)));
	Point rightEye = new Point((int)(gaze.getRightX() * (screenSize.width/4)),(int)(gaze.getRightY() * (screenSize.height/4)));
	
	drawingPanel.update(leftEye, rightEye, gaze.getLeftValidity(), gaze.getRightValidity());
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:10,代码来源:EyeStatusWindow.java

示例15: handleEvent

import org.osgi.service.event.Event; //导入方法依赖的package包/类
@Override
public void handleEvent(Event event) {
	if(event.getTopic() == "iTrace/newgaze"){
		String[] propertyNames = event.getPropertyNames();
		Gaze g = (Gaze)event.getProperty(propertyNames[0]);
		 if (g != null) {
             if(!rootShell.isDisposed()){
            	 Rectangle monitorBounds = rootShell.getMonitor().getBounds();
            	 int screenX = (int) (g.getX() * monitorBounds.width);
	             int screenY = (int) (g.getY() * monitorBounds.height);
	             IGazeResponse response;
            	 response = handleGaze(screenX, screenY, g);
            	 
            	 if (response != null) {
	                	 if(recording){
	                		 statusLineManager
	                 			.setMessage(String.valueOf(response.getGaze().getSessionTime()));
	                 		registerTime = System.currentTimeMillis();
	                 		if(xmlOutput) eventBroker.post("iTrace/xmlOutput", response);
	                 		if(jsonOutput) eventBroker.post("iTrace/jsonOutput", response);
	                	 }
	                     
	                     if(response instanceof IStyledTextGazeResponse && response != null && showTokenHighlights){
	                     	IStyledTextGazeResponse styledTextResponse = (IStyledTextGazeResponse)response;
	                     	eventBroker.post("iTrace/newstresponse", styledTextResponse);
	                     }
	             }
	         }else{
	         	if((System.currentTimeMillis()-registerTime) > 2000){
	         		statusLineManager.setMessage("");
	         	}
	         }
         }
	}
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:36,代码来源:ITrace.java


注:本文中的org.osgi.service.event.Event.getProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。