javax.security.auth.Refreshable Java Examples

The following examples show how to use javax.security.auth.Refreshable. 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: VariablesTableModel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Object getValueOf(Variable var, Object row, String columnID) {
    if (var instanceof Refreshable) {
        boolean current = ((Refreshable) var).isCurrent();
        if (!current) {
            return var.getValue();
        }
    }
    if (ValuePropertyEditor.hasPropertyEditorFor(var)) {
        Object mirror = var.createMirrorObject();
        synchronized (mirrors) {
            if (mirror == null) {
                mirrors.remove(var);
                origValues.remove(var);
            } else {
                mirrors.put(var, mirror);
                //origValues.put(var, ((JDIVariable) var).getJDIValue());
            }
            // Put in any case, the mirror might not be applicable to the property editor.
            values.put(var, var.getValue());
        }
    } else {
        return var.getValue();
        /*synchronized (mirrors) {
            values.put(var, var.getValue());
        }*/
    }
    boolean isROCheck;
    synchronized (checkReadOnlyMutables) {
        isROCheck = checkReadOnlyMutables.remove((Variable) row);
    }
    if (true || isROCheck) {
        fireModelChange(new ModelEvent.TableValueChanged(this, row, columnID, ModelEvent.TableValueChanged.IS_READ_ONLY_MASK));
    }
    return var;
}
 
Example #2
Source File: VariablesTreeModelFilter.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static void waitToEvaluate(Object o) {
    if (o instanceof Refreshable) {
        // waits for the evaluation, the retrieval must already be initiated
        try {
            ((Refreshable) o).refresh();
        } catch (RefreshFailedException exc) {
            // Thrown when interrupted
            Thread.currentThread().interrupt();
        }
    }
    loadAllTypes(o); // Initialize all types, implemented interfaces and super classes
}
 
Example #3
Source File: LocalsTreeModel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public boolean isLeaf (final Object o) throws UnknownTypeException {
    if (o.equals (ROOT))
        return false;
    if (o instanceof AbstractVariable) {
        if (o instanceof FieldVariable) {
            return true;
        }
        if (o instanceof Refreshable && !((Refreshable) o).isCurrent()) {
            debugger.getRequestProcessor().post(new Runnable() {
                public void run() {
                    try {
                        ((Refreshable) o).refresh();
                    } catch (RefreshFailedException ex) {
                        return ;
                    }
                    if (!(((AbstractVariable) o).getInnerValue () instanceof ObjectReference)) {
                        fireNodeChildrenChanged(o);
                    }
                }
            });
            return false;
        }
        return !(((AbstractVariable) o).getInnerValue () instanceof ObjectReference);
    }
    if (o.toString().startsWith("SubArray")) {
        return false;
    }
    if (o.equals ("NoInfo")) // NOI18N
        return true;
    if (o instanceof JPDAClassType) return false;
    if (o instanceof Operation) return false;
    if (o == "lastOperations") return false;
    if (o == NO_DEBUG_INFO) return true;
    if (o instanceof String && ((String) o).startsWith("operationArguments")) { // NOI18N
        return false;
    }
    throw new UnknownTypeException (o);
}
 
Example #4
Source File: JPDADebuggerImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public String getLabel(ObjectVariable var) {
    if (var instanceof Refreshable) {
        if (!((Refreshable) var).isCurrent()) {
            return null;
        }
    }
    synchronized (markedObjects) {
        return markedObjects.get(var.getUniqueID());
    }
}
 
Example #5
Source File: HeapActionsFilter.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isEnabled (Object node) {
    if ((node == null) || (!(node instanceof ObjectVariable))) {
        return false;
    }
    ObjectVariable var = (ObjectVariable) node;
    if (var instanceof Refreshable) {
        if (!((Refreshable) var).isCurrent()) {
            return false;
        }
    }
    return var.getUniqueID() != 0L;
}
 
Example #6
Source File: VariablesTableModel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Object getValueAt (Object row, String columnID) throws 
UnknownTypeException {
    
    if ( LOCALS_TO_STRING_COLUMN_ID.equals (columnID) ||
         WATCH_TO_STRING_COLUMN_ID.equals (columnID)
    ) {
        if (row instanceof Super)
            return "";
        else

        if (row instanceof ObjectVariable)
            try {
                String toStr = ((ObjectVariable) row).getToStringValue ();
                setErrorToStringMsg((ObjectVariable) row, null);
                return toStr;
            } catch (InvalidExpressionException ex) {
                String errorMsg = getMessage (ex);
                setErrorToStringMsg((ObjectVariable) row, errorMsg);
                return errorMsg;
            }
        else
        if (row instanceof Variable) {
            return ((Variable) row).getValue ();
        }
        if (row instanceof Operation ||
            row == "lastOperations" || // NOI18N
            row instanceof String && ((String) row).startsWith("operationArguments ")) { // NOI18N
            
            return ""; // NOI18N
        }
    } else
    if ( LOCALS_TYPE_COLUMN_ID.equals (columnID) ||
         WATCH_TYPE_COLUMN_ID.equals (columnID)
    ) {
        if (row instanceof Variable)
            return getShort (((Variable) row).getType ());
        if (row instanceof javax.swing.JToolTip) {
            row = ((javax.swing.JToolTip) row).getClientProperty("getShortDescription");
            if (row instanceof Variable) {
                if (row instanceof Refreshable && !((Refreshable) row).isCurrent()) {
                    return "";
                }
                return ((Variable) row).getType();
            }
        }
    } else
    if ( LOCALS_VALUE_COLUMN_ID.equals (columnID) ||
         WATCH_VALUE_COLUMN_ID.equals (columnID)
    ) {
        if (row instanceof JPDAWatch) {
            JPDAWatch w = (JPDAWatch) row;
            String e = w.getExceptionDescription ();
            if (e != null) {
                setErrorValueMsg(w, e);
                return e;
            } else {
                setErrorValueMsg(w, null);
            }
        }
        if (row instanceof Variable) {
            Variable var = (Variable) row;
            if (VariablesViewButtons.isShowValuePropertyEditors()) {
                return getValueOf(var, row, columnID);
            } else {
                return var.getValue();
            }
        }
    }
    if (row instanceof JPDAClassType) {
        return ""; // NOI18N
    }
    if (row.toString().startsWith("SubArray")) { // NOI18N
        return ""; // NOI18N
    }
    if (row instanceof Operation ||
        row == "lastOperations" || // NOI18N
        row instanceof String && ((String) row).startsWith("operationArguments ")) { // NOI18N

        return ""; // NOI18N
    }
    if (row == "noDebugInfoWarning") { // NOI18N
        return ""; // NOI18N
    }
    if (row == "No current thread") { // NOI18N
        return "";
    }
    throw new UnknownTypeException (row);
}
 
Example #7
Source File: VariablesTableModel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
static boolean isReadOnlyVar(Object row, JPDADebugger debugger) {
    if (row instanceof This)
        return true;
    else {
        if (row instanceof JPDAWatch && row instanceof Refreshable) {
            if (!((Refreshable) row).isCurrent()) {
                return true;
            }
            try {
                // Retrieve the evaluated watch so that we can test if it's an object variable or not.
                java.lang.reflect.Method getEvaluatedWatchMethod = row.getClass().getDeclaredMethod("getEvaluatedWatch");
                getEvaluatedWatchMethod.setAccessible(true);
                row = (JPDAWatch) getEvaluatedWatchMethod.invoke(row);
            } catch (Exception ex) {
                Exceptions.printStackTrace(ex);
            }
        }
        if (row instanceof JPDAWatch) {
            JPDAWatch w = (JPDAWatch) row;
            String e = w.getExceptionDescription ();
            if (e != null) {
                return true; // Errors are read only
            }
        }
        if (row instanceof MutableVariable) {
            synchronized (checkReadOnlyMutables) {
                checkReadOnlyMutables.add((MutableVariable) row);
            }
            Object mirror = getMirrorFor((Variable) row);
            if (mirror != null) {
                return false;
            }
        }
        if (row instanceof ObjectVariable) {
            String declaredType;
            if (row instanceof LocalVariable) {
                declaredType = ((LocalVariable) row).getDeclaredType();
            } else if (row instanceof Field) {
                declaredType = ((Field) row).getDeclaredType();
            } else {
                declaredType = ((ObjectVariable) row).getType();
            }
            // Allow to edit Strings
            if (!"java.lang.String".equals(declaredType)) { // NOI18N
                return true;
            }
        }
        if ( row instanceof LocalVariable ||
             row instanceof Field ||
             row instanceof JPDAWatch
        ) {
            if (WatchesNodeModelFilter.isEmptyWatch(row)) {
                return true;
            } else {
                return !debugger.canBeModified();
            }
        } else {
            return true;
        }
    }
}
 
Example #8
Source File: VariablesTreeModelFilter.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public static boolean isEvaluated(Object o) {
    if (o instanceof Refreshable) {
        return ((Refreshable) o).isCurrent();
    }
    return true;
}