KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > views > bookmarkexplorer > BookmarkPropertiesDialog


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.ui.views.bookmarkexplorer;
13
14 import java.util.Map JavaDoc;
15
16 import org.eclipse.core.resources.IMarker;
17 import org.eclipse.core.resources.IResource;
18 import org.eclipse.swt.widgets.Shell;
19 import org.eclipse.ui.internal.views.bookmarkexplorer.BookmarkMessages;
20 import org.eclipse.ui.views.markers.internal.DialogMarkerProperties;
21
22 /**
23  * Shows the properties of a new or existing bookmark
24  * This class was made public in 3.3.
25  *
26  * @since 3.3
27  */

28 public class BookmarkPropertiesDialog extends DialogMarkerProperties {
29
30
31
32     /**
33      * Creates the dialog. By default this dialog creates a new bookmark.
34      * To set the resource and initial attributes for the new bookmark,
35      * use <code>setResource</code> and <code>setInitialAttributes</code>.
36      * To show or modify an existing bookmark, use <code>setMarker</code>.
37      *
38      * @param parentShell the parent shell
39      */

40     public BookmarkPropertiesDialog(Shell parentShell) {
41         this(parentShell, BookmarkMessages.PropertiesDialogTitle_text);
42     }
43
44     /**
45      * Creates the dialog. By default this dialog creates a new bookmark.
46      * To set the resource and initial attributes for the new bookmark,
47      * use <code>setResource</code> and <code>setInitialAttributes</code>.
48      * To show or modify an existing bookmark, use <code>setMarker</code>.
49      *
50      * @param parentShell the parent shell
51      * @param title the title for the dialog
52      */

53     public BookmarkPropertiesDialog(Shell parentShell, String JavaDoc title) {
54         super(parentShell, title);
55         setType(IMarker.BOOKMARK);
56     }
57     
58     /**
59      * Sets the marker to show or modify.
60      *
61      * @param marker the marker, or <code>null</code> to create a new marker
62      */

63     public void setMarker(IMarker marker) {
64         // Method is overridden because API is being inherited from an internal class.
65
super.setMarker(marker);
66     }
67
68     /**
69      * Returns the marker being created or modified.
70      * For a new marker, this returns <code>null</code> until
71      * the dialog returns, but is non-null after.
72      *
73      * @return the marker
74      */

75     public IMarker getMarker() {
76         // Method is overridden because API is being inherited from an internal class.
77
return super.getMarker();
78     }
79
80     /**
81      * Sets the resource to use when creating a new bookmark.
82      * If not set, the new bookmark is created on the workspace root.
83      *
84      * @param resource the resource
85      */

86     public void setResource(IResource resource) {
87         // Method is overridden because API is being inherited from an internal class.
88
super.setResource(resource);
89     }
90
91     /**
92      * Returns the resource to use when creating a new bookmark,
93      * or <code>null</code> if none has been set.
94      * If not set, the new bookmark is created on the workspace root.
95      *
96      * @return the resource
97      */

98     public IResource getResource() {
99         // Method is overridden because API is being inherited from an internal class.
100
return super.getResource();
101     }
102
103     /**
104      * Sets initial attributes to use when creating a new bookmark.
105      * If not set, the new bookmark is created with default attributes.
106      *
107      * @param initialAttributes the initial attributes
108      */

109     public void setInitialAttributes(Map JavaDoc initialAttributes) {
110         // Method is overridden because API is being inherited from an internal class.
111
super.setInitialAttributes(initialAttributes);
112     }
113
114     /**
115      * Returns the initial attributes to use when creating a new bookmark,
116      * or <code>null</code> if not set.
117      * If not set, the new bookmark is created with default attributes.
118      *
119      * @return the initial attributes
120      */

121     public Map JavaDoc getInitialAttributes() {
122         // Method is overridden because API is being inherited from an internal class.
123
return super.getInitialAttributes();
124     }
125     
126     /* (non-Javadoc)
127      * @see org.eclipse.ui.views.markers.internal.DialogMarkerProperties.getModifyOperationTitle()
128      *
129      * @since 3.3
130      */

131     protected String JavaDoc getModifyOperationTitle() {
132         return BookmarkMessages.ModifyBookmark_undoText;
133     }
134     
135     /* (non-Javadoc)
136      * @see org.eclipse.ui.views.markers.internal.DialogMarkerProperties.getCreateOperationTitle()
137      *
138      * @since 3.3
139      */

140     protected String JavaDoc getCreateOperationTitle() {
141         return BookmarkMessages.CreateBookmark_undoText;
142         
143     }
144 }
145
Popular Tags