Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Control


    }
    Point ourOfs = Utils.getLocationRelativeToShell(control);

    Control[] swtChildren = ((Composite) control).getChildren();
    for (int i = 0; i < swtChildren.length; i++) {
      Control childControl = swtChildren[i];
      TableOrTreeSWT tableOrTree = TableOrTreeUtils.getTableOrTreeSWT(childControl);
      TableView tv = tableOrTree == null ? null
          : (TableView) tableOrTree.getData("TableView");
      if (tv instanceof ObfusticateImage) {
        ObfusticateImage oi = (ObfusticateImage) tv;
        oi.obfusticatedImage(image);
        continue;
      }

      SWTSkinObject so = (SWTSkinObject) childControl.getData("SkinObject");
      if (so instanceof ObfusticateImage) {
        ObfusticateImage oi = (ObfusticateImage) so;
        oi.obfusticatedImage(image);
      } else if (so == null && (childControl instanceof Composite)) {
        obfusticatedImage((Composite) childControl, image);
View Full Code Here


      sortedControls.add(controls[i]);
    }
   
    Collections.sort(sortedControls,new Comparator() {
      public int compare(Object o1, Object o2) {
        Control c1 = (Control) o1;
        Control c2 = (Control) o2;
        Object layoutData1 = c1.getLayoutData();
        Object layoutData2 = c2.getLayoutData();
        if(layoutData1 == null || ! (layoutData1 instanceof SimpleReorderableListLayoutData) ) return 0;
        if(layoutData2 == null || ! (layoutData2 instanceof SimpleReorderableListLayoutData) ) return 0;
        SimpleReorderableListLayoutData data1 = (SimpleReorderableListLayoutData) layoutData1;
        SimpleReorderableListLayoutData data2 = (SimpleReorderableListLayoutData) layoutData2;
        return data1.position - data2.position;
      }
    });
   
    for(int i = 0 ; i < sortedControls.size() ; i++) {
      int xn = i % itemsPerRow;
      int yn = i / itemsPerRow;
      Control control = (Control) sortedControls.get(i);
      //int x = borderW + (margin + maxWidth + extraSpacing) * xn + extraSpacing;
      int x = borderW + (margin + maxWidth + extraSpacing) * xn;
      int y = borderH + (margin + maxHeight) * yn;
      control.setLocation(x,y);
      //control.setBounds(x,y,maxWidth,maxHeight);
      control.setBounds(x,y,maxWidth + extraSpacing,maxHeight);
    }
 
  }
View Full Code Here

    final SWTSkinObject soWaitProgress = skin.getSkinObject("progress");
    if (soWaitProgress != null) {
      soWaitProgress.getControl().addPaintListener(new PaintListener() {
        public void paintControl(PaintEvent e) {
          Control c = (Control) e.widget;
          Point size = c.getSize();
          e.gc.setBackground(ColorCache.getColor(e.display, "#23a7df"));
          Object data = soWaitProgress.getData("progress");
          if (data instanceof Long) {
            int waitProgress = ((Long) data).intValue();
            int breakX = size.x * waitProgress / 100;
View Full Code Here

    this.content = content;
    super.setContent(content);
   
    if (registerAllControls) {
      for(int i = 0;i<content.getChildren().length;i++) {
        Control c = content.getChildren()[i];
        addPaintListener(c);
      }
    }
   
    content.addPaintListener(new PaintListener() {
View Full Code Here

   
    if (System.currentTimeMillis() - last_call_time<100)
      return ;
    last_call_time = System.currentTimeMillis();
    int max_width = 0,max_height = 0;
    Control max_width_control = null,max_height_control = null;

    for(int i = 0;i<content.getChildren().length;i++) {
      Control c = content.getChildren()[i];
     
      int abs_width = c.getBounds().x+c.getBounds().width;
      int abs_height = c.getBounds().y+c.getBounds().height;
     
      if (abs_width>max_width) {
        max_width = abs_width;
        max_width_control = c;
      }
View Full Code Here

    /* Select All */
    fSelectAllAction = new Action() {
      @Override
      public void run() {
        Control focusControl = fEditorSite.getShell().getDisplay().getFocusControl();

        /* Select All in Text Widget */
        if (focusControl instanceof Text)
          ((Text) focusControl).selectAll();
      }
    };

    /* Cut */
    fCutAction = new Action() {
      @Override
      public void run() {
        Control focusControl = fEditorSite.getShell().getDisplay().getFocusControl();

        /* Cut in Text Widget */
        if (focusControl instanceof Text)
          ((Text) focusControl).cut();
      }
    };

    /* Copy */
    fCopyAction = new Action() {
      @Override
      public void run() {
        Control focusControl = fEditorSite.getShell().getDisplay().getFocusControl();

        /* Copy in Text Widget */
        if (focusControl instanceof Text)
          ((Text) focusControl).copy();
      }
    };

    /* Paste */
    fPasteAction = new Action() {
      @Override
      public void run() {
        Control focusControl = fEditorSite.getShell().getDisplay().getFocusControl();

        /* Paste in Text Widget */
        if (focusControl instanceof Text)
          ((Text) focusControl).paste();
      }
View Full Code Here

    /* Select All */
    fSelectAllAction = new Action() {
      @Override
      public void run() {
        Control focusControl = fEditorSite.getShell().getDisplay().getFocusControl();

        /* Select All in Text Widget */
        if (focusControl instanceof Text) {
          ((Text) focusControl).selectAll();
        }

        /* Select All in Viewer Tree */
        else {
          ((Tree) fNewsTableControl.getViewer().getControl()).selectAll();
          fNewsTableControl.getViewer().setSelection(fNewsTableControl.getViewer().getSelection());
        }
      }
    };

    /* Delete */
    fDeleteAction = new Action() {
      @Override
      public void run() {
        new DeleteTypesAction(fParent.getShell(), (IStructuredSelection) fNewsTableControl.getViewer().getSelection()).run();
      }
    };

    /* Cut */
    fCutAction = new Action() {
      @Override
      public void run() {
        Control focusControl = fEditorSite.getShell().getDisplay().getFocusControl();

        /* Cut in Text Widget */
        if (focusControl instanceof Text)
          ((Text) focusControl).cut();
      }
    };

    /* Copy */
    fCopyAction = new Action() {
      @Override
      public void run() {
        Control focusControl = fEditorSite.getShell().getDisplay().getFocusControl();

        /* Copy in Text Widget */
        if (focusControl instanceof Text)
          ((Text) focusControl).copy();
      }
    };

    /* Paste */
    fPasteAction = new Action() {
      @Override
      public void run() {
        Control focusControl = fEditorSite.getShell().getDisplay().getFocusControl();

        /* Paste in Text Widget */
        if (focusControl instanceof Text)
          ((Text) focusControl).paste();
      }
View Full Code Here

  /* Support for focusless scrolling */
  private void hookFocuslessScrolling(final Display display) {
    display.addFilter(SWT.MouseWheel, new Listener() {
      public void handleEvent(Event event) {
        Control control = display.getCursorControl();

        /* Control must be non-focus undisposed */
        if (control == null || control.isDisposed() || control.isFocusControl())
          return;

        /* Pass focus to control and disable event if allowed */
        boolean isBrowser = SWT_BROWSER_WIN.equals(control.getClass().getName());
        if (isBrowser || control.getData(FOCUSLESS_SCROLL_HOOK) != null) {

          /* Break Condition */
          control.setFocus();

          /* Re-Post Event to Cursor Control */
          event.doit = false;
          event.widget = control;
          display.post(event);
View Full Code Here

    /* Select All */
    fSelectAllAction = new Action() {
      @Override
      public void run() {
        Control focusControl = fEditorSite.getShell().getDisplay().getFocusControl();

        /* Select All in Text Widget */
        if (focusControl instanceof Text)
          ((Text) focusControl).selectAll();
      }
    };

    /* Cut */
    fCutAction = new Action() {
      @Override
      public void run() {
        Control focusControl = fEditorSite.getShell().getDisplay().getFocusControl();

        /* Cut in Text Widget */
        if (focusControl instanceof Text)
          ((Text) focusControl).cut();
      }
    };

    /* Copy */
    fCopyAction = new Action() {
      @Override
      public void run() {
        Control focusControl = fEditorSite.getShell().getDisplay().getFocusControl();

        /* Copy in Text Widget */
        if (focusControl instanceof Text)
          ((Text) focusControl).copy();
      }
    };

    /* Paste */
    fPasteAction = new Action() {
      @Override
      public void run() {
        Control focusControl = fEditorSite.getShell().getDisplay().getFocusControl();

        /* Paste in Text Widget */
        if (focusControl instanceof Text)
          ((Text) focusControl).paste();
      }
View Full Code Here

  private void hookContextMenu() {
    final MenuManager menuMgr = new MenuManager("#PopupMenu");
    menuMgr.setRemoveAllWhenShown(true);

    Control lControl = null;
    ISelectionProvider lProvider = null;
    if (mMediaView.getCurrentView() == MediaView.MEDIA_VIEW) {
      lControl = mMediaView.getMediaViewer().mTableViewer.getControl();
      lProvider = mMediaView.getMediaViewer().mTableViewer;
    } else {
      lControl = mMediaView.getItemViewer().mTreeViewer.getControl();
      lProvider = mMediaView.getItemViewer().mTreeViewer;
    }

    final IStructuredSelection selection = (IStructuredSelection) lProvider
        .getSelection();

    if (selection.isEmpty()) {
      // CB TODO decide what to do on an empty selection.
    }

    menuMgr.addMenuListener(new IMenuListener() {
      public void menuAboutToShow(IMenuManager manager) {
        manager.add(new Separator("control"));
        menuMgr
            .appendToGroup("control",
                new MediaOpenAction(selection));
        menuMgr.appendToGroup("control", new SyncPlayAction(selection));
        MediaViewPart.this.fillContextMenu(manager);
      }
    });

    if (lControl != null && lProvider != null) {
      Menu menu = menuMgr.createContextMenu(lControl);
      lControl.setMenu(menu);
      // Register to the workbench.
      getSite().registerContextMenu(menuMgr, lProvider);
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.Control

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.