mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
WI-2477: Ability to specify to a file a JavaScript library/file to autocomplete from (in progress)
This commit is contained in:
@@ -146,6 +146,10 @@ public class EditLibraryDialog extends DialogWrapper {
|
||||
fireTableDataChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public VirtualFile[] getFiles() {
|
||||
return files.toArray(new VirtualFile[files.size()]);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSelection() {
|
||||
@@ -162,4 +166,8 @@ public class EditLibraryDialog extends DialogWrapper {
|
||||
private void removeSelected() {
|
||||
myFileTableModel.removeFile(mySelectedFile);
|
||||
}
|
||||
|
||||
public VirtualFile[] getFiles() {
|
||||
return myFileTableModel.getFiles();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ public class ScriptingLibrariesPanel {
|
||||
EditLibraryDialog editLibDialog = new EditLibraryDialog(myProvider, myProject);
|
||||
editLibDialog.show();
|
||||
if (editLibDialog.isOK()) {
|
||||
myLibTableModel.createLibrary(editLibDialog.getLibName());
|
||||
myLibTableModel.createLibrary(editLibDialog.getLibName(), editLibDialog.getFiles());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-2
@@ -15,8 +15,11 @@
|
||||
*/
|
||||
package com.intellij.ide.scriptingContext.ui;
|
||||
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTable;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
@@ -29,10 +32,12 @@ public class ScriptingLibraryTableModel extends AbstractTableModel {
|
||||
private static final int LIB_NAME_COL = 0;
|
||||
|
||||
private LibraryTable myLibTable;
|
||||
private LibraryTable.ModifiableModel myLibTableModel;
|
||||
private boolean myTableChanged;
|
||||
|
||||
public ScriptingLibraryTableModel(LibraryTable libTable) {
|
||||
myLibTable = libTable;
|
||||
myLibTableModel = libTable.getModifiableModel();
|
||||
myTableChanged = false;
|
||||
}
|
||||
|
||||
@@ -71,8 +76,14 @@ public class ScriptingLibraryTableModel extends AbstractTableModel {
|
||||
return "?";
|
||||
}
|
||||
|
||||
public void createLibrary(String name) {
|
||||
myLibTable.createLibrary(name);
|
||||
public void createLibrary(String name, VirtualFile[] files) {
|
||||
Library lib = myLibTable.createLibrary(name);
|
||||
Library.ModifiableModel libModel = lib.getModifiableModel();
|
||||
for (VirtualFile file : files) {
|
||||
libModel.addRoot(file, OrderRootType.CLASSES);
|
||||
}
|
||||
libModel.commit();
|
||||
myLibTableModel.commit();
|
||||
fireLibTableChanged();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user