File: IPageLayout.java

package info (click to toggle)
eclipse-platform-ui 4.10-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 71,188 kB
  • sloc: java: 611,660; xml: 21,221; sh: 602; makefile: 5
file content (563 lines) | stat: -rw-r--r-- 23,435 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
/*******************************************************************************
 * Copyright (c) 2000, 2018 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *     Chris Gross <schtoo@schtoo.com>
 *     - Fix for 99155 - allow standalone view placeholders
 *     Chris Gross chris.gross@us.ibm.com Bug 107443
 *     Denis Zygann <d.zygann@web.de> - Bug 457390
 *******************************************************************************/
package org.eclipse.ui;

/**
 * A page layout defines the initial layout for a perspective within a page
 * in a workbench window.
 * <p>
 * This interface is not intended to be implemented by clients.
 * </p>
 * <p>
 * When a perspective is opened, it creates a new page layout with a single editor area.
 * This layout is then passed to the perspective factory (implementation of
 * {@link org.eclipse.ui.IPerspectiveFactory#createInitialLayout(IPageLayout)}) where
 * additional views and other content can be added, using the existing editor area as
 * the initial point of reference.
 * </p>
 * <p>
 * In some cases, multiple instances of a particular view may need to be added
 * to the same layout.  These are disambiguated using a secondary id.
 * In layout methods taking a view id, the id can have the compound form:
 * <strong>primaryId [':' secondaryId]</strong>.
 * If a secondary id is given, the view must allow multiple instances by
 * having specified <code>allowMultiple="true"</code> in its extension.
 * View placeholders may also have a secondary id.
 * </p>
 * <p>
 * Wildcards are permitted in placeholder ids (but not regular view ids).
 * '*' matches any substring, '?' matches any single character.
 * Wildcards can be specified for the primary id, the secondary id, or both.
 * For example, the placeholder "someView:*" will match any occurrence of the view
 * that has primary id "someView" and that also has some non-null secondary id.
 * Note that this placeholder will not match the view if it has no secondary id,
 * since the compound id in this case is simply "someView".
 * </p>
 * <p>
 * Example of populating a layout with standard workbench views:
 * <pre>
 * IPageLayout layout = ...
 * // Get the editor area.
 * String editorArea = layout.getEditorArea();
 *
 * // Top left: Project Explorer view and Bookmarks view placeholder
 * IFolderLayout topLeft = layout.createFolder("topLeft", IPageLayout.LEFT, 0.25f,
 *    editorArea);
 * topLeft.addView(IPageLayout.ID_PROJECT_EXPLORER);
 * topLeft.addPlaceholder(IPageLayout.ID_BOOKMARKS);
 *
 * // Bottom left: Outline view and Property Sheet view
 * IFolderLayout bottomLeft = layout.createFolder("bottomLeft", IPageLayout.BOTTOM, 0.50f,
 * 	   "topLeft");
 * bottomLeft.addView(IPageLayout.ID_OUTLINE);
 * bottomLeft.addView(IPageLayout.ID_PROP_SHEET);
 *
 * // Bottom right: Task List view
 * layout.addView(IPageLayout.ID_TASK_LIST, IPageLayout.BOTTOM, 0.66f, editorArea);
 * </pre>
 * </p>
 * @noimplement This interface is not intended to be implemented by clients.
 */
public interface IPageLayout {

    /**
     * The part id for the workbench's editor area.  This may only be used
     * as a reference part for view addition.
     */
	String ID_EDITOR_AREA = "org.eclipse.ui.editorss"; //$NON-NLS-1$

	/**
	 * The view id for the workbench's Resource Navigator standard component.
	 *
	 * @deprecated this has been replaced by the Common Navigator Framework as
	 *             of release 3.5.
	 */
    @Deprecated
	String ID_RES_NAV = "org.eclipse.ui.views.ResourceNavigator"; //$NON-NLS-1$

    /**
     * The view id for the Project Explorer.
     * @since 3.5
     */
	String ID_PROJECT_EXPLORER = "org.eclipse.ui.navigator.ProjectExplorer"; //$NON-NLS-1$

    /**
     * The view id for the workbench's Property Sheet standard component.
     */
	String ID_PROP_SHEET = "org.eclipse.ui.views.PropertySheet"; //$NON-NLS-1$

    /**
     * The view id for the workbench's Content Outline standard component.
     */
	String ID_OUTLINE = "org.eclipse.ui.views.ContentOutline"; //$NON-NLS-1$

    /**
     * The view id for the workbench's Bookmark Navigator standard component.
     */
	String ID_BOOKMARKS = "org.eclipse.ui.views.BookmarkView"; //$NON-NLS-1$

    /**
     * The view id for the workbench's Problems View standard component.
     * @since 3.0
     */
	String ID_PROBLEM_VIEW = "org.eclipse.ui.views.ProblemView"; //$NON-NLS-1$

    /**
     * The view id for the workbench's Progress View standard component.
     * @since 3.2
     */
	String ID_PROGRESS_VIEW = "org.eclipse.ui.views.ProgressView"; //$NON-NLS-1$

    /**
     * The view id for the workbench's Task List standard component.
     */
	String ID_TASK_LIST = "org.eclipse.ui.views.TaskList"; //$NON-NLS-1$

    /**
     * Id of the navigate action set.
     * (value <code>"org.eclipse.ui.NavigateActionSet"</code>)
     * @since 2.1
     */
	String ID_NAVIGATE_ACTION_SET = "org.eclipse.ui.NavigateActionSet"; //$NON-NLS-1$

    /**
     * Relationship constant indicating a part should be placed to the left of
     * its relative.
     */
	int LEFT = 1;

    /**
     * Relationship constant indicating a part should be placed to the right of
     * its relative.
     */
	int RIGHT = 2;

    /**
     * Relationship constant indicating a part should be placed above its
     * relative.
     */
	int TOP = 3;

    /**
     * Relationship constant indicating a part should be placed below its
     * relative.
     */
	int BOTTOM = 4;

    /**
     * Minimum acceptable ratio value when adding a view
     * @since 2.0
     */
	float RATIO_MIN = 0.05f;

    /**
     * Maximum acceptable ratio value when adding a view
     * @since 2.0
     */
	float RATIO_MAX = 0.95f;

    /**
     * The default fast view ratio width.
     * @since 2.0
     * @deprecated discontinued support for fast views
     */
    @Deprecated
	float DEFAULT_FASTVIEW_RATIO = 0.3f;

    /**
     * The default view ratio width for regular (non-fast) views.
     * @since 2.0
     */
	float DEFAULT_VIEW_RATIO = 0.5f;

    /**
     * A variable used to represent invalid  ratios.
     * @since 2.0
     */
	float INVALID_RATIO = -1f;

    /**
     * A variable used to represent a ratio which has not been specified.
     * @since 2.0
     */
	float NULL_RATIO = -2f;

    /**
     * Adds an action set with the given id to this page layout.
     * The id must name an action set contributed to the workbench's extension
     * point (named <code>"org.eclipse.ui.actionSet"</code>).
     *
     * @param actionSetId the action set id
     */
	void addActionSet(String actionSetId);

    /**
     * Adds the view with the given compound id to the page layout as a fast view.
     * See the {@link IPageLayout} type documentation for more details about compound ids.
     * The primary id must name a view contributed to the workbench's view extension
     * point (named <code>"org.eclipse.ui.views"</code>).
     *
     * @param viewId the compound id of the view to be added
     * @since 2.0
     * @deprecated discontinued support for fast views
     */
    @Deprecated
	void addFastView(String viewId);

    /**
     * Adds the view with the given compound id to the page layout as a fast view
     * with the given width ratio.
     * See the {@link IPageLayout} type documentation for more details about compound ids.
     * The primary id must name a view contributed to the workbench's view extension
     * point (named <code>"org.eclipse.ui.views"</code>).
     *
     * @param viewId the compound id of the view to be added
     * @param ratio the percentage of the workbench the fast view will cover
     * @since 2.0
     * @deprecated discontinued support for fast views
     */
    @Deprecated
	void addFastView(String viewId, float ratio);

    /**
     * Adds a new wizard shortcut to the page layout.
     * These are typically shown in the UI to allow rapid navigation to appropriate new wizards.
     * For example, in the Eclipse IDE, these appear as items under the File > New menu.
     * The id must name a new wizard extension contributed to the
     * workbench's new wizards extension point (named <code>"org.eclipse.ui.newWizards"</code>).
     *
     * @param id the wizard id
     */
	void addNewWizardShortcut(String id);

    /**
     * Adds a perspective shortcut to the page layout.
     * These are typically shown in the UI to allow rapid navigation to appropriate new wizards.
     * For example, in the Eclipse IDE, these appear as items under the Window > Open Perspective menu.
     * The id must name a perspective extension contributed to the
     * workbench's perspectives extension point (named <code>"org.eclipse.ui.perspectives"</code>).
     *
     * @param id the perspective id
     */
	void addPerspectiveShortcut(String id);

    /**
     * Adds a view placeholder to this page layout.
     * A view placeholder is used to define the position of a view before the view
     * appears.  Initially, it is invisible; however, if the user ever opens a view
     * whose compound id matches the placeholder, the view will appear at the same
     * location as the placeholder.
     * See the {@link IPageLayout} type documentation for more details about compound ids.
     * If the placeholder contains wildcards, it remains in the layout, otherwise
     * it is replaced by the view.
     * If the primary id of the placeholder has no wildcards, it must refer to a view
     * contributed to the workbench's view extension point
     * (named <code>"org.eclipse.ui.views"</code>).
     *
     * @param viewId the compound view id (wildcards allowed)
     * @param relationship the position relative to the reference part;
     *  one of <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
     *  or <code>RIGHT</code>
     * @param ratio a ratio specifying how to divide the space currently occupied by the reference part,
     *    in the range <code>0.05f</code> to <code>0.95f</code>.
     *    Values outside this range will be clipped to facilitate direct manipulation.
     *    For a vertical split, the part on top gets the specified ratio of the current space
     *    and the part on bottom gets the rest.
     *    Likewise, for a horizontal split, the part at left gets the specified ratio of the current space
     *    and the part at right gets the rest.
     * @param refId the id of the reference part; either a view id, a folder id,
     *   or the special editor area id returned by <code>getEditorArea</code>
     */
	void addPlaceholder(String viewId, int relationship, float ratio,
            String refId);

    /**
     * Adds an item to the Show In prompter.
     * The id must name a view contributed to the workbench's view extension point
     * (named <code>"org.eclipse.ui.views"</code>).
     *
     * @param id the view id
     *
     * @since 2.1
     */
	void addShowInPart(String id);

    /**
     * Adds a show view shortcut to the page layout.
     * These are typically shown in the UI to allow rapid navigation to appropriate views.
     * For example, in the Eclipse IDE, these appear as items under the Window > Show View menu.
     * The id must name a view contributed to the workbench's views extension point
     * (named <code>"org.eclipse.ui.views"</code>).
     *
     * @param id the view id
     */
	void addShowViewShortcut(String id);

    /**
     * Adds a view with the given compound id to this page layout.
     * See the {@link IPageLayout} type documentation for more details about compound ids.
     * The primary id must name a view contributed to the workbench's view extension point
     * (named <code>"org.eclipse.ui.views"</code>).
     *
     * @param viewId the compound view id
     * @param relationship the position relative to the reference part;
     *  one of <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
     *  or <code>RIGHT</code>
     * @param ratio a ratio specifying how to divide the space currently occupied by the reference part,
     *    in the range <code>0.05f</code> to <code>0.95f</code>.
     *    Values outside this range will be clipped to facilitate direct manipulation.
     *    For a vertical split, the part on top gets the specified ratio of the current space
     *    and the part on bottom gets the rest.
     *    Likewise, for a horizontal split, the part at left gets the specified ratio of the current space
     *    and the part at right gets the rest.
     * @param refId the id of the reference part; either a view id, a folder id,
     *   or the special editor area id returned by <code>getEditorArea</code>
     */
	void addView(String viewId, int relationship, float ratio,
            String refId);

    /**
     * Creates and adds a new folder with the given id to this page layout.
     * The position and relative size of the folder is expressed relative to
     * a reference part.
     *
     * @param folderId the id for the new folder.  This must be unique within
     *  the layout to avoid collision with other parts.
     * @param relationship the position relative to the reference part;
     *  one of <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
     *  or <code>RIGHT</code>
     * @param ratio a ratio specifying how to divide the space currently occupied by the reference part,
     *    in the range <code>0.05f</code> to <code>0.95f</code>.
     *    Values outside this range will be clipped to facilitate direct manipulation.
     *    For a vertical split, the part on top gets the specified ratio of the current space
     *    and the part on bottom gets the rest.
     *    Likewise, for a horizontal split, the part at left gets the specified ratio of the current space
     *    and the part at right gets the rest.
     * @param refId the id of the reference part; either a view id, a folder id,
     *   or the special editor area id returned by <code>getEditorArea</code>
     * @return the new folder
     */
	IFolderLayout createFolder(String folderId, int relationship,
            float ratio, String refId);

    /**
     * Creates and adds a placeholder for a new folder with the given id to this page layout.
     * The position and relative size of the folder is expressed relative to
     * a reference part.
     *
     * @param folderId the id for the new folder.  This must be unique within
     *  the layout to avoid collision with other parts.
     * @param relationship the position relative to the reference part;
     *  one of <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
     *  or <code>RIGHT</code>
     * @param ratio a ratio specifying how to divide the space currently occupied by the reference part,
     *    in the range <code>0.05f</code> to <code>0.95f</code>.
     *    Values outside this range will be clipped to facilitate direct manipulation.
     *    For a vertical split, the part on top gets the specified ratio of the current space
     *    and the part on bottom gets the rest.
     *    Likewise, for a horizontal split, the part at left gets the specified ratio of the current space
     *    and the part at right gets the rest.
     * @param refId the id of the reference part; either a view id, a folder id,
     *   or the special editor area id returned by <code>getEditorArea</code>
     * @return a placeholder for the new folder
     * @since 2.0
     */
	IPlaceholderFolderLayout createPlaceholderFolder(String folderId,
            int relationship, float ratio, String refId);

    /**
     * Returns the special identifier for the editor area in this page
     * layout.  The identifier for the editor area is also stored in
     * <code>ID_EDITOR_AREA</code>.
     * <p>
     * The editor area is automatically added to each layout before anything else.
     * It should be used as the point of reference when adding views to a layout.
     * </p>
     *
     * @return the special id of the editor area
     */
	String getEditorArea();

    /**
     * Returns whether the page's layout will show
     * the editor area.
     *
     * @return <code>true</code> when editor area visible, <code>false</code> otherwise
     */
	boolean isEditorAreaVisible();

    /**
     * Show or hide the editor area for the page's layout.
     *
     * @param showEditorArea <code>true</code> to show the editor area, <code>false</code> to hide the editor area
     */
	void setEditorAreaVisible(boolean showEditorArea);

    /**
     * Returns the number of open editors before reusing editors or -1 if the
     * preference settings should be used instead.
     *
     * @return the number of open editors before reusing editors or -1 if the
     * preference settings should be used instead.
     *
     * @deprecated this always returns -1 as of Eclipse 2.1
     */
    @Deprecated
	int getEditorReuseThreshold();

    /**
     * Sets the number of open editors before reusing editors.
     * If < 0 the user preference settings will be used.
     *
     * @param openEditors the number of open editors
     *
     * @deprecated this method has no effect, as of Eclipse 2.1
     */
    @Deprecated
	void setEditorReuseThreshold(int openEditors);

    /**
     * Sets whether this layout is fixed.
     * In a fixed layout, layout parts cannot be moved or zoomed, and the initial
     * set of views cannot be closed.
     *
     * @param isFixed <code>true</code> if this layout is fixed, <code>false</code> if not
     * @since 3.0
     */
	void setFixed(boolean isFixed);

    /**
     * Returns <code>true</code> if this layout is fixed, <code>false</code> if not.
     * In a fixed layout, layout parts cannot be moved or zoomed, and the initial
     * set of views cannot be closed.
     * The default is <code>false</code>.
     *
     * @return <code>true</code> if this layout is fixed, <code>false</code> if not.
     * @since 3.0
     */
	boolean isFixed();

    /**
     * Returns the layout for the view or placeholder with the given compound id in
     * this page layout.
     * See the {@link IPageLayout} type documentation for more details about compound ids.
     * Returns <code>null</code> if the specified view or placeholder is unknown to the layout.
     *
     * @param id the compound view id or placeholder
     * @return the view layout, or <code>null</code>
     * @since 3.0
     */
	IViewLayout getViewLayout(String id);

    /**
     * Adds a standalone view with the given compound id to this page layout.
     * See the {@link IPageLayout} type documentation for more details about compound ids.
     * A standalone view cannot be docked together with other views.
     * A standalone view's title can optionally be hidden.  If hidden,
     * then any controls typically shown with the title (such as the close button)
     * are also hidden.  Any contributions or other content from the view itself
     * are always shown (e.g. toolbar or view menu contributions, content description).
     * <p>
     * The id must name a view contributed to the workbench's view extension point
     * (named <code>"org.eclipse.ui.views"</code>).
     * </p>
     *
     * @param viewId the compound view id
     * @param showTitle <code>true</code> to show the title and related controls,
     *  <code>false</code> to hide them
     * @param relationship the position relative to the reference part;
     *  one of <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
     *  or <code>RIGHT</code>
     * @param ratio a ratio specifying how to divide the space currently occupied by the reference part,
     *    in the range <code>0.05f</code> to <code>0.95f</code>.
     *    Values outside this range will be clipped to facilitate direct manipulation.
     *    For a vertical split, the part on top gets the specified ratio of the current space
     *    and the part on bottom gets the rest.
     *    Likewise, for a horizontal split, the part at left gets the specified ratio of the current space
     *    and the part at right gets the rest.
     * @param refId the id of the reference part; either a view id, a folder id,
     *   or the special editor area id returned by <code>getEditorArea</code>
     *
     * @since 3.0
     */
	void addStandaloneView(String viewId, boolean showTitle,
            int relationship, float ratio, String refId);

    /**
	 * Adds a standalone view placeholder to this page layout. A view
	 * placeholder is used to define the position of a view before the view
	 * appears. Initially, it is invisible; however, if the user ever opens a
	 * view whose compound id matches the placeholder, the view will appear at
	 * the same location as the placeholder. See the {@link IPageLayout} type
	 * documentation for more details about compound ids. If the placeholder
	 * contains wildcards, it remains in the layout, otherwise it is replaced by
	 * the view. If the primary id of the placeholder has no wildcards, it must
	 * refer to a view contributed to the workbench's view extension point
	 * (named <code>"org.eclipse.ui.views"</code>).
	 *
	 * @param viewId
	 *            the compound view id (wildcards allowed)
	 * @param relationship
	 *            the position relative to the reference part; one of
	 *            <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
	 *            or <code>RIGHT</code>
	 * @param ratio
	 *            a ratio specifying how to divide the space currently occupied
	 *            by the reference part, in the range <code>0.05f</code> to
	 *            <code>0.95f</code>. Values outside this range will be
	 *            clipped to facilitate direct manipulation. For a vertical
	 *            split, the part on top gets the specified ratio of the current
	 *            space and the part on bottom gets the rest. Likewise, for a
	 *            horizontal split, the part at left gets the specified ratio of
	 *            the current space and the part at right gets the rest.
	 * @param refId
	 *            the id of the reference part; either a view id, a folder id,
	 *            or the special editor area id returned by
	 *            <code>getEditorArea</code>
	 * @param showTitle
	 *            true to show the view's title, false if not
	 *
	 * @since 3.2
	 */
	void addStandaloneViewPlaceholder(String viewId, int relationship,
			float ratio, String refId, boolean showTitle);


    /**
	 * Returns the perspective descriptor for the perspective being layed out.
	 *
	 * @return the perspective descriptor for the perspective being layed out
	 * @since 3.2
	 */
	IPerspectiveDescriptor getDescriptor();

    /**
	 * Returns the folder layout for the view or placeholder with the given
	 * compound id in this page layout. See the {@link IPageLayout} type
	 * documentation for more details about compound ids. Returns
	 * <code>null</code> if the specified view or placeholder is unknown to
	 * the layout, or the placeholder was not in a folder.
	 *
	 * @param id
	 *            the compound view id or placeholder. Must not be
	 *            <code>null</code>.
	 * @return the folder layout, or <code>null</code>
	 * @since 3.3
	 */
	IPlaceholderFolderLayout getFolderForView(String id);
}