Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ tasks {
withType<JavaCompile> {
sourceCompatibility = it
targetCompatibility = it

// show deprecations
// options.compilerArgs.addAll(listOf("-Xlint:deprecation"))
}
withType<KotlinCompile> {
compilerOptions {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public boolean isCellEditable(ServiceParameter modelParameter) {
public TableCellEditor getEditor(ServiceParameter modelParameter) {

Set<String> sorted = modelParameter.getPossibleServices();
ComboBox comboBox = new ComboBox(sorted.toArray(new String[0]), 200);
ComboBox<String> comboBox = new ComboBox<>(sorted.toArray(new String[0]), 200);
comboBox.setEditable(true);

return new DefaultCellEditor(comboBox);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public static String getAnnotationRepositoryClass(@NotNull PhpDocTag phpDocTag,
phpClass,
text,
"repositoryClass",
aVoid -> AnnotationUtil.getUseImportMap(phpDocTag)
aVoid -> AnnotationBackportUtil.getUseImportMap(phpDocTag)
);

if (repositoryClass == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ public static Collection<DoctrineModelField> getModelFields(@NotNull PhpClass ph
PhpDocComment docComment = phpClass.getDocComment();
if(docComment != null) {
if(AnnotationBackportUtil.hasReference(docComment, "\\Doctrine\\ORM\\Mapping\\Entity")) {
Map<String, String> useImportMap = AnnotationUtil.getUseImportMap(docComment);
Map<String, String> useImportMap = AnnotationBackportUtil.getUseImportMap(docComment);
for(Field field: phpClass.getFields()) {
if (!field.isConstant()) {
if (AnnotationBackportUtil.hasReference(field.getDocComment(), ANNOTATION_FIELDS)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public DoctrineMetadataModel getMetadata(@NotNull DoctrineMappingDriverArguments
// collect import context based on the class name
String fqn = containingClass.getFQN();
if (!maps.containsKey(fqn)) {
maps.put(fqn, AnnotationUtil.getUseImportMap(field.getDocComment()));
maps.put(fqn, AnnotationBackportUtil.getUseImportMap(field.getDocComment()));
}

DoctrineModelField modelField = new DoctrineModelField(field.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ private Map<String, ContainerParameter> getParameters() {
// user input here; secure nullable values
String key = Entry.getKey();
if(key != null) {
parametersMap.put(key, new ContainerParameter(key, Entry.getValue()));
parametersMap.put(key, new ContainerParameter(key, Entry.getValue(), false));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ public T read(@NotNull DataInput in) throws IOException {

T object = null;
try {
object = (T) input.readObject();
@SuppressWarnings("unchecked")
T readObject = (T) input.readObject();
object = readObject;
} catch (ClassNotFoundException | ClassCastException ignored) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,25 @@ public TwigPath(@NotNull String path, @NotNull String namespace, @NotNull TwigUt
this.customPath = customPath;
}

public static TwigPath createTwigPath(@NotNull String path, @NotNull String namespace, @NotNull TwigUtil.NamespaceType namespaceType, boolean customPath, boolean enabled) {
TwigPath twigPath = new TwigPath(path, namespace, namespaceType, customPath);
twigPath.enabled = enabled;
return twigPath;
}

public static TwigPath createClone(@NotNull TwigPath twigPath) {
return createClone(twigPath, twigPath.isEnabled());
}

public static TwigPath createClone(@NotNull TwigPath twigPath, boolean enabled) {
TwigPath newTwigPath = new TwigPath(
twigPath.getPath(),
twigPath.getNamespace(),
twigPath.getNamespaceType(),
twigPath.isCustomPath()
);

newTwigPath.setEnabled(twigPath.isEnabled());
newTwigPath.enabled = enabled;
return newTwigPath;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1499,10 +1499,11 @@ public static List<TwigPath> getTwigNamespaces(@NotNull Project project, boolean
}

// disable namespace explicitly disabled by user
for(TwigPath twigPath: twigPaths) {
for(int i = 0; i < twigPaths.size(); i++) {
TwigPath twigPath = twigPaths.get(i);
TwigNamespaceSetting twigNamespaceSetting = findManagedTwigNamespace(project, twigPath);
if(twigNamespaceSetting != null) {
twigPath.setEnabled(false);
twigPaths.set(i, TwigPath.createClone(twigPath, false));
}
}

Expand All @@ -1516,7 +1517,7 @@ public static List<TwigPath> getTwigNamespaces(@NotNull Project project, boolean
if(twigNamespaceSettings != null) {
for(TwigNamespaceSetting twigNamespaceSetting: twigNamespaceSettings) {
if(twigNamespaceSetting.isCustom()) {
twigPaths.add(new TwigPath(twigNamespaceSetting.getPath(), twigNamespaceSetting.getNamespace(), twigNamespaceSetting.getNamespaceType(), true).setEnabled(twigNamespaceSetting.isEnabled()));
twigPaths.add(TwigPath.createTwigPath(twigNamespaceSetting.getPath(), twigNamespaceSetting.getNamespace(), twigNamespaceSetting.getNamespaceType(), true, twigNamespaceSetting.isEnabled()));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class TranslatorKeyExtractorDialog extends JDialog {
private JButton buttonCancel;
private JTextField textTranslationKey;
private JPanel panelTableView;
private JComboBox comboBox1;
private JComboBox<String> comboBox1;
private JCheckBox checkNavigateTo;

private final ListTableModel<TranslationFileModel> listTableModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public class MethodParameterDialog extends JDialog {
private JPanel contentPane;
private JButton buttonOK;
private JButton buttonCancel;
private JComboBox comboProvider;
private JComboBox comboContributor;
private JComboBox<String> comboProvider;
private JComboBox<String> comboContributor;
private JTextField textCallTo;
private JTextField textMethodName;
private JTextField textIndex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class MethodSignatureTypeDialog extends JDialog {
private JPanel contentPane;
private JButton buttonOK;
private JButton buttonCancel;
private JComboBox comboProvider;
private JComboBox<String> comboProvider;
private JTextField textCallTo;
private JTextField textMethodName;
private JTextField textIndex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private void onOK() {

String namespacePath = this.namespacePath.getText();

TwigPath twigPath = new TwigPath(namespacePath, namespace, TwigUtil.NamespaceType.valueOf((String) this.namespaceType.getSelectedItem()), true);
TwigPath twigPath = TwigPath.createTwigPath(namespacePath, namespace, TwigUtil.NamespaceType.valueOf((String) this.namespaceType.getSelectedItem()), true, this.chkboxEnabled.isSelected());
if (namespacePath.isEmpty()) {
dispose();
return;
Expand All @@ -106,7 +106,6 @@ private void onOK() {
this.tableView.setRowSelectionInterval(row, row);
}

twigPath.setEnabled(this.chkboxEnabled.isSelected());
dispose();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void mouseClicked(MouseEvent e) {
for (TwigPath twigPath : sortableLookupItems) {
// dont use managed class here
// @TODO state to enabled (should not be here)
TwigSettingsForm.this.modelList.addRow(TwigPath.createClone(twigPath).setEnabled(true));
TwigSettingsForm.this.modelList.addRow(TwigPath.createClone(twigPath, true));
}
}
});
Expand Down Expand Up @@ -281,8 +281,12 @@ public Boolean valueOf(TwigPath twigPath) {
}

public void setValue(TwigPath twigPath, Boolean value) {
twigPath.setEnabled(value);
TwigSettingsForm.this.tableView.getListTableModel().fireTableDataChanged();
int index = TwigSettingsForm.this.tableView.getListTableModel().getItems().indexOf(twigPath);
if (index >= 0) {
TwigPath newTwigPath = TwigPath.createClone(twigPath, value);
TwigSettingsForm.this.tableView.getListTableModel().removeRow(index);
TwigSettingsForm.this.tableView.getListTableModel().insertRow(index, newTwigPath);
}
}

public int getWidth(JTable table) {
Expand Down