use of com.intellij.openapi.vfs.pointers.VirtualFilePointer in project intellij-plugins by JetBrains.
the class OsgiRunConfigurationEditor method resetEditorFrom.
@Override
protected void resetEditorFrom(@NotNull OsgiRunConfiguration osgiRunConfiguration) {
myRunConfiguration = osgiRunConfiguration;
myVmOptions.setText(osgiRunConfiguration.getVmParameters());
myProgramParameters.setText(osgiRunConfiguration.getProgramParameters());
myFrameworkInstances.setSelectedItem(osgiRunConfiguration.getInstanceToUse());
myClassPathAllBundles.setSelected(osgiRunConfiguration.isIncludeAllBundlesInClassPath());
if (myCurrentRunPropertiesEditor != null) {
myCurrentRunPropertiesEditor.resetEditorFrom(osgiRunConfiguration);
}
// I deliberately set the list of modules as the last step here as
// the framework specific modules are cleaned out when you change the framework instance
// so the framework instance should be changed first
List<SelectedBundle> modules = osgiRunConfiguration.getBundlesToDeploy();
RunConfigurationTableModel model = getTableModel();
while (model.getRowCount() > 0) {
model.removeBundleAt(0);
}
for (SelectedBundle module : modules) {
model.addBundle(module);
}
myBundlesTable.getColumnModel().getColumn(1).setPreferredWidth(200);
myFrameworkStartLevel.setValue(osgiRunConfiguration.getFrameworkStartLevel());
myDefaultStartLevel.setValue(osgiRunConfiguration.getDefaultStartLevel());
boolean useUserDefinedFields = !osgiRunConfiguration.isGenerateWorkingDir();
myWorkingDirField.setText(osgiRunConfiguration.getWorkingDir());
if (myWorkingDirField.getText().length() == 0) {
final CompilerProjectExtension extension = CompilerProjectExtension.getInstance(myProject);
if (extension != null) {
final VirtualFilePointer outputDirPointer = extension.getCompilerOutputPointer();
if (outputDirPointer != null) {
myWorkingDirField.setText(VfsUtilCore.urlToPath(outputDirPointer.getUrl() + "/run.osgi/"));
}
}
}
myWorkingDirField.setEnabled(useUserDefinedFields);
myUserDefinedDir.setSelected(useUserDefinedFields);
myOsmorcControlledDir.setSelected(!useUserDefinedFields);
myJrePathEditor.setPathOrName(osgiRunConfiguration.getAlternativeJrePath(), osgiRunConfiguration.isUseAlternativeJre());
}
use of com.intellij.openapi.vfs.pointers.VirtualFilePointer in project intellij-community by JetBrains.
the class UpdateInfoTree method createTree.
private void createTree() {
SmartExpander.installOn(myTree);
SelectionSaver.installOn(myTree);
createTreeModel();
myTree.addTreeSelectionListener(new TreeSelectionListener() {
public void valueChanged(TreeSelectionEvent e) {
AbstractTreeNode treeNode = (AbstractTreeNode) e.getPath().getLastPathComponent();
VirtualFilePointer pointer = null;
if (treeNode instanceof FileTreeNode) {
pointer = ((FileTreeNode) treeNode).getFilePointer();
}
if (pointer != null) {
mySelectedUrl = pointer.getUrl();
mySelectedFile = pointer.getFile();
} else {
mySelectedUrl = null;
mySelectedFile = null;
}
}
});
myTree.setCellRenderer(new UpdateTreeCellRenderer());
TreeUtil.installActions(myTree);
new TreeSpeedSearch(myTree, new Convertor<TreePath, String>() {
public String convert(TreePath path) {
Object last = path.getLastPathComponent();
if (last instanceof AbstractTreeNode) {
return ((AbstractTreeNode) last).getText();
}
return TreeSpeedSearch.NODE_DESCRIPTOR_TOSTRING.convert(path);
}
}, true);
myTree.addMouseListener(new PopupHandler() {
public void invokePopup(Component comp, int x, int y) {
final DefaultActionGroup group = (DefaultActionGroup) ActionManager.getInstance().getAction("UpdateActionGroup");
if (group != null) {
//if no UpdateActionGroup was configured
ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UPDATE_POPUP, group);
popupMenu.getComponent().show(comp, x, y);
}
}
});
EditSourceOnDoubleClickHandler.install(myTree);
EditSourceOnEnterKeyHandler.install(myTree);
myTree.setSelectionRow(0);
}
use of com.intellij.openapi.vfs.pointers.VirtualFilePointer in project intellij-community by JetBrains.
the class FileTreeNode method acceptFilter.
@Override
protected boolean acceptFilter(Pair<PackageSetBase, NamedScopesHolder> filter, boolean showOnlyFilteredItems) {
try {
VirtualFilePointer filePointer = getFilePointer();
if (!filePointer.isValid()) {
return false;
}
VirtualFile file = filePointer.getFile();
if (file != null && file.isValid() && filter.first.contains(file, getProject(), filter.second)) {
applyFilter(true);
return true;
}
} catch (Throwable e) {
// TODO: catch and ignore exceptions: see to FilePatternPackageSet
// sometimes for new file DirectoryFileIndex.getContentRootForFile() return random path
}
return false;
}
use of com.intellij.openapi.vfs.pointers.VirtualFilePointer in project intellij-community by JetBrains.
the class LibraryImpl method isValid.
@Override
public boolean isValid(@NotNull final String url, @NotNull final OrderRootType rootType) {
final VirtualFilePointerContainer container = myRoots.get(rootType);
final VirtualFilePointer fp = container.findByUrl(url);
return fp != null && fp.isValid();
}
use of com.intellij.openapi.vfs.pointers.VirtualFilePointer in project intellij-community by JetBrains.
the class LibraryImpl method removeRoot.
@Override
public boolean removeRoot(@NotNull String url, @NotNull OrderRootType rootType) {
checkDisposed();
LOG.assertTrue(isWritable());
final VirtualFilePointerContainer container = myRoots.get(rootType);
final VirtualFilePointer byUrl = container.findByUrl(url);
if (byUrl != null) {
container.remove(byUrl);
if (myExcludedRoots != null) {
for (String excludedRoot : myExcludedRoots.getUrls()) {
if (!isUnderRoots(excludedRoot)) {
VirtualFilePointer pointer = myExcludedRoots.findByUrl(excludedRoot);
if (pointer != null) {
myExcludedRoots.remove(pointer);
}
}
}
}
myJarDirectories.remove(rootType, url);
return true;
}
return false;
}
Aggregations