use of org.jetbrains.annotations.NotNull in project robolectric by robolectric.
the class SdkEnvironment method createRuntimeSdkResourcePath.
@NotNull
private ResourcePath createRuntimeSdkResourcePath(DependencyResolver dependencyResolver) {
try {
Fs systemResFs = Fs.fromJar(dependencyResolver.getLocalArtifactUrl(sdkConfig.getAndroidSdkDependency()));
Class<?> androidRClass = getRobolectricClassLoader().loadClass("android.R");
Class<?> androidInternalRClass = getRobolectricClassLoader().loadClass("com.android.internal.R");
return new ResourcePath(androidRClass, systemResFs.join("res"), systemResFs.join("assets"), androidInternalRClass);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
use of org.jetbrains.annotations.NotNull in project robolectric by robolectric.
the class ShadowProviderGeneratorTest method element.
@NotNull
private ExecutableElement element(String reset) {
ExecutableElement resetterExecutable = mock(ExecutableElement.class);
Name mock = mock(Name.class);
when(mock.toString()).thenReturn(reset);
when(resetterExecutable.getSimpleName()).thenReturn(mock);
return resetterExecutable;
}
use of org.jetbrains.annotations.NotNull in project jadx by skylot.
the class CommonSearchDialog method initButtonsPanel.
@NotNull
protected JPanel initButtonsPanel() {
progressPane = new ProgressPanel(mainWindow, false);
JButton cancelButton = new JButton(NLS.str("search_dialog.cancel"));
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
dispose();
}
});
JButton openBtn = new JButton(NLS.str("search_dialog.open"));
openBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
openSelectedItem();
}
});
getRootPane().setDefaultButton(openBtn);
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
buttonPane.add(progressPane);
buttonPane.add(Box.createRigidArea(new Dimension(5, 0)));
buttonPane.add(Box.createHorizontalGlue());
buttonPane.add(openBtn);
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
buttonPane.add(cancelButton);
return buttonPane;
}
use of org.jetbrains.annotations.NotNull in project languagetool by languagetool-org.
the class ConfigurationDialog method getTreeModel.
@NotNull
private DefaultTreeModel getTreeModel(DefaultMutableTreeNode rootNode) {
DefaultTreeModel treeModel = new DefaultTreeModel(rootNode);
treeModel.addTreeModelListener(new TreeModelListener() {
@Override
public void treeNodesChanged(TreeModelEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.getTreePath().getLastPathComponent();
int index = e.getChildIndices()[0];
node = (DefaultMutableTreeNode) node.getChildAt(index);
if (node instanceof RuleNode) {
RuleNode o = (RuleNode) node;
if (o.getRule().isDefaultOff() || o.getRule().getCategory().isDefaultOff()) {
if (o.isEnabled()) {
config.getEnabledRuleIds().add(o.getRule().getId());
config.getDisabledRuleIds().remove(o.getRule().getId());
} else {
config.getEnabledRuleIds().remove(o.getRule().getId());
config.getDisabledRuleIds().add(o.getRule().getId());
}
} else {
if (o.isEnabled()) {
config.getDisabledRuleIds().remove(o.getRule().getId());
} else {
config.getDisabledRuleIds().add(o.getRule().getId());
}
}
}
if (node instanceof CategoryNode) {
CategoryNode o = (CategoryNode) node;
if (o.isEnabled()) {
config.getDisabledCategoryNames().remove(o.getCategory().getName());
} else {
config.getDisabledCategoryNames().add(o.getCategory().getName());
}
}
}
@Override
public void treeNodesInserted(TreeModelEvent e) {
}
@Override
public void treeNodesRemoved(TreeModelEvent e) {
}
@Override
public void treeStructureChanged(TreeModelEvent e) {
}
});
return treeModel;
}
use of org.jetbrains.annotations.NotNull in project languagetool by languagetool-org.
the class ConfigurationDialog method getMouseAdapter.
@NotNull
private MouseAdapter getMouseAdapter() {
return new MouseAdapter() {
private void handlePopupEvent(MouseEvent e) {
JTree tree = (JTree) e.getSource();
TreePath path = tree.getPathForLocation(e.getX(), e.getY());
if (path == null) {
return;
}
DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
TreePath[] paths = tree.getSelectionPaths();
boolean isSelected = false;
if (paths != null) {
for (TreePath selectionPath : paths) {
if (selectionPath.equals(path)) {
isSelected = true;
}
}
}
if (!isSelected) {
tree.setSelectionPath(path);
}
if (node.isLeaf()) {
JPopupMenu popup = new JPopupMenu();
JMenuItem aboutRuleMenuItem = new JMenuItem(messages.getString("guiAboutRuleMenu"));
aboutRuleMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
RuleNode node = (RuleNode) tree.getSelectionPath().getLastPathComponent();
Rule rule = node.getRule();
Language lang = config.getLanguage();
if (lang == null) {
lang = Languages.getLanguageForLocale(Locale.getDefault());
}
Tools.showRuleInfoDialog(tree, messages.getString("guiAboutRuleTitle"), rule.getDescription(), rule, messages, lang.getShortCodeWithCountryAndVariant());
}
});
popup.add(aboutRuleMenuItem);
popup.show(tree, e.getX(), e.getY());
}
}
@Override
public void mousePressed(MouseEvent e) {
if (e.isPopupTrigger()) {
handlePopupEvent(e);
}
}
@Override
public void mouseReleased(MouseEvent e) {
if (e.isPopupTrigger()) {
handlePopupEvent(e);
}
}
};
}
Aggregations