001: /*******************************************************************************
002: * Copyright (c) 2000, 2006 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.ui.views.bookmarkexplorer;
011:
012: import java.util.Map;
013:
014: import org.eclipse.core.resources.IMarker;
015: import org.eclipse.core.resources.IResource;
016: import org.eclipse.swt.widgets.Shell;
017: import org.eclipse.ui.internal.views.bookmarkexplorer.BookmarkMessages;
018: import org.eclipse.ui.views.markers.internal.DialogMarkerProperties;
019:
020: /**
021: * Shows the properties of a new or existing bookmark
022: * This class was made public in 3.3.
023: *
024: * @since 3.3
025: */
026: public class BookmarkPropertiesDialog extends DialogMarkerProperties {
027:
028: /**
029: * Creates the dialog. By default this dialog creates a new bookmark.
030: * To set the resource and initial attributes for the new bookmark,
031: * use <code>setResource</code> and <code>setInitialAttributes</code>.
032: * To show or modify an existing bookmark, use <code>setMarker</code>.
033: *
034: * @param parentShell the parent shell
035: */
036: public BookmarkPropertiesDialog(Shell parentShell) {
037: this (parentShell, BookmarkMessages.PropertiesDialogTitle_text);
038: }
039:
040: /**
041: * Creates the dialog. By default this dialog creates a new bookmark.
042: * To set the resource and initial attributes for the new bookmark,
043: * use <code>setResource</code> and <code>setInitialAttributes</code>.
044: * To show or modify an existing bookmark, use <code>setMarker</code>.
045: *
046: * @param parentShell the parent shell
047: * @param title the title for the dialog
048: */
049: public BookmarkPropertiesDialog(Shell parentShell, String title) {
050: super (parentShell, title);
051: setType(IMarker.BOOKMARK);
052: }
053:
054: /**
055: * Sets the marker to show or modify.
056: *
057: * @param marker the marker, or <code>null</code> to create a new marker
058: */
059: public void setMarker(IMarker marker) {
060: // Method is overridden because API is being inherited from an internal class.
061: super .setMarker(marker);
062: }
063:
064: /**
065: * Returns the marker being created or modified.
066: * For a new marker, this returns <code>null</code> until
067: * the dialog returns, but is non-null after.
068: *
069: * @return the marker
070: */
071: public IMarker getMarker() {
072: // Method is overridden because API is being inherited from an internal class.
073: return super .getMarker();
074: }
075:
076: /**
077: * Sets the resource to use when creating a new bookmark.
078: * If not set, the new bookmark is created on the workspace root.
079: *
080: * @param resource the resource
081: */
082: public void setResource(IResource resource) {
083: // Method is overridden because API is being inherited from an internal class.
084: super .setResource(resource);
085: }
086:
087: /**
088: * Returns the resource to use when creating a new bookmark,
089: * or <code>null</code> if none has been set.
090: * If not set, the new bookmark is created on the workspace root.
091: *
092: * @return the resource
093: */
094: public IResource getResource() {
095: // Method is overridden because API is being inherited from an internal class.
096: return super .getResource();
097: }
098:
099: /**
100: * Sets initial attributes to use when creating a new bookmark.
101: * If not set, the new bookmark is created with default attributes.
102: *
103: * @param initialAttributes the initial attributes
104: */
105: public void setInitialAttributes(Map initialAttributes) {
106: // Method is overridden because API is being inherited from an internal class.
107: super .setInitialAttributes(initialAttributes);
108: }
109:
110: /**
111: * Returns the initial attributes to use when creating a new bookmark,
112: * or <code>null</code> if not set.
113: * If not set, the new bookmark is created with default attributes.
114: *
115: * @return the initial attributes
116: */
117: public Map getInitialAttributes() {
118: // Method is overridden because API is being inherited from an internal class.
119: return super .getInitialAttributes();
120: }
121:
122: /* (non-Javadoc)
123: * @see org.eclipse.ui.views.markers.internal.DialogMarkerProperties.getModifyOperationTitle()
124: *
125: * @since 3.3
126: */
127: protected String getModifyOperationTitle() {
128: return BookmarkMessages.ModifyBookmark_undoText;
129: }
130:
131: /* (non-Javadoc)
132: * @see org.eclipse.ui.views.markers.internal.DialogMarkerProperties.getCreateOperationTitle()
133: *
134: * @since 3.3
135: */
136: protected String getCreateOperationTitle() {
137: return BookmarkMessages.CreateBookmark_undoText;
138:
139: }
140: }
|