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


Java Event类代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.Event的典型用法代码示例。如果您正苦于以下问题:Java Event类的具体用法?Java Event怎么用?Java Event使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: checkComponentCoordinates

import org.eclipse.swt.widgets.Event; //导入依赖的package包/类
/**
 * Check the coordinates for Component creation
 * @param event
 * @param container
 */
private void checkComponentCoordinates(Event event, Container container) {
	boolean isCordinateChanged = false;
	for (Object component : container.getChildren()) {
		if (component instanceof hydrograph.ui.graph.model.Component) {
			if (((hydrograph.ui.graph.model.Component) component).getLocation().x == event.x
					&& ((hydrograph.ui.graph.model.Component) component).getLocation().y == event.y) {
				event.x = event.x + 20;
				event.y = event.y + 20;
				isCordinateChanged = true;
			}
		} else if (component instanceof hydrograph.ui.graph.model.CommentBox) {
			if (((hydrograph.ui.graph.model.CommentBox) component).getLocation().x == event.x
					&& ((hydrograph.ui.graph.model.CommentBox) component).getLocation().y == event.y) {
				event.x = event.x + 20;
				event.y = event.y + 20;
				isCordinateChanged = true;
			}
		}
	}
	if (!isCordinateChanged) {
		return;
	} else {
		checkComponentCoordinates(event, container);
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:31,代码来源:ComponentSearchUtility.java

示例2: shouldCreateToolTip

import org.eclipse.swt.widgets.Event; //导入依赖的package包/类
@Override
protected boolean shouldCreateToolTip(final Event e) {
	this.lastDescriptor = null;
	if (e.widget instanceof Tree) {
		final Tree tree = (Tree) e.widget;
		final TreeItem item = tree.getItem(new Point(e.x, e.y));

		if (null != item && item.getData() instanceof ResultNode) {
			final ResultNode node = (ResultNode) item.getData();
			if (node.getElement() instanceof TestCase) {
				final URI uri = ((TestCase) node.getElement()).getURI();
				if (null != uri) {
					final StyledTextDescriptor descriptor = getDescriptor(uri);
					if (null != descriptor) {
						this.lastDescriptor = descriptor;
					}
				}
			}
		}
	}

	return null != this.lastDescriptor;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:24,代码来源:TestResultsView.java

示例3: configureShell

import org.eclipse.swt.widgets.Event; //导入依赖的package包/类
@Override
  protected void configureShell(Shell newShell) {
      super.configureShell(newShell);
      this.currentShell = newShell;
      this.currentShell.setText(this.title);
      this.currentShell.getDisplay().addFilter(SWT.Traverse, new Listener() {
	@Override
	public void handleEvent(Event event) {
		switch (event.detail) {
		case SWT.TRAVERSE_ESCAPE:
			event.doit = false;
			cancelPressed();
			break;

		default:
			break;
		}
	}
});
  }
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:21,代码来源:ProjectNewOpen.java

示例4: createViewerToolTipContentArea

import org.eclipse.swt.widgets.Event; //导入依赖的package包/类
@Override
protected Composite createViewerToolTipContentArea(Event event, ViewerCell cell, Composite parent) {
    final Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(2, false));
    composite.setBackground(rowColorBack);
    Plugin plugin = (Plugin) cell.getElement();

    Hyperlink button = new Hyperlink(composite, SWT.FLAT);
    button.setText("\uf05A");
    button.setFont(fontAwesome);
    button.setBackground(composite.getBackground());
    button.setForeground(rowColorTitle);
    button.setUnderlined(false);
    button.addListener (SWT.MouseDown, e -> Program.launch(GLUON_PLUGIN_URL + plugin.getUrl()));
    button.setToolTipText("Click to access the service's JavaDoc");

    Label text = new Label(composite, SWT.LEFT);
    final String description = plugin.getDescription();
    text.setText(description.contains(".") ? description.substring(0, description.indexOf(".")) : description);
    text.setBackground(composite.getBackground());
    text.setForeground(rowColorTitle);
    composite.pack();
    return composite;
}
 
开发者ID:gluonhq,项目名称:ide-plugins,代码行数:25,代码来源:PluginsSWT.java

示例5: handleEvent

import org.eclipse.swt.widgets.Event; //导入依赖的package包/类
@Override
public void handleEvent(Event e) {
	if (e.widget == toolItemAdd) {
		doAdd();
	} else if (e.widget == toolItemDel) {
		doDel();
	} else if (e.widget == toolItemProperty) {
		if (propertyBrowser == null) {
			if (!checkXmlExist()) {
				try {
					updatePropertyBrowser();
				} catch (Exception e1) {
					e1.printStackTrace();
				}
			}
			propertyBrowser = new PropertyBrowser(getContainer().getShell(), me, getXmlFilePath());
		}
		propertyBrowser.open();
	}

}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:22,代码来源:PropEditor.java

示例6: createToolBar

import org.eclipse.swt.widgets.Event; //导入依赖的package包/类
public void createToolBar() {
	bar = new CoolBar(shell, SWT.FLAT | SWT.TOP);
	// bars
	bar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

	createFileSection();
	createEditBar();
	createFontSection();
	createSettingsBar();

	bar.pack();
	bar.addListener(SWT.Resize, new Listener() {

		@Override
		public void handleEvent(Event arg0) {
			pmTrans.adjustLayout();
		}
	});
}
 
开发者ID:juanerasmoe,项目名称:pmTrans,代码行数:20,代码来源:BarManager.java

示例7: handleCallNotify

import org.eclipse.swt.widgets.Event; //导入依赖的package包/类
@Override
protected void handleCallNotify(String eventName, JsonObject parameters) {
	if ("Selection".equals(eventName)) {
		Event event = new Event();
		event.text = parameters.get("index").asString();
		event.data =  parameters.get("data").asString();

		if(event.text.toLowerCase().equals("svgtxtchanged")){
			event.data = this.svgTxtPrefix + parameters.get("data").asString();
		}
		if(event.text.toLowerCase().equals("portmenu") || event.text.toLowerCase().equals("portport")){
			event.x =  parameters.get("x").asInt();
			event.y =  parameters.get("y").asInt();
		}
		notifyListeners(SWT.Selection, event);
	}
}
 
开发者ID:weadmindev,项目名称:network-device-panel,代码行数:18,代码来源:DevicePanelSvg.java

示例8: IntListParameter

import org.eclipse.swt.widgets.Event; //导入依赖的package包/类
public IntListParameter(Composite composite, final String name,
	int defaultValue, final String labels[], final int values[]) {
super(name);
this.name = name;
this.values = values;

    if(labels.length != values.length)
      return;
    int value = COConfigurationManager.getIntParameter(name,defaultValue);
    int index = findIndex(value,values);
    list = new Combo(composite,SWT.SINGLE | SWT.READ_ONLY);
    for(int i = 0 ; i < labels.length  ;i++) {
      list.add(labels[i]);
    }

    setIndex(index);

    list.addListener(SWT.Selection, new Listener() {
         @Override
         public void handleEvent(Event e) {
        	 setIndex(list.getSelectionIndex());
         }
       });

  }
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:26,代码来源:IntListParameter.java

示例9: getListener

import org.eclipse.swt.widgets.Event; //导入依赖的package包/类
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper,
		Widget... widgets) {
	if (helper != null) {
		txtDecorator = (ControlDecoration) helper.get(HelperType.CONTROL_DECORATION);
	}
	Listener listener = new Listener() {

		@Override
		public void handleEvent(Event event) {
			String string = event.text;
			Matcher matchs = Pattern.compile(Constants.REGEX).matcher(string);
			LOGGER.debug("Verifying text format");
			if (!matchs.matches()) {
				txtDecorator.setDescriptionText(Messages.CHARACTERSET);
				txtDecorator.show();
				event.doit = false;

			} else
				txtDecorator.hide();

		}
	};
	return listener;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:26,代码来源:ELTVerifySequenceFieldName.java

示例10: handleEvent

import org.eclipse.swt.widgets.Event; //导入依赖的package包/类
@Override
public final void handleEvent(final Event event) {
	synchronized (lock) {
		if (pending) {
			return;
		}

		pending = true;
	}

	Utils.execSWTThreadLater(0, new SWTRunnable() {
		@Override
		public void runWithDisplay(Display display) {
			synchronized( lock ){
 					pending = false;
 				}
			handleDelayedEvent(event);
		}
	});
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:21,代码来源:DelayedListenerMultiCombiner.java

示例11: handleEvent

import org.eclipse.swt.widgets.Event; //导入依赖的package包/类
public void handleEvent(Event event) {
	if (event.type == SWT.KeyUp && (event.stateMask & SWT.CTRL) != 0) {
		switch (event.character) {
			case 0x01:		// CTRL+A
				showAboutAppleCommander();
				break;
			case 0x03:		// CTRL+C
				createDiskImage();
				break;
			case 0x0f:		// CTRL+O
				openFile();
				break;
			case 0x05:		// CTRL+E
				compareDiskImages();
				break;
		}
	}		
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:19,代码来源:SwtAppleCommander.java

示例12: createCommentBox

import org.eclipse.swt.widgets.Event; //导入依赖的package包/类
private Object createCommentBox(Event event) {
	CommentBox commentBox = null;
	editor = (ELTGraphicalEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
			.getActiveEditor();
	if (editor != null) {
		Container container = editor.getContainer();
		checkComponentCoordinates(event, container);
		org.eclipse.draw2d.geometry.Point point = new org.eclipse.draw2d.geometry.Point(event.x, event.y);
		commentBox = new CommentBox(LABEL);
		commentBox.setSize(new Dimension(300, 60));
		commentBox.setLocation(point);
		CommentBoxCommand command = new CommentBoxCommand(commentBox, LABEL, container);
		command.execute();
	}
	return commentBox;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:17,代码来源:ComponentSearchUtility.java

示例13: handleEvent

import org.eclipse.swt.widgets.Event; //导入依赖的package包/类
@Override
public void handleEvent(Event event) {
    //same action as "cancel" button.
    cancel();
    test.setEnabled(true);
    abort.setEnabled(false);
    encryptToggle.setEnabled(true);
    wizard.setNextEnabled(false);
    uploadTest=0;
    downloadTest=0;

    String testAbortedManually = MessageText.getString("SpeedTestWizard.test.panel.aborted");
    wizard.setErrorMessage(testAbortedManually);
    reportStage("\n"+testAbortedManually);

}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:17,代码来源:SpeedTestPanel.java

示例14: getListener

import org.eclipse.swt.widgets.Event; //导入依赖的package包/类
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar,ListenerHelper helpers, Widget... widgets) {
	final Widget[] widgetList = widgets;
			
	Listener listener=new Listener() { 
		@Override
		public void handleEvent(Event event) {
			if(!((Button)widgetList[1]).getSelection()){
			ControlDecoration	fieldNameMustJava = WidgetUtility.addDecorator((Text)widgetList[0],Messages.INVALID_FILE);
			if(!WidgetUtility.isFileExtention((((Text)widgetList[0]).getText()).trim(), ".java") && !(((Text)widgetList[0]).getText().trim().isEmpty())){
				fieldNameMustJava.show();
			((Text)widgetList[0]).setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255,
					255, 204));
			}
				else  
				{   
					((Text)widgetList[0]).setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255,
						255, 255));
				fieldNameMustJava.hide(); 
				}
			}
		} 
	};
	return listener;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:26,代码来源:ELTCheckFileExtensionListener.java

示例15: getListener

import org.eclipse.swt.widgets.Event; //导入依赖的package包/类
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, final ListenerHelper helpers, Widget... widgets) {
	final Widget[] widgetList = widgets;
	
	if (helpers != null) {
		widgetConfig = (WidgetConfig) helpers.get(HelperType.WIDGET_CONFIG);
	}
	
	 Listener listener=new Listener() {
		@Override
		public void handleEvent(Event event) {
			String comboValue = ((Combo) widgetList[0]).getText();
			if (comboValue.equals(Messages.CUSTOM)) {
				FilterOperationClassUtility.INSTANCE.createNewClassWizard((Text) widgetList[1], widgetConfig);
				if(helpers.get(HelperType.OPERATION_CLASS_DIALOG_OK_CONTROL) instanceof OperationClassDialog)
				{
					OperationClassDialog operationClassDialog=(OperationClassDialog)helpers.get(HelperType.OPERATION_CLASS_DIALOG_OK_CONTROL);
					operationClassDialog.getShell().setFocus();
				}
					
				propertyDialogButtonBar.enableApplyButton(true);
			}
		}
	};
	return listener;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:27,代码来源:ELTCreateNewClassListener.java


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