-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IIP-13 / Feature Add inline actions for impex files #53
IIP-13 / Feature Add inline actions for impex files #53
Conversation
… Hybris console when we choose copy function.
|
||
@Override | ||
public void update(@NotNull final AnActionEvent e) { | ||
final DataContext dataContext = e.getDataContext(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to have DataContext dataContext
if Project project = e.getProject();
?
return isImpex; | ||
} | ||
|
||
private List<String> getFilesName(@NotNull final DataContext dataContext) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to have an access to VirtualFile and then check its extension.
Smth like
StructureTreeModel.Node lastPathComponent = (StructureTreeModel.Node) file.getLastPathComponent();
ProjectViewNode element = (ProjectViewNode) lastPathComponent.getElement();
element.getVirtualFile().getExtension();
for (final TreePath treePath : files) { | ||
final DefaultMutableTreeNode lastPathNode = (DefaultMutableTreeNode) treePath.getLastPathComponent(); | ||
final PsiFileNode file = (PsiFileNode) lastPathNode.getUserObject(); | ||
final HybrisConsolePanel hybrisConsolePanel = getHybrisConsolePanel(project); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you want to check whether the project is not null - then it should be before this line
if (hybrisConsole != null && project != null) { | ||
if (!getTextFromHybrisConsole(project, hybrisConsole).isEmpty()) { | ||
final CopyFileToHybrisConsoleDialog copyFileToHybrisConsoleDialog = new CopyFileToHybrisConsoleDialog(project); | ||
copyFileToHybrisConsoleDialog.setTitle("Flexible Search Console"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string label is a good candidate to be moved to the property file
} | ||
|
||
@Override | ||
public void actionPerformed(@NotNull final AnActionEvent e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that common code could be also moved to AbstractCopyFileToHybrisConsoleAction
if (files != null) { | ||
for (final Object file : files) { | ||
final TreePath treePath = (TreePath) file; | ||
names.add(treePath.getLastPathComponent().toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't trust to *.toString()
return names; | ||
} | ||
|
||
public Object[] getFiles(@NotNull final DataContext dataContext) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try not to return the Object
or Object[]
Cast to the specific type which will be returned. like TreePath
return names; | ||
} | ||
|
||
public Object[] getFiles(@NotNull final DataContext dataContext) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here we can return array or null (.getSelectionPaths()
), is it possible to return just an array, populated or empty?
Added ability to copy text from Impex and Flexible Search files to Hybris Console.
Signed-off-by: Vladyslav Yanytskyi [email protected]