@Override public Void visitUnknown(TypeMirror t, Types types) { try { return super.visitUnknown(t, types); } catch (UnknownTypeException ex) { System.err.println("caught " + ex); return null; } }
public Action[] getActions(NodeActionsProvider original, Object node) throws UnknownTypeException, org.netbeans.spi.viewmodel.UnknownTypeException { Action[] actions = original.getActions(node); List myActions = new ArrayList(); if (node instanceof ObjectVariable) { ObjectVariable objectVariable = (ObjectVariable) node; if (objectVariable.getClassType().getName().equals("org.jbpm.ruleflow.instance.RuleFlowProcessInstance")) { myActions.add( Models.createAction( "Open ProcessInstance Viewer", new ProcessInstanceViewerAction(objectVariable), Models.MULTISELECTION_TYPE_EXACTLY_ONE)); } } if (myActions.isEmpty()) { return actions; } ArrayList actionToAdd = new ArrayList(); actionToAdd.addAll(Arrays.asList(actions)); actionToAdd.addAll(myActions); return (Action[]) actionToAdd.toArray(new Action[actionToAdd.size()]); }
private void addAdapterForField( ImmutableMap.Builder<FieldDescriptor, AdapterDescriptor> fieldAdapterMap, FieldDescriptor field, boolean allowSerializable) { TypeMirror fieldType = field.type().get(); //noinspection ConstantConditions if (!fieldType.getKind().isPrimitive()) { AdapterDescriptor adapter = adapterFactory.create(fieldType, allowSerializable); if (adapter != null) { fieldAdapterMap.put(field, adapter); } else { throw new UnknownTypeException(fieldType, field.element()); } } }
public void performDefaultAction(NodeActionsProvider original, Object node) throws UnknownTypeException, org.netbeans.spi.viewmodel.UnknownTypeException { original.performDefaultAction(node); }
/** * Used on every game turn. Method checks "next" by direction cell for some * {@link CellElement} and if it have found - decides what to do with it. * * @throws UnknownTypeException * If not found what to do with found {@link CellElement} */ private void lunch() { if (direction == Direction.STOP) { return; } CellElement headTo = head.lookForward(direction); if (headTo != null) { if (headTo instanceof Piece) { Piece toPiece = (Piece) headTo; if (toPiece.parent.equals(this)) { kill();// ate himself } else if (toPiece.isHead()) { duelWith(toPiece.parent);// someone will die } else { int cutLength = toPiece.parent.nipOff(toPiece); score += cutLength * ALIVE_TAIL_MULTIPLIER; grow(cutLength / 2); // ate someone`s tail } } else if (headTo instanceof Food) { dinner((Food) headTo); } else if (headTo instanceof Seed) { weapon = (Seed) headTo; } else if (headTo instanceof Plant) { if (((Plant) headTo).getType() == PlantType.CATCHER) { kill(); } } else { throw new UnknownTypeException(null, headTo); } } }
/** * Visits an unknown kind of type. This can occur if the language evolves and new kinds of types are added to the * {@link TypeMirror} hierarchy. * * <p>The default implementation of this method in {@code TypeKindVisitor7WithIntersectionType} will always throw * {@link UnknownTypeException}. This behavior is not required of a subclass. * * @param typeMirror the type to visit * @param parameter a visitor-specified parameter * @return a visitor-specified result * @throws UnknownTypeException a visitor implementation may optionally throw this exception */ @Nullable public R visitOther(TypeMirror typeMirror, @Nullable P parameter) { throw new UnknownTypeException(typeMirror, parameter); }