This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 96338 - extend the window system to allow a check for TopComponent's type - "editor" or "view"
Summary: extend the window system to allow a check for TopComponent's type - "editor" ...
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Stanislav Aubrecht
URL:
Keywords: API, API_REVIEW_FAST
Depends on:
Blocks:
 
Reported: 2007-02-22 17:15 UTC by Stanislav Aubrecht
Modified: 2008-12-22 11:58 UTC (History)
2 users (show)

See Also:
Issue Type: TASK
Exception Reporter:


Attachments
proposed implementation (7.24 KB, patch)
2007-02-22 17:18 UTC, Stanislav Aubrecht
Details | Diff
an extended patch with Mode.isEditorMode (9.78 KB, patch)
2007-02-23 12:11 UTC, Stanislav Aubrecht
Details | Diff
WindowManager.isEditorMode( Mode ) (8.05 KB, patch)
2007-02-26 16:05 UTC, Stanislav Aubrecht
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stanislav Aubrecht 2007-02-22 17:15:47 UTC
current the window system API does not offer any easy way to find out whether a
TopComponent is an 'editor' (i.e. opens in the 'editor' area of the main window)
or a plain view (e.g. output window or navigator).

therefore i suggest adding method isEditorTopComponent(TopComponent tc) to the
WindowManager that returns true if there is a Mode that the TopComponent will
be/is docked to and the Mode is of 'editor' kind (i.e. holds editor windows).
Comment 1 Stanislav Aubrecht 2007-02-22 17:18:17 UTC
Created attachment 38818 [details]
proposed implementation
Comment 2 santhosh 2007-02-22 17:26:55 UTC
shouldn't it be other wasy needed;

i.e Mode should have that ability;

Mode.isEditorMode();

then we can also check whether a topcomponent is editorTC or not as below:

  tc.getMode().isEditorMode();
Comment 3 santhosh 2007-02-22 17:28:58 UTC
the issue 83024 requires such API
Comment 4 Stanislav Aubrecht 2007-02-22 17:34:16 UTC
santhosh, your proposal would require to find TopComponent's Mode first, check
it for null value and then check the Mode type. my proposal is a bit easier on
developers but i don't have any strong preferences either way.
Comment 5 santhosh 2007-02-22 17:50:24 UTC
I agree with you in ease of use;

but there might be usecases, where programmer might want to know whether a given
mode is editor mode or not;

may be u can provide both; the api in topcomponent can simply check for NULL and
use mode.isEditorMode() as return value;
Comment 6 Stanislav Aubrecht 2007-02-23 12:11:07 UTC
Created attachment 38857 [details]
an extended patch with Mode.isEditorMode
Comment 7 Jaroslav Tulach 2007-02-24 08:38:10 UTC
y01 I do not like adding new methods into interfaces - e.g. I'd like to see other solution than 
just adding new method into Mode interface - maybe boolean 
WindowManager.isEditorMode(Mode) would also be acceptable?
Comment 8 Stanislav Aubrecht 2007-02-26 16:05:03 UTC
Created attachment 38919 [details]
WindowManager.isEditorMode( Mode )
Comment 9 Stanislav Aubrecht 2007-03-05 09:13:42 UTC
if there are no more comments, i'll integrate the latest version of the patch
tomorrow
Comment 10 Stanislav Aubrecht 2007-03-06 09:15:31 UTC
merged into trunk:

Checking in openide/windows/apichanges.xml;
/cvs/openide/windows/apichanges.xml,v  <--  apichanges.xml
new revision: 1.11; previous revision: 1.10
done
Checking in openide/windows/manifest.mf;
/cvs/openide/windows/manifest.mf,v  <--  manifest.mf
new revision: 1.13; previous revision: 1.12
done
Checking in core/windows/src/org/netbeans/core/windows/WindowManagerImpl.java;
/cvs/core/windows/src/org/netbeans/core/windows/WindowManagerImpl.java,v  <-- 
WindowManagerImpl.java
new revision: 1.57; previous revision: 1.56
done
RCS file:
/cvs/core/windows/test/unit/src/org/netbeans/core/windows/TopComponentTypeTest.java,v
done
Checking in
core/windows/test/unit/src/org/netbeans/core/windows/TopComponentTypeTest.java;
/cvs/core/windows/test/unit/src/org/netbeans/core/windows/TopComponentTypeTest.java,v
 <--  TopComponentTypeTest.java
initial revision: 1.1
done
Checking in openide/windows/src/org/openide/windows/WindowManager.java;
/cvs/openide/windows/src/org/openide/windows/WindowManager.java,v  <-- 
WindowManager.java
new revision: 1.15; previous revision: 1.14
done