use of org.jetbrains.annotations.Nullable in project folding-plugin by dmytrodanylyk.
the class SettingConfigurable method createComponent.
@Nullable
@Override
public JComponent createComponent() {
useCustomPatternCheckBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
boolean selected = getCheckBoxStatus(actionEvent);
customPattern.setEnabled(selected);
isModified = true;
}
});
customPattern.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
isModified = true;
}
@Override
public void removeUpdate(DocumentEvent e) {
isModified = true;
}
@Override
public void changedUpdate(DocumentEvent e) {
isModified = true;
}
});
hideFoldingPrefix.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
isModified = true;
}
});
reset();
return mPanel;
}
use of org.jetbrains.annotations.Nullable in project midpoint by Evolveum.
the class DataModelUtil method resolvePath.
// null means not supported yet
@Nullable
@SuppressWarnings("unchecked")
public static PathResolutionResult resolvePath(@NotNull ItemPath path, @NotNull PathResolutionContext context) {
if (!(path.first() instanceof NameItemPathSegment)) {
return new PathResolutionResult(new Issue(Issue.Severity.WARNING, CAT_ITEM_PATH, C_DOES_NOT_START_WITH_NAME, "Path does not start with a name: '" + path + "'", null, null));
}
QName varName;
ItemPath itemPath;
NameItemPathSegment firstNameSegment = (NameItemPathSegment) path.first();
if (firstNameSegment.isVariable()) {
varName = firstNameSegment.getName();
itemPath = path.tail();
} else {
if (context.defaultVariable == null) {
return new PathResolutionResult(new Issue(Issue.Severity.WARNING, CAT_ITEM_PATH, C_NO_DEFAULT_VARIABLE, "No default variable for item path: '" + path + "'", null, null));
}
varName = context.defaultVariable;
itemPath = path;
}
if (QNameUtil.match(ExpressionConstants.VAR_ACCOUNT, varName)) {
if (!(context instanceof ResourceResolutionContext)) {
return new PathResolutionResult(new Issue(Issue.Severity.WARNING, CAT_ITEM_PATH, C_ILLEGAL_USE_OF_ACCOUNT_VARIABLE, "Illegal use of 'account' variable: '" + path + "'", null, null));
} else {
// TODO implement checking of $account-based paths
return null;
}
} else if (QNameUtil.match(ExpressionConstants.VAR_USER, varName) || QNameUtil.match(ExpressionConstants.VAR_FOCUS, varName)) {
Class<? extends FocusType> clazz = FocusType.class;
if (context instanceof ResourceResolutionContext) {
ResourceResolutionContext rctx = (ResourceResolutionContext) context;
ObjectSynchronizationType def = ResourceTypeUtil.findObjectSynchronization(rctx.resource, rctx.kind, rctx.intent);
if (def != null) {
QName focusType = def.getFocusType() != null ? def.getFocusType() : UserType.COMPLEX_TYPE;
PrismObjectDefinition<Objectable> objdef = rctx.prismContext.getSchemaRegistry().findObjectDefinitionByType(focusType);
if (objdef != null && objdef.getCompileTimeClass() != null && FocusType.class.isAssignableFrom(objdef.getCompileTimeClass())) {
clazz = (Class) objdef.getCompileTimeClass();
}
} else {
// the default (MID-3307)
clazz = UserType.class;
}
}
return resolvePathForType(clazz, itemPath, context);
} else if (QNameUtil.match(ExpressionConstants.VAR_ACTOR, varName)) {
return resolvePathForType(UserType.class, itemPath, context);
} else if (QNameUtil.match(ExpressionConstants.VAR_INPUT, varName)) {
return null;
} else {
// TODO list all possible variables here and issue a warning if no one matches
return null;
}
}
use of org.jetbrains.annotations.Nullable in project midpoint by Evolveum.
the class DataModelUtil method resolvePathForType.
// null means not supported yet
@Nullable
public static PathResolutionResult resolvePathForType(@NotNull Class<? extends ObjectType> clazz, @NotNull ItemPath path, @NotNull PathResolutionContext context) {
PrismObjectDefinition<?> def = context.prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(clazz);
if (def == null) {
return new PathResolutionResult(new Issue(Issue.Severity.WARNING, CAT_ITEM_PATH, C_NO_OBJECT_DEFINITION, "No definition for " + clazz + " in item path: '" + path + "'", null, null));
}
ItemDefinition<?> itemDef = def.findItemDefinition(path);
if (itemDef != null) {
return new PathResolutionResult(itemDef);
} else {
if (FocusType.class.equals(clazz) && context instanceof ResourceResolutionContext) {
ResourceResolutionContext rctx = (ResourceResolutionContext) context;
return new PathResolutionResult(new Issue(Issue.Severity.INFO, CAT_ITEM_PATH, C_NO_OBJECT_DEFINITION, "Couldn't verify item path '" + path + "' because specific focus type (user, role, org, ...) is not defined for kind=" + rctx.kind + ", intent=" + rctx.intent, null, null));
} else {
return new PathResolutionResult(new Issue(Issue.Severity.WARNING, CAT_ITEM_PATH, C_NO_OBJECT_DEFINITION, "No definition for '" + path + "' in " + def.getName().getLocalPart(), null, null));
}
}
}
use of org.jetbrains.annotations.Nullable in project pysonar2 by yinwang0.
the class Analyzer method loadFile.
@Nullable
public Type loadFile(String path) {
path = $.unifyPath(path);
File f = new File(path);
if (!f.canRead()) {
return null;
}
Type module = getCachedModule(path);
if (module != null) {
return module;
}
// detect circular import
if (inImportStack(path)) {
return null;
}
// set new CWD and save the old one on stack
String oldcwd = cwd;
setCWD(f.getParent());
pushImportStack(path);
Type type = parseAndResolve(path);
popImportStack(path);
// restore old CWD
setCWD(oldcwd);
return type;
}
use of org.jetbrains.annotations.Nullable in project pysonar2 by yinwang0.
the class Analyzer method parseAndResolve.
@Nullable
private Type parseAndResolve(String file) {
loadingProgress.tick();
Node ast = getAstForFile(file);
if (ast == null) {
failedToParse.add(file);
return null;
} else {
Type type = inferencer.visit(ast, moduleTable);
loadedFiles.add(file);
return type;
}
}
Aggregations