Bug 21198 - On JavaEditor dont use == in the isActivePart() method but instead use .equals(Object)
Summary: On JavaEditor dont use == in the isActivePart() method but instead use .equal...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 critical (vote)
Target Milestone: 2.0.1   Edit
Assignee: Kai-Uwe Maetzel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-07-03 05:44 EDT by Joe Winchester CLA
Modified: 2002-08-22 06:29 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joe Winchester CLA 2002-07-03 05:44:58 EDT
The class JavaEditor does an == check inside isActivePart().  This means that if 
the part is embedded inside another one then the check fails.  Rather than this 
can it use .equals instead and dispatch this to the other part that can 
specialize accordingly, e.g. instead of the current method

	protected boolean isActivePart() {
		IWorkbenchWindow window= getSite().getWorkbenchWindow();
		IPartService service= window.getPartService();
		return (this == service.getActivePart());
	}

it could have the last line as
                return (service.getActivePart().equals(this));
Comment 1 Erich Gamma CLA 2002-07-15 08:21:12 EDT
Kai pls comment, this bug is on a fix wish list. To me it would be OK to 
consider for 2.1 but for 2.0.1 it is questionable.
Comment 2 Kai-Uwe Maetzel CLA 2002-07-16 13:16:51 EDT
This code change is no problem for us. However, just for the record, this is 
not a blessing of embedding the editor into another part. There might be more 
problems when doing this.
Comment 3 Kai-Uwe Maetzel CLA 2002-08-12 06:26:36 EDT
Change released to 2.0.1 and 2.1 stream.
Comment 4 Martin Aeschlimann CLA 2002-08-22 06:29:37 EDT
verified in code (2.0.1 - 20020821)