Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-discussion] Disable "delete class" item from menu

Tania Tudorache tudorache at stanford.edu
Tue Mar 18 13:23:26 PDT 2008


I don't recommend that you modify the code of the ClsesTab. Instead, I 
suggest that you build your own Tab widget and that you reuse all the 
components from the classes tab. In this way you can customize the UI 
and the behavior of the tab in any way you like.

You can start by subclassing edu.stanford.smi.protege.widget.ClsesTab, 
e.g. let's say you call your class MyClsesTab. Then, you need to 
override the method createClsesPanel() which creates the panel that 
holds the classes tree and all the create and delete buttons. This 
method should return a ClsesPanel.

To remove or disable to delete button, subclass ClsesPanel, say 
MyClsesPanel. The constructor of MyClsesPanel, should look like:

public MyClsesPanel(Project project) {
     super(project);
      //this will remove the button with index 3 (the delete button)
      _labeledComponent.removeHeaderButton(3);
}

Going back to the MyClsesTab, the createClsesPanel() method should look 
like:

    protected ClsesPanel createClsesPanel() {
        MyClsesPanel panel = new MyClsesPanel(getProject());
        panel.addSelectionListener(new SelectionListener() {
            public void selectionChanged(SelectionEvent event) {
                transmitSelection();
            }
        });
        return panel;
    }

That's it. So, all you need to do is to override 2 methods the way that 
I have described. You can also add more customization to your tab. To 
enable your tab, go to Project ->Configure and select "MyClsesTab".

We have more documentation on building plugins here:

http://protege.stanford.edu/doc/dev.html

Tania


robber82 at email.it wrote:
>
> Hi, How can I disable or delete the "delete class" item from menu in 
> "subclass Explorer"?
> Can you help me?
> Which class must I modify?
> regards
>
> ----
> Email.it, the professional e-mail, gratis per te: clicca qui 
> <http://www.email.it/cgi-bin/start?sid=3>
>
> Sponsor:
> Scopri le tue passioni con Leonardo.it!
> Clicca qui <http://adv.email.it/cgi-bin/foclick.cgi?mid=7614&d=20080317>
>
>
> ----
> Email.it, the professional e-mail, gratis per te: clicca qui 
> <http://www.email.it/cgi-bin/start?sid=3>
>
> Sponsor:
> Scopri le tue passioni con Leonardo.it!
> Clicca qui <http://adv.email.it/cgi-bin/foclick.cgi?mid=7613&d=20080317>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> protege-discussion mailing list
> protege-discussion at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 
>   




More information about the protege-discussion mailing list