Author: penyaskito
Date: 2008-06-14 15:47:00-0700
New Revision: 14950
Modified:
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/module/SequenceDiagramModule.java
Log:
Add the toolbar button in the correct position. Fixed a bug when disabling the module and more modules add items to that toolbar. Related to issue 5154.
Modified: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/module/SequenceDiagramModule.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/module/SequenceDiagramModule.java?view=diff&rev=14950&p1=trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/module/SequenceDiagramModule.java&p2=trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/module/SequenceDiagramModule.java&r1=14949&r2=14950
==============================================================================
--- trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/module/SequenceDiagramModule.java (original)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/module/SequenceDiagramModule.java 2008-06-14 15:47:00-0700
@@ -24,6 +24,7 @@
package org.argouml.uml.diagram.sequence2.module;
+import javax.swing.JButton;
import javax.swing.JMenu;
import javax.swing.JToolBar;
@@ -51,6 +52,8 @@
private ActionSequenceDiagram newSequence;
+ private JButton toolbarBtn;
+
private JMenu menuSequence;
private SequenceDiagramPropPanelFactory propPanelFactory;
@@ -67,12 +70,12 @@
public boolean enable() {
// Register into the menu.
-// GenericArgoMenuBar.registerMenuItem(menuSequence);
-// GenericArgoMenuBar.registerCreateDiagramAction(newSequence);
- // add a element to the toolbar.
JToolBar toolbar = ((GenericArgoMenuBar) ProjectBrowser.getInstance()
.getJMenuBar()).getCreateDiagramToolbar();
- toolbar.add(newSequence);
+ // there is no setIndex or similar, so we have to add
+ // twice, and it moves the item instead of adding again.
+ toolbarBtn = toolbar.add(newSequence);
+ toolbar.add(toolbarBtn, 3);
toolbar.updateUI();
propPanelFactory =
@@ -92,8 +95,8 @@
// remove it from the toolbar.
JToolBar toolbar = ((GenericArgoMenuBar) ProjectBrowser.getInstance()
.getJMenuBar()).getCreateDiagramToolbar();
- // remove the last one...
- toolbar.remove(toolbar.getComponentCount() - 1);
+
+ toolbar.remove(toolbarBtn);
toolbar.updateUI();
PropPanelFactoryManager.removePropPanelFactory(propPanelFactory);
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.