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