Skip to content

Commit

Permalink
#31 Support for NB 8.2 - show outline again (widget hierarchy has bee…
Browse files Browse the repository at this point in the history
…n changed in 8.2)
  • Loading branch information
markiewb committed Oct 15, 2016
1 parent 0e5a868 commit 73a665d
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 71 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ This plugins adds a code overview/outline for the current editor. Implements <a
<img src="https://raw.githubusercontent.com/markiewb/nb-codeoutline/master/doc/screenshot1.3.png"/>
</p>
<h2>Updates</h2>
<h3>1.3.2:</h3>
<ul>
<li>[<a href="https://github.com/markiewb/nb-codeoutline/issues/31">Bugfix 31</a>]: Outline is visible again for 8.2</li>
</ul>
<h3>1.3.1:</h3>
<ul>
<li>[<a href="https://github.com/markiewb/nb-codeoutline/issues/26">Feature 26</a>]: Use bicubic scaling for better quality</li>
Expand Down
6 changes: 5 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.markiewb.netbeans.plugins</groupId>
<artifactId>codeoutline</artifactId>
<version>1.3.1</version>
<version>1.3.2</version>
<packaging>nbm</packaging>
<build>
<plugins>
Expand Down Expand Up @@ -125,6 +125,10 @@
&lt;img src="https://raw.githubusercontent.com/markiewb/nb-codeoutline/master/doc/screenshot1.3.png"/&gt;
&lt;/p&gt;
&lt;h2&gt;Updates&lt;/h2&gt;
&lt;h3&gt;1.3.2:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;[&lt;a href="https://github.com/markiewb/nb-codeoutline/issues/31"&gt;Bugfix 31&lt;/a&gt;]: Outline is visible again for 8.2&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;1.3.1:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;[&lt;a href="https://github.com/markiewb/nb-codeoutline/issues/26"&gt;Feature 26&lt;/a&gt;]: Use bicubic scaling for better quality&lt;/li&gt;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,70 +1,64 @@
/*
* Copyright (C) 2015 markiewb
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package de.markiewb.netbeans.plugins.outline;

import bluej.editor.moe.NaviView;
import java.awt.Container;
import java.awt.Dimension;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JScrollPane;
import javax.swing.border.BevelBorder;
import javax.swing.text.JTextComponent;

/**
*
* @author markiewb
*/
public class OutlineSideBarFactory implements org.netbeans.spi.editor.SideBarFactory {

private final static int NAVIVIEW_WIDTH = 90; // width of the "naviview" (min-source) box
private boolean enabled = true;

@Override
public JComponent createSideBar(JTextComponent jtc) {

if (!enabled) {
return null;
}

Container parent = jtc.getParent();
if (null == parent) {
return null;
}
parent = parent.getParent();
if (null == parent) {
return null;
}
if (parent instanceof JScrollPane && null != jtc.getDocument()) {

JScrollPane scrollPane = (JScrollPane) parent;

return new NaviViewExt(jtc.getDocument(), scrollPane.getVerticalScrollBar());
// scrollPane.getVerticalScrollBar().setUnitIncrement(16);
//
// NaviView naviView = new NaviView(jtc.getDocument(), scrollPane.getVerticalScrollBar());
// naviView.setPreferredSize(new Dimension(NAVIVIEW_WIDTH, 0));
// naviView.setMaximumSize(new Dimension(NAVIVIEW_WIDTH, Integer.MAX_VALUE));
//// naviView.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
// return naviView;
}
return null;

}

}
/*
* Copyright (C) 2015 markiewb
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package de.markiewb.netbeans.plugins.outline;

import java.awt.Container;
import javax.swing.JComponent;
import javax.swing.JScrollPane;
import javax.swing.text.JTextComponent;

/**
*
* @author markiewb
*/
public class OutlineSideBarFactory implements org.netbeans.spi.editor.SideBarFactory {

@Override
public JComponent createSideBar(JTextComponent jtc) {

/**
* <pre>
* jtc.getParent() #8227 NbEditorUI$LayeredEditorPane
* jtc.getParent().getParent() #8233 JViewport
* jtc.getParent().getParent().getParent() #8234 JScrollPane
* </pre>
*/
Container parent = jtc.getParent();
if (null == parent) {
return null;
}
parent = parent.getParent();
if (null == parent) {
return null;
}
// a new container JViewport has been introduced in 8.2
parent = parent.getParent();
if (null == parent) {
return null;
}
if (parent instanceof JScrollPane && null != jtc.getDocument()) {

JScrollPane scrollPane = (JScrollPane) parent;

return new NaviViewExt(jtc.getDocument(), scrollPane.getVerticalScrollBar());
}
return null;

}

}

0 comments on commit 73a665d

Please sign in to comment.