Java 类org.eclipse.swt.events.MouseEvent 实例源码

项目:Hydrograph    文件:OutputRecordCountWidget.java   
private void addSelectionListenerToOperationRadioButton(Button operationRadioButton) 
{
    operationRadioButton.addMouseListener(new MouseAdapter() 
    {
        @Override
        public void mouseUp(MouseEvent e) {
            outputRecordCoundText.setEnabled(false);
            editButton.setEnabled(false);
            transformMapping.setExpression(false);
            propertyDialogButtonBar.enableApplyButton(true);
            expressionValidateDecorator.hide();
            OutputRecordCountUtility.INSTANCE.removeExpressionFieldFromOutputList(transformMapping);
            OutputRecordCountUtility.INSTANCE.addOperationOutputFieldToOuterListOfMappingWindow(transformMapping);
            setSchemaUpdated(false);
            outputList.clear();
            SchemaSyncUtility.INSTANCE.unionFilter(transformMapping.getOutputFieldList(), 
                    outputList);
            OutputRecordCountUtility.INSTANCE.propagateOuputFieldsToSchemaTabFromTransformWidget(
                    transformMapping,getSchemaForInternalPropagation(),getComponent(),outputList
                    );
        }
       });
}
项目:n4js    文件:GraphCanvas.java   
protected void onClick(MouseEvent event) {
    // update selection
    final Node mNode = getNodeAt(event.x, event.y);
    final boolean shiftPressed = (event.stateMask & SWT.SHIFT) != 0;
    if (!shiftPressed) {
        if (mNode == null) {
            clearSelection();
        } else {
            setSelectedNodes(mNode);
        }
    } else {
        if (mNode == null) {
            // do nothing
        } else {
            toggleSelection(mNode);
        }
    }
}
项目:neoscada    文件:ChartAreaRenderer.java   
@Override
public void addMouseMoveListener ( final ChartMouseMoveListener listener )
{
    removeMouseMoveListener ( listener );
    final MouseMoveListener proxyListener = new MouseMoveListener () {

        @Override
        public void mouseMove ( final MouseEvent e )
        {
            listener.onMouseMove ( convertState ( e ) );
        }

    };
    final MouseMoveListener oldListener = this.mouseMoveListenerMap.put ( listener, proxyListener );
    if ( oldListener != null )
    {
        this.control.removeMouseMoveListener ( oldListener );
    }
    this.control.addMouseMoveListener ( proxyListener );
}
项目:convertigo-eclipse    文件:KTable.java   
protected void onMouseDoubleClick(MouseEvent e) {
  if (m_Model == null)
    return;
  if (e.button == 1) {

    if (e.y < m_Model.getFirstRowHeight()
        + ((m_Model.getFixedRowCount() - 1) * m_Model
            .getRowHeight())) {
      // double click in header area
      int columnIndex = getColumnForResize(e.x, e.y);
      resizeColumnOptimal(columnIndex);
      return;
    } else
      openEditorInFocus();
  }
}
项目:convertigo-eclipse    文件:TwsDomTree.java   
private void buildContextMenu(MouseEvent e) {
    Point point = new Point(e.x, e.y);
    TreeItem  treeItem = getTree().getItem(point);
    Menu menu = new Menu((Control)e.getSource());
    Iterator<MenuMaker> i = menuMakers.iterator();
    int cpt = 0;
    while(i.hasNext()) {
        i.next().makeMenu(this, treeItem, e, menu);
        if (i.hasNext() && menu.getItemCount() != cpt) {
            new MenuItem(menu, SWT.SEPARATOR);
            cpt = menu.getItemCount();
        }
    }
    if (menu.getItemCount() > 0) {
        menu.setVisible(true);
    } else {
        menu.dispose();
    }
}
项目:avoCADo    文件:ToolSketchLineCtrl.java   
public void glMouseDrag(double x, double y, double z,  MouseEvent e, ParamSet paramSet) {
    Feature2D feat2D = AvoGlobal.project.getActiveFeat2D();
    if(feat2D != null){
        //
        // get parameter set
        //
        //ParamSet paramSet = feat2D.paramSet;

        //
        // update param values
        //
        try{
            paramSet.changeParam("b", new Point2D(x,y));
            (new ToolSketchLineModel()).updateDerivedParams(paramSet);
            //navigationToolbar.showMessage("Release to finish line.");
        }catch(Exception ex){
            System.out.println(this.getClass().getCanonicalName() + " :: " + ex.getClass());
        }
    }
}
项目:Open_Source_ECOA_Toolset_AS5    文件:ServicesEditor.java   
@Override
public void mouseUp(MouseEvent e) {
    if (e.getSource() instanceof Button) {
        Button sel = (Button) e.getSource();
        if (sel.getText().equalsIgnoreCase("Save")) {
            try {
                String tempText = sUtil.processAdd(isEdit, editName, comp, type, editor.getDocumentProvider().getDocument(getEditorInput()).get());
                editor.getDocumentProvider().getDocument(getEditorInput()).set(tempText);
                createPage1();
                setActivePage(1);
            } catch (JAXBException ex) {
                ErrorDialog.openError(getSite().getShell(), "Error removing item", null, new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, "Error removing item", null));
            }
        }
    }
}
项目:avoCADo    文件:ToolSketchCircleCtrl.java   
public void glMouseDrag(double x, double y, double z,  MouseEvent e, ParamSet paramSet) {
    Feature2D feat2D = AvoGlobal.project.getActiveFeat2D();
    if(feat2D != null){
        //
        // get parameter set
        //
        //ParamSet paramSet = feat2D.paramSet;

        //
        // update param values
        //
        try{
            Point2D ptCenter = paramSet.getParam("c").getDataPoint2D();
            paramSet.changeParam("r", ptCenter.computeDist(new Point2D(x,y)));
        }catch(Exception ex){
            System.out.println("Tool2DCircle(mousedrag): " + ex.getClass());
        }
    }
}
项目:Open_Source_ECOA_Toolset_AS5    文件:EventServiceComposite.java   
@Override
public void mouseUp(MouseEvent e) {
    if (((Button) e.getSource()).getText().equalsIgnoreCase("Add")) {
        Parameter val = new Parameter();
        val.setName("");
        val.setType("");
        getParamArr().add(val);
        tabValues.refresh();
    } else if (((Button) e.getSource()).getText().equalsIgnoreCase("Remove")) {
        int[] items = tabValues.getTable().getSelectionIndices();
        ArrayList<Parameter> rem = new ArrayList<Parameter>();
        for (int item : items) {
            rem.add(getParamArr().get(item));
        }
        getParamArr().removeAll(rem);
        tabValues.refresh();
    } else if (((Button) e.getSource()).getText().equalsIgnoreCase("Clear")) {
        getParamArr().clear();
        tabValues.refresh();
    }
}
项目:Open_Source_ECOA_Toolset_AS5    文件:EnumTypesComposite.java   
@Override
public void mouseUp(MouseEvent e) {
    if (((Button) e.getSource()).getText().equalsIgnoreCase("Add")) {
        EnumValue val = new EnumValue();
        val.setName("");
        val.setComment("");
        val.setValnum("");
        getEnumArr().add(val);
        tabValues.refresh();
    } else if (((Button) e.getSource()).getText().equalsIgnoreCase("Remove")) {
        int[] items = tabValues.getTable().getSelectionIndices();
        ArrayList<EnumValue> rem = new ArrayList<EnumValue>();
        for (int item : items) {
            rem.add(getEnumArr().get(item));
        }
        getEnumArr().removeAll(rem);
        tabValues.refresh();
    } else if (((Button) e.getSource()).getText().equalsIgnoreCase("Clear")) {
        getEnumArr().clear();
        tabValues.refresh();
    }
}
项目:Open_Source_ECOA_Toolset_AS5    文件:EnumTypesPage.java   
@Override
public void mouseUp(MouseEvent e) {
    if (((Button) e.getSource()).getText().equalsIgnoreCase("Add")) {
        EnumValue val = new EnumValue();
        val.setName("");
        val.setComment("");
        val.setValnum("");
        getEnumArr().add(val);
        tabValues.refresh();
    } else if (((Button) e.getSource()).getText().equalsIgnoreCase("Remove")) {
        int[] items = tabValues.getTable().getSelectionIndices();
        ArrayList<EnumValue> rem = new ArrayList<EnumValue>();
        for (int item : items) {
            rem.add(getEnumArr().get(item));
        }
        getEnumArr().removeAll(rem);
        tabValues.refresh();
    } else if (((Button) e.getSource()).getText().equalsIgnoreCase("Clear")) {
        getEnumArr().clear();
        tabValues.refresh();
    }
}
项目:Open_Source_ECOA_Toolset_AS5    文件:TypesEditor.java   
@Override
public void mouseUp(MouseEvent e) {
    if (e.getSource() instanceof Button) {
        Button sel = (Button) e.getSource();
        if (sel.getText().equalsIgnoreCase("Save")) {
            try {
                String tempText = util.processAdd(isEdit, editName, comp, type, editor.getDocumentProvider().getDocument(getEditorInput()).get());
                editor.getDocumentProvider().getDocument(getEditorInput()).set(tempText);
                createPage1();
                setActivePage(1);
            } catch (JAXBException ex) {
                ErrorDialog.openError(getSite().getShell(), "Error removing item", null, new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, "Error removing item", null));
            }
        }
    }
}
项目:Hydrograph    文件:ELTSchemaGridWidget.java   
private void addExportSchemaButton(ELTSchemaSubgroupComposite buttonSubGroup) {

        exportSchemaButton = new ELTDefaultButton("");
        SchemaButtonsSyncUtility.INSTANCE.buttonSize(exportSchemaButton, macButtonWidth, macButtonHeight,
                windowButtonWidth, windowButtonHeight);
        buttonSubGroup.attachWidget(exportSchemaButton);
        exportSchemaButton.setImage(ImagePathConstant.EXPORT_SCHEMA_BUTTON);
        exportSchemaButton.setToolTipText(Messages.EXPORT_SCHEMA_KEY_SHORTCUT_TOOLTIP);
        Button exportButton = (Button) exportSchemaButton.getSWTWidgetControl();
        exportButton.addMouseListener(new MouseAdapter() {

            @Override
            public void mouseDown(MouseEvent e) {
                exportSchemaIntoFile(exportButton);
            }
        });
    }
项目:Open_Source_ECOA_Toolset_AS5    文件:EventServicePage.java   
@Override
public void mouseUp(MouseEvent e) {
    if (((Button) e.getSource()).getText().equalsIgnoreCase("Add")) {
        Parameter val = new Parameter();
        val.setName("");
        val.setType("");
        getParamArr().add(val);
        tabValues.refresh();
    } else if (((Button) e.getSource()).getText().equalsIgnoreCase("Remove")) {
        int[] items = tabValues.getTable().getSelectionIndices();
        ArrayList<Parameter> rem = new ArrayList<Parameter>();
        for (int item : items) {
            rem.add(getParamArr().get(item));
        }
        getParamArr().removeAll(rem);
        tabValues.refresh();
    } else if (((Button) e.getSource()).getText().equalsIgnoreCase("Clear")) {
        getParamArr().clear();
        tabValues.refresh();
    }
}
项目:n4js    文件:InterfacesComponentProvider.java   
@Override
public void mouseDown(MouseEvent e) {
    if (editor.getItem() != null) {
        if (editor.getItem() != interfacesTable.getItem(new Point(e.x, e.y))) {
            editor.getEditor().dispose();
            interfacesTable.setItemCount(model.getInterfaces().size());
        }
    }
}
项目:Hydrograph    文件:SingleClickEvent.java   
@Override
public void mouseUp(MouseEvent event) {
    if (armed && inRange(event)) {
        action.run();
    }
    armed = false;
}
项目:n4js    文件:VisualisationCanvas.java   
protected void onMouseDown(MouseEvent event) {
    mousePressed = true;
    mouseDragged = false;
    mouseDragStartX = event.x;
    mouseDragStartY = event.y;
    mouseDragBaseX = offsetX;
    mouseDragBaseY = offsetY;
}
项目:n4js    文件:VisualisationCanvas.java   
protected void onMouseUp(MouseEvent event) {
    if (!mouseDragged)
        onClick(event);
    mousePressed = false;
    mouseDragged = false;
    mouseDragStartX = 0;
    mouseDragStartY = 0;
}
项目:Hydrograph    文件:SecondaryColumnKeysDialog.java   
private void attachAddButtonListern(Button addButton) {
    addButton.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseUp(MouseEvent e) {
            addNewRow();
        }

    });
}
项目:n4js    文件:GraphCanvas.java   
protected void onMouseDown(MouseEvent event) {
    mousePressed = true;
    mouseDragged = false;
    mouseDragStartX = event.x;
    mouseDragStartY = event.y;
    mouseDragBaseX = offsetX;
    mouseDragBaseY = offsetY;
}
项目:eZooKeeper    文件:JmxExplorerView.java   
public void createPartControl(Composite parent) {

        DataModelManager<JmxConnectionModel, JmxConnectionDescriptor, JmxConnection> jmxConnectionModelManager = JmxActivator
                .getDefault().getJmxConnectionModelManager();

        ElementTypes elementTypes = new ElementTypes();

        elementTypes.add(jmxConnectionModelManager.getClass(), new DataModelManagerElementType());
        elementTypes.add(JmxConnectionModel.class, new JmxConnectionModelElementType());
        elementTypes.add(DomainModel.class, new DomainModelElementType());
        elementTypes.add(ObjectNameKeyValueModel.class, new ObjectNameKeyValueModelElementType());
        elementTypes.add(MBeanModel.class, new MBeanModelElementType());
        elementTypes.add(MBeanAttributesModelCategory.class, new MBeanAttributesModelCategoryElementType());
        elementTypes.add(MBeanAttributeModel.class, new MBeanAttributeModelElementType());
        elementTypes.add(MBeanOperationsModelCategory.class, new MBeanOperationsModelCategoryElementType());
        elementTypes.add(MBeanOperationModel.class, new MBeanOperationModelElementType());

        _TreeViewer = ViewerFactory.createDataModelTreeViewer(parent, SWT.MULTI | SWT.VIRTUAL | SWT.H_SCROLL
                | SWT.V_SCROLL, elementTypes, jmxConnectionModelManager);

        _TreeViewer.getTree().addMouseListener(new MouseAdapter() {

            @Override
            public void mouseDown(MouseEvent e) {
                getSite().getWorkbenchWindow().getActivePage().activate(JmxExplorerView.this);
            }
        });

        getSite().setSelectionProvider(_TreeViewer);

        _DrillDownAdapter = new DrillDownAdapter(_TreeViewer);

        makeActions();
        hookContextMenu();
        contributeToActionBars();

    }
项目:neoscada    文件:ChartAreaRenderer.java   
protected MouseState convertState ( final MouseEvent e )
{
    final MouseState state = new MouseState ();
    state.button = e.button;
    state.x = e.x;
    state.y = e.y;
    state.state = e.stateMask;
    return state;
}
项目:Hydrograph    文件:SecondaryColumnKeysDialog.java   
private void attachDownButtonListerner(Button downButton) {
    downButton.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseUp(MouseEvent e) {
            moveRowDown();
        }
    });

}
项目:convertigo-eclipse    文件:KTable.java   
protected void onMouseDown(MouseEvent e) {
  if (e.button == 1) {
    // deactivateEditor(true);
    setCapture(true);
    m_Capture = true;

    // Resize column?
    int columnIndex = getColumnForResize(e.x, e.y);
    if (columnIndex >= 0) {
      m_ResizeColumnIndex = columnIndex;
      m_ResizeColumnLeft = getColumnLeft(columnIndex);
      return;
    }

    // Resize row?
    int rowIndex = getRowForResize(e.x, e.y);
    if (rowIndex >= 0) {
      m_ResizeRowIndex = rowIndex;
      m_ResizeRowTop = m_Model.getFirstRowHeight() + (rowIndex - 1)
          * m_Model.getRowHeight();
      m_NewRowSize = m_Model.getRowHeight();
      return;
    }
  }

  // focus change
  int col = calcColumnNum(e.x);
  int row = calcRowNum(e.y);

  if (col == -1 || row == -1)
    return;

  m_ClickColumnIndex = col;
  m_ClickRowIndex = row;

  focusCell(col, row, e.stateMask);

}
项目:convertigo-eclipse    文件:KTable.java   
protected void onMouseUp(MouseEvent e) {
  // if (e.button == 1)
  {
    if (m_Model == null)
      return;

    setCapture(false);
    m_Capture = false;

    if (m_ResizeColumnIndex != -1) {
      fireColumnResize(m_ResizeColumnIndex, m_Model
          .getColumnWidth(m_ResizeColumnIndex));
      m_ResizeColumnIndex = -1;
      redraw();

    }
    if (m_ResizeRowIndex != -1) {
      m_ResizeRowIndex = -1;
      m_Model.setRowHeight(m_NewRowSize);
      m_LineRestore = null;
      fireRowResize(m_NewRowSize);
      redraw();
    }
    if (m_ClickColumnIndex != -1) {
      int col = m_ClickColumnIndex;
      int row = m_ClickRowIndex;
      m_ClickColumnIndex = -1;
      m_ClickRowIndex = -1;
      if (m_CellEditor == null) {
        drawCell(new GC(this), col, row);
      }
    }

  }
}
项目:Hydrograph    文件:TransformDialog.java   
private void createInputFieldTable(Composite container) {

        Composite inputFieldComposite = new Composite(container, SWT.NONE);

        inputFieldComposite.setLayout(new GridLayout(2, false));

        GridData gd_composite = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
        gd_composite.widthHint = 250;
        inputFieldComposite.setLayoutData(gd_composite);
        new Label(inputFieldComposite, SWT.NONE);
        inputFieldTableViewer = new TableViewer(inputFieldComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);

        setTableViewer(inputFieldTableViewer, inputFieldComposite, new String[] { Messages.OPERATIONAL_SYSTEM_FIELD },
                new TableContentProvider());
        inputFieldTableViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
        DragDropUtility.INSTANCE.applyDragFromTableViewer(inputFieldTableViewer.getTable());
        inputFieldTableViewer.setLabelProvider(new InputFieldColumnLabelProvider());
        inputFieldTableViewer.setInput(transformMapping.getInputFields());
        addControlListener(inputFieldTableViewer.getTable());
        inputFieldTableViewer.getControl().addMouseListener(new MouseAdapter() {
            @Override
            public void mouseUp(MouseEvent e) 
            {
                TransformMappingFeatureUtility.INSTANCE.highlightInputAndOutputFields(null,
                        inputFieldTableViewer,outputFieldViewer,null,null);
            }
        });
    }
项目:Hydrograph    文件:Utils.java   
private MouseMoveListener getMouseListner(final Text extSchemaPathText){
    final MouseMoveListener listner = new MouseMoveListener() {

        @Override
        public void mouseMove(MouseEvent e) {
            String paramValue = Utils.INSTANCE.getParamValue(extSchemaPathText.getText());
            finalParamPath = Utils.INSTANCE.getParamFilePath(extSchemaPathText.getText(), paramValue, extSchemaPathText);
            while(ParameterUtil.containsParameter(finalParamPath, '/')){
                paramValue = Utils.INSTANCE.getParamValue(extSchemaPathText.getToolTipText());
                finalParamPath = Utils.INSTANCE.getParamFilePath(extSchemaPathText.getToolTipText(), paramValue, extSchemaPathText);
                }
            }
        };
    return listner;
}
项目:avoCADo    文件:ToolSketchLineCtrl.java   
public void glMouseDown(double x, double y, double z,  MouseEvent e, ParamSet paramSet) {
    Sketch sketch = AvoGlobal.project.getActiveSketch();
    if(sketch != null && !sketch.isConsumed){
        //
        // starting to draw a new feature... deselect all other features.
        //
        sketch.deselectAllFeat2D();

        //
        // Build parameter set for this feature
        //
        ParamSet pSet = (new ToolSketchLineModel()).constructNewParamSet();
        try{
            pSet.changeParam("a", new Point2D(x,y));
            pSet.changeParam("b", new Point2D(x,y));
        }catch(Exception ex){
            System.out.println(this.getClass().getCanonicalName() + " :: " + ex.getClass());
        }           

        //
        // add the new feature to the end of the feature set
        // and set it as the active feature2D.      
        Feature2D f2D = new Feature2D(sketch, pSet,"Line" + sketch.getFeat2DListSize());
        f2D.setDescriptor("Line");
        int indx = sketch.add(f2D);
        sketch.setActiveFeat2D(indx);

        //
        // give paramDialog the paramSet so that it can
        // be displayed to the user for manual parameter
        // input.
        //
        AvoGlobal.paramDialog.setParamSet(pSet);


    }
}
项目:avoCADo    文件:ToolSketchLineCtrl.java   
public void glMouseUp(double x, double y, double z,  MouseEvent e, ParamSet paramSet) {
    Feature2D feat2D = AvoGlobal.project.getActiveFeat2D();
    if(feat2D != null){
        //
        // get parameter set
        //
        //ParamSet paramSet = feat2D.paramSet;

        //
        // finalize the feature's formation
        //
        try{
            paramSet.changeParam("b", new Point2D(x,y));
            (new ToolSketchLineModel()).updateDerivedParams(paramSet);

            Point2D ptA = paramSet.getParam("a").getDataPoint2D();
            Point2D ptB = paramSet.getParam("b").getDataPoint2D();
            // * discard if start point is the same as the end point
            if(ptA.equalsPt(ptB)){
                // end point are the same... discard
                System.out.println("end points of line are the same... discarding feature");
                // remove feature2D from the set
                AvoGlobal.project.getActiveSketch().removeActiveFeat2D();
                AvoGlobal.paramDialog.setParamSet(null);
                //navigationToolbar.showMessage("Left click on sketch (hold) to set first point. Drag to set direction and length.");
            }else{                  
                //navigationToolbar.showMessage("Line done. Left click on sketch to deselect it.");
            }

        }catch(Exception ex){
            System.out.println(this.getClass().getCanonicalName() + " :: " + ex.getClass());
        }           
    }
}
项目:RxSWT    文件:MouseDoubleClickObservable.java   
@Override
protected AbstractMouseListener getMouseListener(Control control, Observer<? super MouseEvent> observer) {
    return new AbstractMouseListener(control) {
        @Override
        public void mouseDoubleClick(MouseEvent e) {
            if (!isDisposed()) {
                observer.onNext(e);
            }
        }
    };
}
项目:avoCADo    文件:ToolSketchExampleCtrl.java   
public void glMouseDown(double x, double y, double z,  MouseEvent e, ParamSet paramSet) {
    Sketch sketch = AvoGlobal.project.getActiveSketch();
    if(sketch != null && !sketch.isConsumed){
        //
        // starting to draw a new feature... deselect all other features.
        //
        sketch.deselectAllFeat2D();

        //
        // Build parameter set for this feature
        //
        ParamSet pSet = (new ToolSketchExampleModel()).constructNewParamSet();
        try{
            pSet.changeParam("c", new Point2D(x,y));
        }catch(Exception ex){
            System.out.println("Tool2DExample(mousedown): " + ex.getClass());
        }           
        //
        // add the new feature to the end of the feature set
        // and set it as the active feature2D.      
        int indx = sketch.add(new Feature2D(sketch, pSet,"Example" + sketch.getFeat2DListSize()));
        sketch.setActiveFeat2D(indx);

        //
        // give paramDialog the paramSet so that it can
        // be displayed to the user for manual parameter
        // input.
        //
        AvoGlobal.paramDialog.setParamSet(pSet);
    }
}
项目:avoCADo    文件:ToolSketchRectCtrl.java   
public void glMouseDown(double x, double y, double z,  MouseEvent e, ParamSet paramSet) {
    Sketch sketch = AvoGlobal.project.getActiveSketch();
    if(sketch != null && !sketch.isConsumed){
        //
        // starting to draw a new feature... deselect all other features.
        //
        sketch.deselectAllFeat2D();

        //
        // Build parameter set for this feature
        //
        ParamSet pSet = (new ToolSketchRectModel()).constructNewParamSet();
        try{
            pSet.changeParam("a", new Point2D(x,y));
            pSet.changeParam("b", new Point2D(x,y));
        }catch(Exception ex){
            System.out.println(this.getClass().getCanonicalName() + " :: " + ex.getClass());
        }   
        //
        // add the new feature to the end of the feature set
        // and set it as the active feature2D.
        Feature2D f2D = new Feature2D(sketch, pSet,"Rectangle" + sketch.getFeat2DListSize());
        f2D.setDescriptor("Rectangle");
        int indx = sketch.add(f2D);
        sketch.setActiveFeat2D(indx);

        //
        // give paramDialog the paramSet so that it can
        // be displayed to the user for manual parameter
        // input.
        //
        AvoGlobal.paramDialog.setParamSet(pSet);
        //navigationToolbar.showMessage("Drag to set size.");
    }
}
项目:gemoc-studio    文件:AbstractTimelineView.java   
@Override
public void mouseDown(MouseEvent e) {
    if (e.button == 1) {
        originMousePosition = new Point(e.x, e.y);
        final Canvas canevas = (Canvas)timelineViewer.getControl();
        doneShift = 0;
        if (canevas.getVerticalBar() != null) {
            offset.y = canevas.getVerticalBar().getSelection();
        } else {
            offset.y = 0;
        }
    }
}
项目:avoCADo    文件:ToolSketchRectCtrl.java   
public void glMouseUp(double x, double y, double z,  MouseEvent e, ParamSet paramSet) {
    Feature2D feat2D = AvoGlobal.project.getActiveFeat2D();
    if(feat2D != null){
        //
        // get parameter set
        //
        //ParamSet paramSet = feat2D.paramSet;

        //
        // finalize the feature's formation
        //
        try{
            paramSet.changeParam("b", new Point2D(x,y));
            (new ToolSketchRectModel()).updateDerivedParams(paramSet);

            Point2D ptA = paramSet.getParam("a").getDataPoint2D();
            Point2D ptB = paramSet.getParam("b").getDataPoint2D();
            // * discard if startX == endX or startY == endY  (rectangle has 0 Area)
            if(ptA.getX() == ptB.getX() || ptA.getY() == ptB.getY()){
                // end point are the same... discard
                System.out.println("Reactangle has zero area... discarding feature");
                // remove feature2D from the set
                AvoGlobal.project.getActiveSketch().removeActiveFeat2D();
                AvoGlobal.paramDialog.setParamSet(null);
                //navigationToolbar.showMessage("Left click on sketch (hold) to set first corner. Drag to set size.");
            }else{
                //navigationToolbar.showMessage("Rectangle done. Left click on sketch to deselect it.");
            }

        }catch(Exception ex){
            System.out.println(ex.getClass());
        }               
    }       
}
项目:RxSWT    文件:MouseEnterObservable.java   
@Override
protected AbstractMouseTrackListener getMouseListener(Control control, Observer<? super MouseEvent> observer) {
    return new AbstractMouseTrackListener(control) {
        @Override
        public void mouseEnter(MouseEvent e) {
            observer.onNext(e);
        }
    };
}
项目:avoCADo    文件:ToolSketchCircleCtrl.java   
public void glMouseDown(double x, double y, double z,  MouseEvent e, ParamSet paramSet) {
    Sketch sketch = AvoGlobal.project.getActiveSketch();
    if(sketch != null && !sketch.isConsumed){
        //
        // starting to draw a new feature... deselect all other features.
        //
        sketch.deselectAllFeat2D();

        //
        // Build parameter set for this feature
        //
        ParamSet pSet = (new ToolSketchCircleModel()).constructNewParamSet();
        try{
            pSet.changeParam("c", new Point2D(x,y));
        }catch(Exception ex){
            System.out.println("Tool2DCircle(mousedown): " + ex.getClass());
        }
        //
        // add the new feature to the end of the feature set
        // and set it as the active feature2D.      
        Feature2D f2D = new Feature2D(sketch, pSet, "Circle" + sketch.getFeat2DListSize());
        f2D.setDescriptor("Circle");
        int indx = sketch.add(f2D);
        sketch.setActiveFeat2D(indx);

        //
        // give paramDialog the paramSet so that it can
        // be displayed to the user for manual parameter
        // input.
        //
        AvoGlobal.paramDialog.setParamSet(pSet);

        //navigationToolbar.showMessage("Drag to set radius. Release to finish circle.");
    }
}
项目:avoCADo    文件:ToolSketchCircleCtrl.java   
public void glMouseUp(double x, double y, double z,  MouseEvent e, ParamSet paramSet) {
    Feature2D feat2D = AvoGlobal.project.getActiveFeat2D();
    if(feat2D != null){
        //
        // get parameter set
        //
        //ParamSet paramSet = feat2D.paramSet;

        //
        // finalize the feature's formation
        //
        try{
            Point2D ptCenter = paramSet.getParam("c").getDataPoint2D();
            paramSet.changeParam("r", ptCenter.computeDist(new Point2D(x,y)));

            // * discard if radius == 0.0
            Double radius = paramSet.getParam("r").getDataDouble();
            if(radius == 0.0){
                System.out.println("radius was zero... feature discarded");
                // remove feature2D from the set!
                AvoGlobal.project.getActiveSketch().removeActiveFeat2D();
                AvoGlobal.paramDialog.setParamSet(null);
                //navigationToolbar.showMessage("Left click (hold) to set center, then drag to set radius.");
            }else{
                //navigationToolbar.showMessage("Circle done. Left click on sketch to deselect it.");

            }
        }catch(Exception ex){
            System.out.println("Tool2DCircle(mouseup): " + ex.getClass());
        }                       
    }
}
项目:RxSWT    文件:MouseDownObservable.java   
@Override
protected AbstractMouseListener getMouseListener(Control control, Observer<? super MouseEvent> observer) {
    return new AbstractMouseListener(control) {
        @Override
        public void mouseDown(MouseEvent e) {
            if (!isDisposed()) {
                observer.onNext(e);
            }
        }
    };
}
项目:codelens-eclipse    文件:ViewZoneChangeAccessor.java   
@Override
public void mouseMove(MouseEvent event) {
    int lineIndex = fTextWidget.getLineIndex(event.y);
    int lineNumber = lineIndex + 1;
    IViewZone zone = getViewZone(lineNumber);
    if (zone != null) {
        // The line which have a zone at end of this line is
        // hovered.
        // Check if it's the zone which is hovered or the view zone.
        int offset = fTextWidget.getOffsetAtLine(lineIndex + 1);
        Point p = fTextWidget.getLocationAtOffset(offset);
        if (p.y - zone.getHeightInPx() < event.y) {
            // Zone is hovered
            if (zone.equals(hoveredZone)) {
                hoveredZone.mouseHover(event);
                layoutZone(hoveredZone);
            } else {
                if (hoveredZone != null) {
                    hoveredZone.mouseExit(event);
                    layoutZone(hoveredZone);
                }
                hoveredZone = zone;
                hoveredZone.mouseEnter(event);
                layoutZone(hoveredZone);
            }
        } else {
            if (hoveredZone != null) {
                hoveredZone.mouseExit(event);
                layoutZone(hoveredZone);
                hoveredZone = null;
            }
        }
    } else if (hoveredZone != null) {
        if (!hoveredZone.isDisposed()) {
            hoveredZone.mouseExit(event);
            layoutZone(hoveredZone);
        }
        hoveredZone = null;
    }
}
项目:Hydrograph    文件:FunctionsComposite.java   
private void addDoubleClickListner(final List methodList) {
    methodList.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseDoubleClick(MouseEvent e) {
            if(methodList.getSelectionIndex()!=-1 && !StringUtils.startsWith(methodList.getItem(methodList.getSelectionIndex()),Messages.CANNOT_SEARCH_INPUT_STRING)){
            MethodDetails methodDetails = (MethodDetails) methodList.getData(String.valueOf(methodList
                    .getSelectionIndex()));
                if(methodDetails !=null && StringUtils.isNotBlank(methodDetails.getPlaceHolder())){
                    expressionEditorTextBox.insert(methodDetails.getPlaceHolder());
                }
    }
        }
    });
}