當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。