OpenAPI and Ant builds
Is there a way to tell when an Ant build has completed using the OpenAPI?
--
"A man's ethical behavior should be based effectually on sympathy,
education, and social ties and needs; no religious basis is necessary. Man
would indeed be in a poor way if he had to be restrained by fear of
punishment and hope of reward after death."
[Albert Einstein, "Religion and Science", New York Times Magazine, 9
November 1930]
Please sign in to leave a comment.
Brad wrote:
I write a little plugin for Idea (called "yWorks AntExplorer") and have
exactly the same problem. I want to register a BuildListener to recieve
all the events - but I think it is not possible at the moment.
I ended up using a very, very curel hack (the version is not published
at the moment) listening to the treeModel in the message pane...
If you want I can post the code I use...
Please JetBrains: Open your api ;)
Johannes Schneider
Yes, please post the code.
"Johannes Schneider" <shake@web.de> wrote in message
news:dctnjl$nnd$1@is.intellij.net...
>> Is there a way to tell when an Ant build has completed using the OpenAPI?
>>
>
>
>
>
>
>
>
I'll post it on monday..
Johannes Schneider
Brad wrote:
>>Brad wrote:
>>
>>>Is there a way to tell when an Ant build has completed using the OpenAPI?
>>>
>>
>>I write a little plugin for Idea (called "yWorks AntExplorer") and have
>>exactly the same problem. I want to register a BuildListener to recieve
>>all the events - but I think it is not possible at the moment.
>>
>>I ended up using a very, very curel hack (the version is not published at
>>the moment) listening to the treeModel in the message pane...
>>If you want I can post the code I use...
>>
>>
>>Please JetBrains: Open your api ;)
>>
>>
>>
>>Johannes Schneider
>>
Okay all you out there: Do not use this shity piece of code ;). I've
warned you. I post it here to make JetBrains publish their API...
final AntBuildMessageView antBuildMessageView =
AntBuildMessageView.openBuildMessageView( project, buildFileToExecute,
new String[]{ event.getTarget().getName() } );
antBuildMessageView.addPropertyChangeListener( new
PropertyChangeListener() {
public void propertyChange( PropertyChangeEvent
propertyChangeEvent ) {
try {
Method method =
antBuildMessageView.getClass().getDeclaredMethod( "b", new Class[]{
Boolean.TYPE } );
method.setAccessible( true );
TreeView treeView = ( TreeView ) method.invoke(
antBuildMessageView, new Object[]{ Boolean.FALSE } );
Field declaredField =
treeView.getClass().getDeclaredField( "b" );
declaredField.setAccessible( true );
DefaultTreeModel treeModel = ( DefaultTreeModel )
declaredField.get( treeView );
treeModel.addTreeModelListener( new
ExecutionUpdateTreeListener( executionContext ) );
} catch ( Exception e ) {
e.printStackTrace();
}
}
} );
private class ExecutionUpdateTreeListener implements TreeModelListener {
public void treeNodesChanged( TreeModelEvent treeModelEvent ) {
}
public void treeNodesInserted( TreeModelEvent treeModelEvent ) {
DefaultMutableTreeNode node = ( DefaultMutableTreeNode )
treeModelEvent.getPath()[ 0 ];
DefaultMutableTreeNode lastLeaf = node.getLastLeaf();
try {
Class messageNodeClass = lastLeaf.getClass();
if ( !"com.intellij.ant.execution.MessageNode".equals(
messageNodeClass.getName() ) ) return;
Method methodGetText = messageNodeClass.getDeclaredMethod(
"getText", null );
methodGetText.setAccessible( true );
String[] text = ( String[] ) methodGetText.invoke( lastLeaf,
null );
Method methodGetType = messageNodeClass.getDeclaredMethod(
"getTypeString", null );
methodGetType.setAccessible( true );
String type = ( String ) methodGetType.invoke( lastLeaf, null );
if ( "Target:".equals( type.trim() ) ) {
String targetName = text[ 0 ];
}
if ( "Task:".equals( type.trim() ) ) {
}
} catch ( Exception e ) {
e.printStackTrace();
}
}
public void treeNodesRemoved( TreeModelEvent treeModelEvent ) {
}
public void treeStructureChanged( TreeModelEvent treeModelEvent ) {
}
}
Johannes Schneider wrote:
>> Yes, please post the code.
>>
>> "Johannes Schneider" <shake@web.de> wrote in message
>> news:dctnjl$nnd$1@is.intellij.net...
>>
>>> Brad wrote:
>>>
>>>> Is there a way to tell when an Ant build has completed using the
>>>> OpenAPI?
>>>>
>>>
>>> I write a little plugin for Idea (called "yWorks AntExplorer") and
>>> have exactly the same problem. I want to register a BuildListener to
>>> recieve all the events - but I think it is not possible at the moment.
>>>
>>> I ended up using a very, very curel hack (the version is not
>>> published at the moment) listening to the treeModel in the message
>>> pane...
>>> If you want I can post the code I use...
>>>
>>>
>>> Please JetBrains: Open your api ;)
>>>
>>>
>>>
>>> Johannes Schneider
>>>
>>
>>
>>
Hello Brad,
B> Is there a way to tell when an Ant build has completed using the
B> OpenAPI?
Please file a JIRA request to add this functionality to the OpenAPI.
--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"