Java Code Examples for org.eclipse.core.commands.ExecutionException#printStackTrace()
The following examples show how to use
org.eclipse.core.commands.ExecutionException#printStackTrace() .
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: ConnectedSupport.java From gef with Eclipse Public License 2.0 | 6 votes |
/** * * @param delta * a */ public void relocateHints(Dimension delta) { for (BendVisualOperation op : operations) { List<BendPoint> relocatedBendPoints = new ArrayList<>(); for (BendPoint bp : op.getInitialBendPoints()) { if (bp.isAttached()) { relocatedBendPoints .add(new BendPoint(bp.getContentAnchorage(), bp.getPosition().getTranslated(delta))); } else { relocatedBendPoints.add(new BendPoint( bp.getPosition().getTranslated(delta))); } } op.setFinalBendPoints(relocatedBendPoints); try { op.execute(null, null); } catch (ExecutionException e) { e.printStackTrace(); } } }
Example 2
Source File: UndoablePropertySheetEntry.java From gef with Eclipse Public License 2.0 | 6 votes |
/** * Update parent entry about change, being encapsulated into the given * operation. * * @param child * The child entry that changed. * @param operation * An operation encapsulating the change. */ protected void valueChanged(UndoablePropertySheetEntry child, ITransactionalOperation operation) { // inform our parent if (getParent() != null) { ((UndoablePropertySheetEntry) getParent()).valueChanged(this, operation); } else { // I am the root entry try { operation.addContext(undoContext); operationHistory.execute(operation, new NullProgressMonitor(), null); } catch (ExecutionException e) { e.printStackTrace(); } } }
Example 3
Source File: XLIFFEditorActionHandler.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
public void runWithEvent(Event event) { if (viewer != null && !viewer.getTextWidget().isDisposed()) { // 如果跨越焦点撤销,则先撤销非焦点 try { IOperationHistory history = OperationHistoryFactory.getOperationHistory(); IUndoContext undoContext = (IUndoContext) XLIFFEditorImplWithNatTable.getCurrent().getTable() .getData(IUndoContext.class.getName()); history.redo(undoContext, null, null); // int crossSegment = undoBean.getCrosseStep(); // if (crossSegment > 0) { // history.redo(undoContext, null, null); // undoBean.setCrosseStep(crossSegment - 1); // undoBean.setSaveStatus(-1); // } else if (undoBean.getSaveStatus() == -1) { // XLIFFEditorImplWithNatTable.getCurrent().jumpToRow(undoBean.getUnSaveRow()); // viewer.setText(undoBean.getUnSaveText()); // undoBean.setCrosseStep(0); // undoBean.setSaveStatus(0); // } else { // viewer.doOperation(ITextOperationTarget.REDO); // } } catch (ExecutionException e) { e.printStackTrace(); } System.out.println(undoBean.getCrosseStep()); updateActionsEnableState(); return; } if (redoAction != null) { redoAction.runWithEvent(event); return; } }
Example 4
Source File: XLIFFEditorActionHandler.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
@Override public void runWithEvent(Event event) { if (viewer != null && !viewer.getTextWidget().isDisposed()) { XLIFFEditorImplWithNatTable xliffEditor = XLIFFEditorImplWithNatTable.getCurrent(); // 先保存在撤销,除非以后取消两种模式,否则不要删除此判断 if (viewer.canDoOperation(ITextOperationTarget.UNDO)) { HsMultiActiveCellEditor.commit(true); } IOperationHistory history = OperationHistoryFactory.getOperationHistory(); IUndoContext undoContext = (IUndoContext) xliffEditor.getTable().getData(IUndoContext.class.getName()); if (history.canUndo(undoContext)) { try { history.undo(undoContext, null, null); undoBean.setCrosseStep(undoBean.getCrosseStep() + 1); } catch (ExecutionException e) { e.printStackTrace(); } } XLIFFEditorImplWithNatTable.getCurrent().redraw(); updateActionsEnableState(); return; } if (undoAction != null) { undoAction.runWithEvent(event); return; } }
Example 5
Source File: CellEditorGlobalActionHanlder.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
public void runWithEvent(Event event) { TeActiveCellEditor.commit(); IOperationHistory history = OperationHistoryFactory.getOperationHistory(); IUndoContext context = PlatformUI.getWorkbench().getOperationSupport().getUndoContext(); if (history.canUndo(context)) { try { history.undo(context, null, null); updateActionsEnableState(); } catch (ExecutionException e) { e.printStackTrace(); } } }
Example 6
Source File: UpdateSizeLaneSelectionEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void mousePressed(final MouseEvent me) { try { final IFigure f = ((CustomMainProcessEditPart) laneEditPart.getParent().getParent().getParent()).getFigure() ; IFigure p = f ; while(!(p instanceof Viewport)){ p = p.getParent(); } final int y = ((Viewport)p).getVerticalRangeModel().getValue() ; IGraphicalEditPart targetEp = laneEditPart; if(type.equals(UpdateSizePoolSelectionEditPolicy.ADD_RIGHT)||type.equals(UpdateSizePoolSelectionEditPolicy.REMOVE_RIGHT)){ targetEp = getPoolEditPart(); } final IUndoableOperation c = new UpdatePoolSizeCommand(targetEp, type); OperationHistoryFactory.getOperationHistory().execute(c,null,null); me.consume(); laneEditPart.getViewer().setSelection(new StructuredSelection(targetEp)); refresh(); laneEditPart.getViewer().setSelection(new StructuredSelection(getHost())); ((Viewport)p).setVerticalLocation(y); } catch (final ExecutionException e) { e.printStackTrace(); } }
Example 7
Source File: DelegateForAllElements.java From gama with GNU General Public License v3.0 | 5 votes |
@Override public void run(final IAction action) { try { WorkbenchHelper.runCommand("org.eclipse.xtext.ui.shared.OpenXtextElementCommand"); } catch (final ExecutionException e) { e.printStackTrace(); } }
Example 8
Source File: OrderElementControl.java From statecharts with Eclipse Public License 1.0 | 5 votes |
public void widgetSelected(SelectionEvent e) { RepositionEObjectCommand command = new RepositionEObjectCommand( TransactionUtil.getEditingDomain(callback.getEObject()), "Reorder Elements", getListInput(), getSelectedObject(), displacement); try { OperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null); } catch (ExecutionException e1) { e1.printStackTrace(); } refreshInput(); }
Example 9
Source File: AbstractSwitchLaneSelectionEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public void mousePressed(MouseEvent me) { try { IUndoableOperation c = getSwitchLaneCommand(type); OperationHistoryFactory.getOperationHistory().execute(c,null,null); me.consume(); refresh(); } catch (ExecutionException e) { e.printStackTrace(); } }
Example 10
Source File: UpdateSizePoolSelectionEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void mousePressed(MouseEvent me) { try { IFigure f = ((CustomMainProcessEditPart) poolEditPart.getParent()).getFigure() ; IFigure p = f ; while(!(p instanceof Viewport)){ p = p.getParent(); } int y = ((Viewport)p).getVerticalRangeModel().getValue() ; int x = ((Viewport)p).getHorizontalRangeModel().getValue() ; IUndoableOperation c = new UpdatePoolSizeCommand(poolEditPart, type); OperationHistoryFactory.getOperationHistory().execute(c,null,null); me.consume(); poolEditPart.getViewer().setSelection(new StructuredSelection(poolEditPart)); refresh(); poolEditPart.getViewer().setSelection(new StructuredSelection(getHost())); if(type.equals(ADD_RIGHT)){ ((Viewport)p).setHorizontalLocation(x+150); } ((Viewport)p).setVerticalLocation(y); } catch (ExecutionException e) { e.printStackTrace(); } }
Example 11
Source File: CellEditorGlobalActionHanlder.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
public void runWithEvent(Event event) { TeActiveCellEditor.commit(); IOperationHistory history = OperationHistoryFactory.getOperationHistory(); IUndoContext context = PlatformUI.getWorkbench().getOperationSupport().getUndoContext(); if (history.canRedo(context)) { try { history.redo(context, null, null); updateActionsEnableState(); } catch (ExecutionException e) { e.printStackTrace(); } } }
Example 12
Source File: NattableUtil.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 设置是否添加到记忆库 * @param selectedRowIds * @param state * "yes" or "no"; */ public void changeSendToTmState(List<String> selectedRowIds, String state) { IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory(); try { operationHistory.execute(new SendTOTmOperation("send-to-tm", xliffEditor.getTable(), selectedRowIds, xliffEditor.getXLFHandler(), state), null, null); } catch (ExecutionException e) { LOGGER.error("", e); MessageDialog.openError(xliffEditor.getSite().getShell(), Messages.getString("utils.NattableUtil.msgTitle2"), e.getMessage()); e.printStackTrace(); } }
Example 13
Source File: UpdateDataCommandHandler.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
@Override protected boolean doCommand(UpdateDataCommand command) { IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory(); try { UpdateDataOperation op = new UpdateDataOperation(table, bodyLayerStack, command); op.addContext(PlatformUI.getWorkbench().getOperationSupport().getUndoContext()); operationHistory.execute(op, null, null); } catch (ExecutionException e) { e.printStackTrace(); } return true; }
Example 14
Source File: NattableUtil.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 添加或者取消疑问 * @param selectedRowIds * @param state * ; */ public void changIsQuestionState(List<String> selectedRowIds, String state) { IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory(); try { operationHistory.execute(new NeedsReviewOperation("need-review", xliffEditor.getTable(), selectedRowIds, xliffEditor.getXLFHandler(), state), null, null); } catch (ExecutionException e) { LOGGER.error("", e); MessageDialog.openError(xliffEditor.getSite().getShell(), Messages.getString("utils.NattableUtil.msgTitle2"), e.getMessage()); e.printStackTrace(); } }
Example 15
Source File: ConnectedSupport.java From gef with Eclipse Public License 2.0 | 5 votes |
private void abortHints() { try { for (BendVisualOperation op : operations) { op.undo(null, null); } } catch (ExecutionException e) { e.printStackTrace(); } }
Example 16
Source File: AbstractLabelPart.java From gef with Eclipse Public License 2.0 | 5 votes |
/** * Adjusts the label's position to fit the given {@link Point}. * * @param visual * This node's visual. * @param position * This node's position. */ protected void refreshPosition(Node visual, Point position) { if (position != null) { // translate using a transform operation TransformVisualOperation refreshPositionOp = new TransformVisualOperation(this, new Affine(new Translate(position.x, position.y))); try { refreshPositionOp.execute(null, null); } catch (ExecutionException e) { e.printStackTrace(); } } }
Example 17
Source File: SplitSegmentHandler.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
public Object execute(ExecutionEvent event) throws ExecutionException { IEditorPart editor = HandlerUtil.getActiveEditor(event); if (!(editor instanceof XLIFFEditorImplWithNatTable)) { return null; } XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; StyledTextCellEditor cellEditor = HsMultiActiveCellEditor.getFocusCellEditor(); if (cellEditor == null) { return null; } if (!cellEditor.getCellType().equals(NatTableConstant.SOURCE)) { showInformation(event, Messages.getString("handler.SplitSegmentHandler.msg1")); return null; } int rowIndex = cellEditor.getRowIndex(); // 如果是垂直布局,那么 rowIndex 要除以2 --robert if (!xliffEditor.isHorizontalLayout()) { rowIndex = rowIndex / 2; } int caretOffset = cellEditor.getRealSplitOffset(); if (caretOffset < 0) { // 文本框已经关闭时 showInformation(event, Messages.getString("handler.SplitSegmentHandler.msg1")); return null; } // 不能选择多个字符进行分割 String selText = cellEditor.getSegmentViewer().getTextWidget().getSelectionText(); if (selText.length() != 0) { showInformation(event, Messages.getString("handler.SplitSegmentHandler.msg1")); return null; } XLFHandler handler = xliffEditor.getXLFHandler(); String rowId = handler.getRowId(rowIndex); /* burke 修改锁定文本段不能被分割和光标在文本段段首或者段末时,不能进行分割的BUG 添加代码 起 */ String tgt = handler.getCaseTgtContent(rowId); if (null != tgt) { if (tgt.equals("no")) { showInformation(event, Messages.getString("handler.SplitSegmentHandler.msg2")); return null; } } int cellTextLength = ((UpdateDataBean) cellEditor.getCanonicalValue()).getText().length(); if (caretOffset <= 0 || caretOffset >= cellTextLength) { showInformation(event, Messages.getString("handler.SplitSegmentHandler.msg3")); return null; } /* burke 修改锁定文本段不能被分割和光标在文本段段首或者段末时,不能进行分割的BUG 添加代码 终 */ cellEditor.close(); // 关闭Editor IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory(); try { operationHistory.execute(new SplitSegmentOperation("Split Segment", xliffEditor, handler, rowIndex, caretOffset), null, null); } catch (ExecutionException e) { e.printStackTrace(); } return null; }
Example 18
Source File: TerminologyViewPart.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
/** * 创建视图工具栏的按钮。 */ private void createAction() { firstAction = new Action() { @Override public void run() { if (rowIndex < 0) { return; } if (tempEditor == null || rowIndex < 0) { return; } TransUnitBean transUnit = tempEditor.getRowTransUnitBean(rowIndex); Hashtable<String, String> tuProp = transUnit.getTuProps(); if (tuProp != null) { String translate = tuProp.get("translate"); if (translate != null && translate.equalsIgnoreCase("no")) { MessageDialog.openInformation(getSite().getShell(), Messages.getString("view.TerminologyViewPart.msgTitle"), Messages.getString("view.TerminologyViewPart.msg1")); return; } } String tarTerm = ""; GridItem[] items = gridTable.getSelection(); if (items.length <= 0) { return; } else { tarTerm = items[0].getText(2); } try { tempEditor.insertCell(rowIndex, tempEditor.getTgtColumnIndex(), tarTerm); // tempEditor.setFocus(); // 焦点给回编辑器 } catch (ExecutionException e) { if (Constant.RUNNING_MODE == Constant.MODE_DEBUG) { e.printStackTrace(); } MessageDialog.openInformation(parent.getShell(), Messages.getString("view.TerminologyViewPart.msgTitle"), Messages.getString("view.TerminologyViewPart.msg2") + e.getMessage()); } } }; firstAction.setText(Messages.getString("view.TerminologyViewPart.menu.inserttermtarget")); firstAction.setImageDescriptor(Activator.getIconDescriptor(ImageConstants.ACCPTE_TERM)); firstAction.setToolTipText(Messages.getString("view.TerminologyViewPart.firstAction")); firstAction.setEnabled(false); //getViewSite().getActionBars().getToolBarManager().add(firstAction); }
Example 19
Source File: TerminologyViewPart.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
/** * 创建视图工具栏的按钮。 */ private void createAction() { firstAction = new Action() { @Override public void run() { if (rowIndex < 0) { return; } if (tempEditor == null || rowIndex < 0) { return; } TransUnitBean transUnit = tempEditor.getRowTransUnitBean(rowIndex); Hashtable<String, String> tuProp = transUnit.getTuProps(); if (tuProp != null) { String translate = tuProp.get("translate"); if (translate != null && translate.equalsIgnoreCase("no")) { MessageDialog.openInformation(getSite().getShell(), Messages.getString("view.TerminologyViewPart.msgTitle"), Messages.getString("view.TerminologyViewPart.msg1")); return; } } String tarTerm = ""; GridItem[] items = gridTable.getSelection(); if (items.length <= 0) { return; } else { tarTerm = items[0].getText(2); } try { tempEditor.insertCell(rowIndex, tempEditor.getTgtColumnIndex(), tarTerm); // tempEditor.setFocus(); // 焦点给回编辑器 } catch (ExecutionException e) { if (Constant.RUNNING_MODE == Constant.MODE_DEBUG) { e.printStackTrace(); } MessageDialog.openInformation(parent.getShell(), Messages.getString("view.TerminologyViewPart.msgTitle"), Messages.getString("view.TerminologyViewPart.msg2") + e.getMessage()); } } }; firstAction.setImageDescriptor(Activator.getIconDescriptor(ImageConstants.ACCPTE_TERM)); firstAction.setToolTipText(Messages.getString("view.TerminologyViewPart.firstAction")); firstAction.setEnabled(false); getViewSite().getActionBars().getToolBarManager().add(firstAction); }
Example 20
Source File: SplitSegmentHandler.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
public Object execute(ExecutionEvent event) throws ExecutionException { IEditorPart editor = HandlerUtil.getActiveEditor(event); if (!(editor instanceof XLIFFEditorImplWithNatTable)) { return null; } XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; StyledTextCellEditor cellEditor = HsMultiActiveCellEditor.getFocusCellEditor(); if (cellEditor == null) { return null; } if (!cellEditor.getCellType().equals(NatTableConstant.SOURCE)) { showInformation(event, Messages.getString("handler.SplitSegmentHandler.msg1")); return null; } int rowIndex = cellEditor.getRowIndex(); // 如果是垂直布局,那么 rowIndex 要除以2 --robert if (!xliffEditor.isHorizontalLayout()) { rowIndex = rowIndex / 2; } int caretOffset = cellEditor.getRealSplitOffset(); if (caretOffset < 0) { // 文本框已经关闭时 showInformation(event, Messages.getString("handler.SplitSegmentHandler.msg1")); return null; } // 不能选择多个字符进行分割 String selText = cellEditor.getSegmentViewer().getTextWidget().getSelectionText(); if (selText.length() != 0) { showInformation(event, Messages.getString("handler.SplitSegmentHandler.msg1")); return null; } XLFHandler handler = xliffEditor.getXLFHandler(); String rowId = handler.getRowId(rowIndex); /* burke 修改锁定文本段不能被分割和光标在文本段段首或者段末时,不能进行分割的BUG 添加代码 起 */ String tgt = handler.getCaseTgtContent(rowId); if (null != tgt) { if (tgt.equals("no")) { showInformation(event, Messages.getString("handler.SplitSegmentHandler.msg2")); return null; } } int cellTextLength = ((UpdateDataBean) cellEditor.getCanonicalValue()).getText().length(); if (caretOffset <= 0 || caretOffset >= cellTextLength) { showInformation(event, Messages.getString("handler.SplitSegmentHandler.msg3")); return null; } /* burke 修改锁定文本段不能被分割和光标在文本段段首或者段末时,不能进行分割的BUG 添加代码 终 */ cellEditor.close(); // 关闭Editor IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory(); try { operationHistory.execute(new SplitSegmentOperation("Split Segment", xliffEditor, handler, rowIndex, caretOffset), null, null); } catch (ExecutionException e) { e.printStackTrace(); } return null; }