本文整理匯總了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);
}
}
示例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;
}
示例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;
}
}
});
}
示例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;
}
示例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();
}
}
示例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();
}
});
}
示例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);
}
}
示例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());
}
});
}
示例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;
}
示例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);
}
});
}
示例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;
}
}
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}