Author: yradtsevich
Date: 2011-11-25 09:45:18 -0500 (Fri, 25 Nov 2011)
New Revision: 36662
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeDropWindow.java
Log:
https://issues.jboss.org/browse/JBIDE-10221 /
https://issues.jboss.org/browse/JBIDE-10222 : VpeController has resource leaks
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2011-11-25
14:42:23 UTC (rev 36661)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2011-11-25
14:45:18 UTC (rev 36662)
@@ -41,6 +41,8 @@
import org.eclipse.swt.custom.LineStyleListener;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.MenuEvent;
import org.eclipse.swt.events.MenuListener;
import org.eclipse.swt.events.SelectionEvent;
@@ -87,6 +89,7 @@
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.model.util.XModelTreeListenerSWTSync;
import org.jboss.tools.common.resref.core.ResourceReferenceListListener;
+import org.jboss.tools.common.util.SwtUtil;
import org.jboss.tools.jst.jsp.bundle.BundleMap;
import org.jboss.tools.jst.jsp.editor.IJSPTextEditor;
import org.jboss.tools.jst.jsp.editor.IVisualController;
@@ -1792,6 +1795,7 @@
tip = new Shell(parent, SWT.NO_FOCUS | SWT.ON_TOP);
Color bckgColor = new Color(tip.getDisplay(), 255, 250, 236);
+ SwtUtil.bindDisposal(bckgColor, tip);
tip.setBackground(bckgColor);
Composite composite = tip;
@@ -1828,8 +1832,9 @@
tipControlHeaderText.addLineStyleListener(new LineStyleListener() {
public void lineGetStyle(LineStyleEvent event) {
- Color color = new Color(tipControlHeaderText.getDisplay(), 201,
- 51, 40);
+ final Color color = new Color(tipControlHeaderText.getDisplay(),
+ 201, 51, 40);
+ SwtUtil.bindDisposal(color, tipControlHeaderText);
if (event.lineOffset == 0) {
StyleRange st = new StyleRange();
st.fontStyle = SWT.BOLD;
@@ -1876,6 +1881,7 @@
public void lineGetStyle(LineStyleEvent event) {
Color color = new Color(tipControlHeaderText
.getDisplay(), 42, 148, 0);
+ SwtUtil.bindDisposal(color, tipControlAttributeText);
StyleRange st = new StyleRange();
st.start = event.lineOffset;
st.length = event.lineText.length();
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeDropWindow.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeDropWindow.java 2011-11-25
14:42:23 UTC (rev 36661)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeDropWindow.java 2011-11-25
14:45:18 UTC (rev 36662)
@@ -44,12 +44,12 @@
import org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeLabelProvider;
import org.jboss.tools.common.model.ui.dnd.ModelTransfer;
import org.jboss.tools.common.model.ui.editors.dnd.context.DropContext;
+import org.jboss.tools.common.util.SwtUtil;
import org.jboss.tools.jst.jsp.editor.IJSPTextEditor;
import org.jboss.tools.vpe.editor.dnd.context.JSPViewerDropAdapter;
import org.w3c.dom.Node;
public class VpeDropWindow extends Window {
- static final Color BACKGROUND_COLOR = new Color(null, 0xff, 0xff, 0xcd);
IJSPTextEditor editor;
boolean active = false;
TreeViewer treeViewer;
@@ -104,7 +104,10 @@
treeViewer.setLabelProvider(labelProvider);
treeViewer.setInput(rootNode);
- tree.setBackground(BACKGROUND_COLOR);
+ Color treeBackgroundColor = new Color(null, 0xff, 0xff, 0xcd);
+ tree.setBackground(treeBackgroundColor);
+ SwtUtil.bindDisposal(treeBackgroundColor, tree);
+
GridData data = new GridData(GridData.FILL_BOTH);
data.verticalIndent = 0;
data.horizontalIndent = 0;