Java Code Examples for org.eclipse.swt.custom.CLabel#addMouseListener()

The following examples show how to use org.eclipse.swt.custom.CLabel#addMouseListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ViewFilterDialog.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private void createCLabels(Composite parent, Composite labels, String currentRegex) {
    CLabel filter = new CLabel(labels, SWT.BORDER);
    filter.setText(currentRegex);
    filter.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_DELETE));
    filter.setBackground(fColorScheme.getColor(TimeGraphColorScheme.TOOL_BACKGROUND));
    filter.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseDown(MouseEvent e2) {
            deleteCLabel(parent, filter, e2);
        }
    });

    parent.layout();
    Rectangle bounds = parent.getShell().getBounds();
    Point size = parent.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    Rectangle trim = parent.getShell().computeTrim(0, 0, size.x, size.y);
    parent.getShell().setBounds(bounds.x + bounds.width - trim.width, bounds.y + bounds.height - trim.height, trim.width, trim.height);
}
 
Example 2
Source File: DetailsView.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
private void setLink(CLabel label, IEventInvoker<IDetailsViewEventListener> invoker) {
	label.setCursor(SWTResourceManager.getCursor(SWT.CURSOR_HAND));
	label.addMouseListener(new MouseAdapter() {

		@Override
		public void mouseUp(MouseEvent e) {
			eventManager.invoke(invoker);
		}
		
	});
}
 
Example 3
Source File: ViewUtils.java    From http4e with Apache License 2.0 5 votes vote down vote up
static ViewForm buildViewForm( final String title, final ItemModel model, final Composite parent){
   final ViewForm vForm = new ViewForm(parent, SWT.NONE);

   // -- Label(vForm)
   final CLabel label = new CLabel(vForm, SWT.NONE);
   label.setText(CoreConstants.TITLE_SPACE + title + CoreConstants.TITLE_SPACE);
   label.setAlignment(SWT.LEFT);
   label.setBackground(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.TITLE_LINE));
   label.addMouseListener(new MouseAdapter() {
      public void mouseDoubleClick( MouseEvent e){
         int eventType = ModelEvent.UNKNOWN;
         if (CoreConstants.TITLE_HEADERS.equals(title)) {
            eventType = ModelEvent.HEADERS_RESIZED;

         } else if (CoreConstants.TITLE_PARAMETERS.equals(title)) {
            eventType = ModelEvent.PARAMS_RESIZED;

         } else if (CoreConstants.TITLE_BODY.equals(title)) {
            eventType = ModelEvent.BODY_RESIZED;

         } else if (CoreConstants.TITLE_REQUEST.equals(title)) {
            eventType = ModelEvent.REQUEST_RESIZED;

         } else if (CoreConstants.TITLE_RESPONSE.equals(title)) {
            eventType = ModelEvent.RESPONSE_RESIZED;
         }
         model.fireExecute(new ModelEvent(eventType, model));
      }
   });

   vForm.setTopLeft(label);

   return vForm;
}
 
Example 4
Source File: AbstractSortableHeader.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
protected void initializeLabel(CLabel label) {
    label.addMouseListener(this.sortMouseAdapter);
}