NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Hex Editor Plugin

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Developers
View previous topic :: View next topic  
Author Message
Kyle Cartmell
Posted via mailing list.





PostPosted: Sat Nov 29, 2008 6:59 pm    Post subject: Hex Editor Plugin Reply with quote

I am considering developing a hex editor plugin for NetBeans.

I haven't seen any sign of such a plugin on the plugin portal, the
nightly build available plugin listing, or Google.

Is anyone already working on such a project?

Thank You!
Kyle W. Cartmell
Back to top
dtoffe
Posted via mailing list.





PostPosted: Sun Nov 30, 2008 12:47 am    Post subject: Hex Editor Plugin Reply with quote

I've made the same search some time ago and only found plugins for
Eclipse.

I think an hex editor plugin for Netbeans would be a pretty nice
addition, please let me know if you decide to start developing one.

Cheers,

Daniel


Kyle Cartmell wrote:
Quote:

I am considering developing a hex editor plugin for NetBeans.

I haven't seen any sign of such a plugin on the plugin portal, the
nightly build available plugin listing, or Google.

Is anyone already working on such a project?

Thank You!
Kyle W. Cartmell



--
View this message in context: http://www.nabble.com/Hex-Editor-Plugin-tp20750225p20753367.html
Sent from the Netbeans Project Developers (not for user help) mailing list archive at Nabble.com.
Back to top
Tim Boudreau
Posted via mailing list.





PostPosted: Wed Dec 03, 2008 1:48 am    Post subject: Hex Editor Plugin Reply with quote

contrib/hexedit is a hex editor plugin - I wrote it years ago as a standalone
swing app, and used it for many years as a demo of how to integrate a
standalone app into the NetBeans editor (there's an integration module in
contrib/ as well). I don't think it's ever actually been on autoupdate or
the plugin portal, but it would be easy enough. Any improvements would be
welcome - in particular, currently it really works like those ancient disk
sector editors (the first commercial program I ever wrote was a sector
editor in Z-80 assembly - fond if weird memories Smile) and memory maps the
file - there's no save or undo.

-Tim


Kyle Cartmell wrote:
Quote:

I am considering developing a hex editor plugin for NetBeans.

I haven't seen any sign of such a plugin on the plugin portal, the
nightly build available plugin listing, or Google.

Is anyone already working on such a project?

Thank You!
Kyle W. Cartmell



--
View this message in context: http://www.nabble.com/Hex-Editor-Plugin-tp20750225p20805205.html
Sent from the Netbeans Project Developers (not for user help) mailing list archive at Nabble.com.
Back to top
Tim Boudreau
Posted via mailing list.





PostPosted: Mon Dec 15, 2008 3:35 am    Post subject: Hex Editor Plugin Reply with quote

Tim Boudreau wrote:
Quote:

contrib/hexedit is a hex editor plugin - I wrote it years ago as a
standalone swing app, and used it for many years as a demo of how to
integrate a standalone app into the NetBeans editor (there's an
integration module in contrib/ as well). I don't think it's ever actually
been on autoupdate or the plugin portal, but it would be easy enough. Any
improvements would be welcome - in particular, currently it really works
like those ancient disk sector editors (the first commercial program I
ever wrote was a sector editor in Z-80 assembly - fond if weird memories
Smile) and memory maps the file - there's no save or undo.


FYI, I updated the wrapper module and contrib/hexedit should now be on the
update center for daily builds. It adds Tools > Hex Edit to all files and a
Hex Edit menu item for files of the MIME type content/unknown.

-Tim


--
View this message in context: http://www.nabble.com/Hex-Editor-Plugin-tp20750225p21007863.html
Sent from the Netbeans Project Developers (not for user help) mailing list archive at Nabble.com.
Back to top
M.Le_maudit



Joined: 17 Aug 2009
Posts: 4

PostPosted: Mon Aug 17, 2009 9:11 am    Post subject: [Newbie] Hex Editor Plugin Reply with quote

About 8 months ago, Tim Boudreau wrote :
Quote:
contrib/hexedit is a hex editor plugin

[snip]

there's an integration module in contrib/ as well


I found this (seems to be the integration module) :
http://hg.netbeans.org/main/contrib/file/1807a6064a98/hexeditor

and this (swing application):
http://hg.netbeans.org/main/contrib/file/1807a6064a98/other/hexedit

The swing app works just fine but I'm not able to compile the integration module.

It seems that there is a dependency on main/nbbuild and I can't figure out how to get rid of it. Confused


Tim Boudreau also wrote :
Quote:
I wrote it years ago as a standalone swing app, and used it for many years as a demo of how to integrate a standalone app into the NetBeans editor


Is this particular integration tutorial available somewhere on the net ?

Thanks for reading this post.

M.
Back to top
M.Le_maudit



Joined: 17 Aug 2009
Posts: 4

PostPosted: Mon Aug 24, 2009 4:05 pm    Post subject: Re: [Newbie] Hex Editor Plugin Reply with quote

M.Le_maudit wrote:
Is this particular integration tutorial available somewhere on the net ?


OK, after a while I finally found this (probably a bit out of date) :

http://blogs.sun.com/geertjan/entry/migrating_a_swing_application_to
Back to top
M.Le_maudit



Joined: 17 Aug 2009
Posts: 4

PostPosted: Mon Aug 24, 2009 11:00 pm    Post subject: Re: [Newbie] Hex Editor Plugin Reply with quote

Quote:
Is this particular integration tutorial available somewhere on the net ?


After digging a while, I finally made it work with Netbeans 6.7.1

Here are the steps I followed :

PART 1 swing application

1- check out / clone the main/contrib/other/hexedit
2- compile the project and get the hexedit.jar

PART 2 integration module

1- create a "Netbeans Modules\Module" project

1.1- enter a name
1.2- select standalone module
1.3- check set as main project

1.4- enter code name base
1.5- check xml layer


2- add resource

2.1- create the following new package : <code name base>.resources
2.2- copy file HexEditIcon.gif from main/contrib/hexeditor repository to folder <project name>\src\<code name base>\resources\


3- create a new action

3.1- select conditionally enabled
3.2- select cookie class DataObject
3.3- select user selects one node

3.4- select category tools
3.5- check global menu item
3.6- select menu tools
3.7- select position here - tools
3.8- check file type context menu item
3.9- select content type content/unknown
3.10- select position tools - here - save as template

3.11- enter class name HexEditorAction
3.12- enter display name Hex Edit
3.13- select icon <project name>\src\<code name base>\resources\HexEditIcon.gif


4- add dependencies

4.1- add the folowing module dependencies :

    - Datasystems API
    - Dialogs API
    - File System API
    - Nodes API
    - Utilities API
    - Window System API


4.2- copy hexedit.jar in the following folders :

    <project name>\ext\
    <project name>\build\cluster\modules\ext\


4.3- add the following line at the end of the module manifest file (manifest.mf) :

Code:
Class-Path: ext/hexedit.jar


4.4- copy the following lines in the project Metadata file (project.xml) after the <public-packages/> line :

Code:
<class-path-extension>
    <runtime-relative-path>ext/hexedit.jar</runtime-relative-path>
    <binary-origin>ext/hexedit.jar</binary-origin>
</class-path-extension>


5- adapt code

5.1- change the HexEditorAction class' performAction method to :

Code:
protected void performAction(Node[] activatedNodes) {
    try {
        TopComponent tc = new TC(activatedNodes[0]);
        tc.open();
        tc.requestActive();
        if (!WARNED) {
            warn();
        }
    } catch (FileNotFoundException fe) {
        Logger.getLogger(HexEditorAction.class.getName()).log(Level.INFO, null, fe);
        Toolkit.getDefaultToolkit().beep();
    }
}



5.2- add the following code to HexEditorAction class :

Code:
private static boolean WARNED = NbPreferences.forModule(HexEditorAction.class).getBoolean("warned", false); //NOI18N

@Override
protected boolean enable(Node[] activatedNodes) {
    boolean result = activatedNodes.length == 1;
    if (result) {
        DataObject dob = activatedNodes[0].getLookup().lookup(DataObject.class);
        result = dob != null;
        if (result && dob.isValid()) {
            FileObject fo = dob.getPrimaryFile();
            result = fo.isData() && !fo.isFolder();
            if (result) {
                result = FileUtil.toFile(fo) != null;
            }
        }
    }
    return result;
}

private void warn() {
    String msg = NbBundle.getMessage(HexEditorAction.class, "WARNING"); //NOI18N
    DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.WARNING_MESSAGE));
    NbPreferences.forModule(HexEditorAction.class).putBoolean("warned", true);//NOI18N
    WARNED = true;
}

private static final class TC extends TopComponent {

    TC(Node n) throws FileNotFoundException {

        DataObject dob = n.getLookup().lookup(DataObject.class);
        FileObject fileObject = dob.getPrimaryFile();
        File f = FileUtil.toFile(fileObject);
        setActivatedNodes(new Node[]{n});
        associateLookup(n.getLookup());
        setDisplayName(n.getDisplayName());
        setLayout(new BorderLayout());
        add(new HexEditPanel(f), BorderLayout.CENTER);
    }

    @Override
    public int getPersistenceType() {
        return PERSISTENCE_NEVER;
    }

    @Override
    protected void componentOpened() {
        ((HexEditPanel) getComponents()[0]).resetSplitterPosition();
    }
}


6- add the following lines to the file <project name>\src\<code name base>\Bundle.properties

Code:
WARNING=<html><b>IMPORTANT:</b> This editor is \
   <b><i>LIVE</i></b><p>Like the hex editors of the 70's and 80's, \
   there is no undo.<p>  Any change you make is \
   <b><i>IMMEDIATELY</i></b> written to the file you are editing.<p>Use with \
   caution.


7- run
Back to top
Geertjan Wielenga
Posted via mailing list.





PostPosted: Tue Aug 25, 2009 7:47 am    Post subject: Hex Editor Plugin Reply with quote

M.Le_maudit wrote:
Quote:
Quote:
Is this particular integration tutorial available somewhere on the net ?




http://blogs.sun.com/geertjan/entry/migrating_a_swing_application_to

That's how I did it.

Gj

Quote:

After digging a while, I finally made it work with Netbeans 6.7.1



Here are the steps I followed :



PART 1 swing application



1- check out / clone the main/contrib/other/hexedit

2- compile the project and get the hexedit.jar



PART 2 integration module



1- create a "Netbeans Modules\Module" project



1.1- enter a name

1.2- select standalone module

1.3- check set as main project



1.4- enter code name base

1.5- check xml layer





2- add resource



2.1- create the following new package : <code name base>.resources

2.2- copy file HexEditIcon.gif from main/contrib/hexeditor repository to folder <project name>\src\<code name base>\resources\





3- create a new action



3.1- select conditionally enabled

3.2- select cookie class DataObject

3.3- select user selects one node



3.4- select category tools

3.5- check global menu item

3.6- select menu tools

3.7- select position here - tools

3.8- check file type context menu item

3.9- select content type content/unknown

3.10- select position tools - here - save as template



3.11- enter class name HexEditorAction

3.12- enter display name Hex Edit

3.13- select icon <project name>\src\<code name base>\resources\HexEditIcon.gif





4- add dependencies



4.1- add the folowing module dependencies :



- Datasystems API

- Dialogs API

- File System API

- Nodes API

- Utilities API

- Window System API





4.2- copy hexedit.jar in the following folders :



<project name>\ext\

<project name>\build\cluster\modules\ext\





4.3- add the following line at the end of the module manifest file (manifest.mf) :




Code:
Class-Path: ext/hexedit.jar





4.4- copy the following lines in the project Metadata file (project.xml) after the <public-packages/> line :




Code:
<class-path-extension>

<runtime-relative-path>ext/hexedit.jar</runtime-relative-path>

<binary-origin>ext/hexedit.jar</binary-origin>

</class-path-extension>







5- adapt code



5.1- change the HexEditorAction class' performAction method to :




Code:
protected void performAction(Node[] activatedNodes) {

try {

TopComponent tc = new TC(activatedNodes[0]);

tc.open();

tc.requestActive();

if (!WARNED) {

warn();

}

} catch (FileNotFoundException fe) {

Logger.getLogger(HexEditorAction.class.getName()).log(Level.INFO, null, fe);

Toolkit.getDefaultToolkit().beep();

}

}







5.2- add the following code to HexEditorAction class :




Code:
private static boolean WARNED = NbPreferences.forModule(HexEditorAction.class).getBoolean("warned", false); //NOI18N



@Override

protected boolean enable(Node[] activatedNodes) {

boolean result = activatedNodes.length == 1;

if (result) {

DataObject dob = activatedNodes[0].getLookup().lookup(DataObject.class);

result = dob != null;

if (result && dob.isValid()) {

FileObject fo = dob.getPrimaryFile();

result = fo.isData() && !fo.isFolder();

if (result) {

result = FileUtil.toFile(fo) != null;

}

}

}

return result;

}



private void warn() {

String msg = NbBundle.getMessage(HexEditorAction.class, "WARNING"); //NOI18N

DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.WARNING_MESSAGE));

NbPreferences.forModule(HexEditorAction.class).putBoolean("warned", true);//NOI18N

WARNED = true;

}



private static final class TC extends TopComponent {



TC(Node n) throws FileNotFoundException {



DataObject dob = n.getLookup().lookup(DataObject.class);

FileObject fileObject = dob.getPrimaryFile();

File f = FileUtil.toFile(fileObject);

setActivatedNodes(new Node[]{n});

associateLookup(n.getLookup());

setDisplayName(n.getDisplayName());

setLayout(new BorderLayout());

add(new HexEditPanel(f), BorderLayout.CENTER);

}



@Override

public int getPersistenceType() {

return PERSISTENCE_NEVER;

}



@Override

protected void componentOpened() {

((HexEditPanel) getComponents()[0]).resetSplitterPosition();

}

}





6- add the following lines to the file <project name>\src\<code name base>\Bundle.properties




Code:
WARNING=<html><b>IMPORTANT:</b> This editor is \

<b><i>LIVE</i></b><p>Like the hex editors of the 70's and 80's, \

there is no undo.<p> Any change you make is \

<b><i>IMMEDIATELY</i></b> written to the file you are editing.<p>Use with \

caution.







7- run




Back to top
mienamoo



Joined: 12 Nov 2010
Posts: 356
Location: South Africa

PostPosted: Fri Nov 12, 2010 7:49 am    Post subject: Re: [Newbie] Hex Editor Plugin Reply with quote

@Tim

I just installed the module in the latest dev release. Thanks for making it available - this will make my life so much better! Very Happy

I do have a feature request though. Is it possible to have a binary view too?

Hermien
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Developers All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo