Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 138978 Details for
Bug 272752
Many to Many Override default Index out of bound error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
candidate patch
272752-1.txt (text/plain), 7.39 KB, created by
Brian Vosburgh
on 2009-06-11 16:45:34 EDT
(
hide
)
Description:
candidate patch
Filename:
MIME Type:
Creator:
Brian Vosburgh
Created:
2009-06-11 16:45:34 EDT
Size:
7.39 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jpt.ui >Index: src/org/eclipse/jpt/ui/internal/views/AbstractJpaView.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/AbstractJpaView.java,v >retrieving revision 1.9 >diff -u -r1.9 AbstractJpaView.java >--- src/org/eclipse/jpt/ui/internal/views/AbstractJpaView.java 12 May 2009 14:46:51 -0000 1.9 >+++ src/org/eclipse/jpt/ui/internal/views/AbstractJpaView.java 11 Jun 2009 20:44:41 -0000 >@@ -8,6 +8,7 @@ > ********************************************************************************/ > package org.eclipse.jpt.ui.internal.views; > >+import org.eclipse.jpt.ui.JptUiPlugin; > import org.eclipse.jpt.ui.WidgetFactory; > import org.eclipse.jpt.ui.internal.selection.JpaSelection; > import org.eclipse.jpt.ui.internal.selection.JpaSelectionManager; >@@ -81,6 +82,7 @@ > @Override > public final void createPartControl(Composite parent) { > this.scrolledForm = getFormWidgetFactory().createScrolledForm(parent); >+ JptUiPlugin.instance().tagControl(this.scrolledForm); > this.scrolledForm.getBody().setLayout(new GridLayout()); > > this.pageBook = new PageBook(this.scrolledForm.getBody(), SWT.NONE); >@@ -157,7 +159,8 @@ > this.scrolledForm.reflow(true); > } > >- protected void subcreatePartControl(Composite parent) { >+ protected void subcreatePartControl(@SuppressWarnings("unused") Composite parent) { > // no op - for subclasses to override if wished > } >-} >\ No newline at end of file >+ >+} >Index: src/org/eclipse/jpt/ui/JptUiPlugin.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/JptUiPlugin.java,v >retrieving revision 1.8 >diff -u -r1.8 JptUiPlugin.java >--- src/org/eclipse/jpt/ui/JptUiPlugin.java 13 Feb 2009 21:16:08 -0000 1.8 >+++ src/org/eclipse/jpt/ui/JptUiPlugin.java 11 Jun 2009 20:44:41 -0000 >@@ -13,10 +13,17 @@ > import org.eclipse.core.runtime.Status; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.jpt.core.JpaPlatform; >+import org.eclipse.jpt.core.internal.JpaModelManager; > import org.eclipse.jpt.ui.internal.platform.JpaPlatformUiRegistry; > import org.eclipse.jpt.ui.navigator.JpaNavigatorProvider; >+import org.eclipse.swt.SWT; > import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.Event; >+import org.eclipse.swt.widgets.Listener; > import org.eclipse.ui.plugin.AbstractUIPlugin; >+import org.osgi.framework.BundleContext; > > /** > * >@@ -30,13 +37,18 @@ > @SuppressWarnings("nls") > public class JptUiPlugin extends AbstractUIPlugin > { >+ private final Listener focusListener; >+ > private static JptUiPlugin INSTANCE; > > /** > * The plug-in identifier of JPA UI support > * (value <code>"org.eclipse.jpt.ui"</code>). > */ >- public final static String PLUGIN_ID = "org.eclipse.jpt.ui"; //$NON-NLS-1$ >+ public static final String PLUGIN_ID = "org.eclipse.jpt.ui"; //$NON-NLS-1$ >+ >+ private static final String FOCUS_DATA_KEY = PLUGIN_ID + ".focus"; >+ private static final Object FOCUS_DATA = new Object(); > > /** > * Returns the singleton JPT UI plug-in. >@@ -86,9 +98,54 @@ > > public JptUiPlugin() { > super(); >+ this.focusListener = this.buildFocusListener(); > INSTANCE = this; > } > >+ private Listener buildFocusListener() { >+ return new Listener() { >+ public void handleEvent(Event event) { >+ JptUiPlugin.this.handleFocusEvent(event); >+ } >+ }; >+ } >+ >+ /** >+ * This method is called whenever a "focus in" event is generated. >+ * If the control gaining focus is part of one of our composites (typically >+ * a JPA Details View), we stop listening to Java change events >+ * (and assume all changes to the Java model are generated by us). >+ * If the control gaining focus is *not* part of one of our composites, >+ * we start listening to the Java change events again. >+ */ >+ void handleFocusEvent(Event event) { >+ Control control = (Control) event.widget; >+ while (control != null) { >+ if (control.getData(FOCUS_DATA_KEY) == FOCUS_DATA) { >+ this.focusIn(); >+ return; >+ } >+ control = control.getParent(); >+ } >+ this.focusOut(); >+ } >+ >+ private void focusIn() { >+ JpaModelManager.instance().setJavaElementChangeListenerIsActive(false); >+ } >+ >+ private void focusOut() { >+ JpaModelManager.instance().setJavaElementChangeListenerIsActive(true); >+ } >+ >+ /** >+ * Tag the specified control so that whenever it (or any of its children, >+ * grandchildren, etc.) has the focus, the Dali model ignores any Java >+ * change events. >+ */ >+ public void tagControl(Control control) { >+ control.setData(FOCUS_DATA_KEY, FOCUS_DATA); >+ } > > /** > * Return the JPA platform UI corresponding to the given JPA platform >@@ -102,4 +159,22 @@ > return platform == null ? null : platform.getNavigatorProvider(); > } > >+ >+ // ********** plug-in implementation ********** >+ >+ @Override >+ public void start(BundleContext context) throws Exception { >+ super.start(context); >+ Display.getDefault().addFilter(SWT.FocusIn, this.focusListener); >+ } >+ >+ @Override >+ public void stop(BundleContext context) throws Exception { >+ try { >+ Display.getDefault().removeFilter(SWT.FocusIn, this.focusListener); >+ } finally { >+ super.stop(context); >+ } >+ } >+ > } >#P org.eclipse.jpt.core >Index: src/org/eclipse/jpt/core/internal/JpaModelManager.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaModelManager.java,v >retrieving revision 1.24 >diff -u -r1.24 JpaModelManager.java >--- src/org/eclipse/jpt/core/internal/JpaModelManager.java 18 May 2009 21:07:30 -0000 1.24 >+++ src/org/eclipse/jpt/core/internal/JpaModelManager.java 11 Jun 2009 20:44:42 -0000 >@@ -89,6 +89,7 @@ > * which will forward them to the JPA projects. > */ > private final IElementChangedListener javaElementChangeListener; >+ private boolean javaElementChangeListenerIsActive; > > > // ********** singleton ********** >@@ -113,6 +114,7 @@ > this.resourceChangeListener = new ResourceChangeListener(); > this.facetedProjectListener = new FacetedProjectListener(); > this.javaElementChangeListener = new JavaElementChangeListener(); >+ this.javaElementChangeListenerIsActive = true; > } > > >@@ -186,6 +188,20 @@ > } > > /** >+ * Return whether the model manager's Java change listener is active. >+ */ >+ public boolean javaElementChangeListenerIsActive() { >+ return this.javaElementChangeListenerIsActive; >+ } >+ >+ /** >+ * Set whether the model manager's Java change listener is active. >+ */ >+ public void setJavaElementChangeListenerIsActive(boolean javaElementChangeListenerIsActive) { >+ this.javaElementChangeListenerIsActive = javaElementChangeListenerIsActive; >+ } >+ >+ /** > * Log the specified status. > */ > public void log(IStatus status) { >@@ -454,6 +470,9 @@ > * Forward the event to the JPA model. > */ > /* private */ void javaElementChanged(ElementChangedEvent event) { >+ if ( ! this.javaElementChangeListenerIsActive) { >+ return; // ignore Java events >+ } > if (this.eventIndicatesProjectAddedButNotOpen(event)) { > return; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 272752
:
138978
|
139461