Skip to content

Commit

Permalink
Added collapse all button to jmol outline
Browse files Browse the repository at this point in the history
  • Loading branch information
goglepox committed Apr 24, 2012
1 parent 96507ab commit 8c559e1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
22 changes: 22 additions & 0 deletions plugins/net.bioclipse.jmol/plugin.xml
Expand Up @@ -142,6 +142,10 @@
description="Run the Jmol script in the activeeditor"
name="Run Script">
</command>
<command
id="net.bioclipse.jmol.collapseAll"
name="Collapse All">
</command>

</extension>

Expand Down Expand Up @@ -696,6 +700,24 @@
</separator>
</toolbar>
</menuContribution>
<menuContribution
locationURI="toolbar:org.eclipse.ui.views.ContentOutline?after=additions">
<command
commandId="net.bioclipse.jmol.collapseAll"
icon="platform:/plugin/org.eclipse.ui/icons/full/elcl16/collapseall.gif"
label="Collapse All"
style="push">
<visibleWhen
checkEnabled="false">
<with
variable="activeEditorId">
<equals
value="net.bioclipse.jmol.editors.JmolEditor">
</equals>
</with>
</visibleWhen>
</command>
</menuContribution>

</extension>

Expand Down
Expand Up @@ -12,7 +12,6 @@
package net.bioclipse.jmol.views.outline;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

Expand Down Expand Up @@ -45,6 +44,8 @@
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.CollapseAllHandler;
import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
import org.eclipse.ui.views.properties.IPropertySheetPage;
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
Expand Down Expand Up @@ -77,6 +78,8 @@ public class JmolContentOutlinePage
private IEditorPart part;
private TreeViewer treeViewer;

private CollapseAllHandler collapseAllHandler;

class JmolOutlineContentProvider
implements IStructuredContentProvider,
ITreeContentProvider {
Expand Down Expand Up @@ -213,8 +216,18 @@ public void focusLost(FocusEvent e) {
// Not interested in this
}
});
makeActions();
}

protected void makeActions() {

IHandlerService service =
(IHandlerService) getSite()
.getService( IHandlerService.class );
collapseAllHandler = new CollapseAllHandler( treeViewer );
service.activateHandler( "net.bioclipse.jmol.collapseAll",
collapseAllHandler );
}
public void updateTreeViewerModel() {

ModelSet modelSet = jmolViewer.getModelSet();
Expand Down

0 comments on commit 8c559e1

Please sign in to comment.