Index: plugin.properties
===================================================================
--- plugin.properties (revision 2850)
+++ plugin.properties (working copy)
@@ -73,8 +73,6 @@
ExportRemoteFolderAction.label=Export...
ImportFolderAction.label=Import...
DeleteRemoteAction.tooltip=Delete remote resource
-deletesvnpropertyaction.label=Delete Property
-deletesvnpropertyaction.tooltip=Delete the selected SVN properties
DiffMergePreferencePage.name=Diff/Merge
EditConflictsAction.label=Edit conflicts
EditConflictsAction.tooltip=Use external merge program to resolve conflicts
@@ -93,8 +91,6 @@
IgnoreCommand.label=Add to svn:ignore
MergeAction.label=&Merge...
MergeAction.tooltip=Merge
-ModifySVNPropertyAction.label=Modify property
-ModifySVNPropertyAction.tooltip=Modify the svn property
RemoteResourcePropertiesAction.label=Properties
MoveRemoteAction.label=Rename/move...
MoveRemoteAction.tooltip=Rename of move a remote resource
@@ -135,8 +131,6 @@
ExportAction.label=Export...
ResolveAction.label=Mark Resolved
ResolveAction.tooltip=Set state to "resolved" (all conflicts fixed)
-SaveSVNPropertyAction.label=Save property value
-SaveSVNPropertyAction.tooltip=Save the value of the selected property to a file
SetSvnProperty.label=Set Property...
SetSvnProperty.tooltip=Set a new SVN property on the selected resource
SharingWizard.name=SVN
@@ -161,7 +155,6 @@
SVNConsoleFont.label=SVN Console Font
SVNGroupMenu.label=S&VN
SVNMergeParticipant=SVN Merge
-SvnPropertiesView.name=SVN Properties
SVNRemoteQuickDiffProvider.label=&Latest SVN Revision
SVNRepositoryExploring=SVN Repository Exploring
SVN=SVN
@@ -179,8 +172,6 @@
UpdateCommand.label=Update
viewCategory=SVN
WatchEditPreferencePage.name=Watch/Edit
-DeleteSVNPropertyAction.label=Delete property
-DeleteSVNPropertyAction.tooltip=Delete the selected SVN properties
AnnotateView.name=SVN Annotate
ShowAnnotationAction.label=Show &Annotation
ShowAnnotationAction.tooltip=Show Annotation
@@ -202,6 +193,7 @@
IgnoredResourceBackgroundColor.description=This color is used for the background color for resources that are ignored from SVN.
svnQuickDiff.label=Pristine SVN Copy
svnPropertyPage.name=Subversion
+svnPropertyPropertiesPage.name=Properties
syncWizard.description=
syncWizard.name=SVN
syncWizard.description=Synchronize files managed with SVN
Index: plugin.xml
===================================================================
--- plugin.xml (revision 2850)
+++ plugin.xml (working copy)
@@ -16,13 +16,6 @@
id="org.tigris.subversion.subclipse.ui.repository.RepositoriesView">
-
-
-
-
-
-
-
-
-
-
@@ -759,6 +726,17 @@
class="org.tigris.subversion.subclipse.ui.properties.SVNRepositoryPropertiesPage"
id="org.tigris.subversion.subclipse.ui.properties.SVNRepositoryPropertiesPage">
+
+
+
Index: plugin_ja.properties
===================================================================
--- plugin_ja.properties (revision 2850)
+++ plugin_ja.properties (working copy)
@@ -101,9 +101,6 @@
DeleteRemoteAction.label = \u524A\u9664...
DeleteRemoteAction.tooltip = \u30EA\u30E2\u30FC\u30C8\u306E\u30EA\u30BD\u30FC\u30B9\u3092\u524A\u9664\u3057\u307E\u3059\u3002
-DeleteSVNPropertyAction.label = \u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u524A\u9664
-DeleteSVNPropertyAction.tooltip = \u9078\u629E\u3055\u308C\u305FSVN\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u524A\u9664\u3057\u307E\u3059\u3002
-
DiffMergePreferencePage.name = \u5DEE\u5206/\u30DE\u30FC\u30B8
EditConflictsAction.label = \u7AF6\u5408\u306E\u7DE8\u96C6
@@ -126,9 +123,6 @@
MergeAction.label = \u30DE\u30FC\u30B8(&M)...
MergeAction.tooltip = \u30DE\u30FC\u30B8
-ModifySVNPropertyAction.label = \u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u5909\u66F4
-ModifySVNPropertyAction.tooltip = svn\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u5909\u66F4\u3057\u307E\u3059\u3002
-
MoveRemoteAction.label = \u540D\u524D\u5909\u66F4/\u79FB\u52D5...
MoveRemoteAction.tooltip = \u30EA\u30E2\u30FC\u30C8\u306E\u30EA\u30BD\u30FC\u30B9\u306E\u540D\u524D\u3092\u5909\u66F4\u3082\u3057\u304F\u306F\u79FB\u52D5\u3057\u307E\u3059\u3002
@@ -208,9 +202,6 @@
SVNWorkspaceParticipant = SVN
-SaveSVNPropertyAction.label = \u30D7\u30ED\u30D1\u30C6\u30A3\u5024\u306E\u4FDD\u5B58
-SaveSVNPropertyAction.tooltip = \u9078\u629E\u3055\u308C\u305F\u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u5024\u3092\u30D5\u30A1\u30A4\u30EB\u3078\u4FDD\u5B58\u3057\u307E\u3059\u3002
-
SetSvnProperty.label = \u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u8A2D\u5B9A...
SetSvnProperty.tooltip = \u9078\u629E\u3055\u308C\u305F\u30EA\u30BD\u30FC\u30B9\u306B\u5BFE\u3057\u3066\u65B0\u3057\u3044SVN\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u8A2D\u5B9A\u3057\u307E\u3059\u3002
@@ -230,8 +221,6 @@
ShowSvnPropertiesAction.label = \u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u8868\u793A
ShowSvnPropertiesAction.tooltip = \u9078\u629E\u3055\u308C\u305F\u30EA\u30BD\u30FC\u30B9\u306ESVN\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u8868\u793A\u3057\u307E\u3059\u3002
-SvnPropertiesView.name = SVN\u30D7\u30ED\u30D1\u30C6\u30A3
-
SwitchAction.label = \u5207\u308A\u63DB\u3048(&S)...
SwitchAction.tooltip = \u5207\u308A\u63DB\u3048
@@ -263,9 +252,6 @@
conflictMarker = SVN\u7AF6\u5408
-deletesvnpropertyaction.label = \u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u524A\u9664
-deletesvnpropertyaction.tooltip = \u9078\u629E\u3055\u308C\u305FSVN\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u524A\u9664\u3057\u307E\u3059\u3002
-
extmethodpreferencepage.name = ext\u63A5\u7D9A\u65B9\u6CD5
generatediff.label = \u30D1\u30C3\u30C1\u306E\u4F5C\u6210(&P)...
Index: plugin_zh.properties
===================================================================
--- plugin_zh.properties (revision 2850)
+++ plugin_zh.properties (working copy)
@@ -114,9 +114,6 @@
DeleteRemoteAction.label = \u5220\u9664...
DeleteRemoteAction.tooltip = \u5220\u9664\u8FDC\u7A0B\u8D44\u6E90
-DeleteSVNPropertyAction.label = \u5220\u9664\u5C5E\u6027
-DeleteSVNPropertyAction.tooltip = \u5220\u9664\u9009\u62E9\u7684 SVN \u5C5E\u6027
-
DiffMergePreferencePage.name = \u6BD4\u8F83\uFF0F\u5408\u5E76
EditConflictsAction.label = \u7F16\u8F91\u51B2\u7A81
@@ -152,9 +149,6 @@
MergeAction.label = \u5408\u5E76(&M)...
MergeAction.tooltip = \u5408\u5E76
-ModifySVNPropertyAction.label = \u4FEE\u6539\u5C5E\u6027
-ModifySVNPropertyAction.tooltip = \u4FEE\u6539 svn \u5C5E\u6027
-
MoveRemoteAction.label = \u91CD\u547D\u540D\uFF0F\u79FB\u52A8...
MoveRemoteAction.tooltip = \u91CD\u547D\u540D\u6216\u79FB\u52A8\u8FDC\u7A0B\u8D44\u6E90
@@ -245,9 +239,6 @@
SVNWorkspaceParticipant = SVN
-SaveSVNPropertyAction.label = \u4FDD\u5B58\u5C5E\u6027\u503C
-SaveSVNPropertyAction.tooltip = \u4FDD\u5B58\u9009\u62E9\u5C5E\u6027\u7684\u503C\u81F3\u6587\u4EF6
-
SetSvnProperty.label = \u8BBE\u7F6E\u5C5E\u6027...
SetSvnProperty.tooltip = \u4E3A\u9009\u62E9\u7684\u8D44\u6E90\u8BBE\u7F6E\u65B0\u7684 SVN \u5C5E\u6027
@@ -267,8 +258,6 @@
ShowSvnPropertiesAction.label = \u663E\u793A\u5C5E\u6027
ShowSvnPropertiesAction.tooltip = \u663E\u793A\u9009\u62E9\u8D44\u6E90\u7684 SVN \u5C5E\u6027
-SvnPropertiesView.name = SVN \u5C5E\u6027
-
SwitchAction.label = \u5207\u6362(&S)...
SwitchAction.tooltip = \u5207\u6362
@@ -300,9 +289,6 @@
conflictMarker = SVN \u51B2\u7A81
-deletesvnpropertyaction.label = \u5220\u9664\u5C5E\u6027
-deletesvnpropertyaction.tooltip = \u5220\u9664\u9009\u62E9\u7684 SVN \u5C5E\u6027
-
extmethodpreferencepage.name = Ext \u8FDE\u63A5\u65B9\u6CD5
generatediff.label = \u521B\u5EFA\u8865\u4E01(&P)...
Index: plugin_zh_TW.properties
===================================================================
--- plugin_zh_TW.properties (revision 2850)
+++ plugin_zh_TW.properties (working copy)
@@ -99,9 +99,6 @@
DeleteRemoteAction.label = \u522A\u9664...
DeleteRemoteAction.tooltip = \u522A\u9664\u9078\u53D6\u7684\u6A94\u6848
-DeleteSVNPropertyAction.label = \u522A\u9664\u6027\u8CEA
-DeleteSVNPropertyAction.tooltip = \u522A\u9664\u9078\u53D6\u7684\u6027\u8CEA
-
DiffMergePreferencePage.name = \u6BD4\u8F03/\u5408\u4F75
EditConflictsAction.label = \u7DE8\u4FEE\u885D\u7A81
@@ -124,9 +121,6 @@
MergeAction.label = \u5408\u4F75(&M)...
MergeAction.tooltip = \u5408\u4F75
-ModifySVNPropertyAction.label = \u4FEE\u6539\u5C6C\u6027
-ModifySVNPropertyAction.tooltip = \u4FEE\u6539 svn \u5C6C\u6027
-
MoveRemoteAction.label = \u91CD\u65B0\u547D\u540D/\u79FB\u52D5
MoveRemoteAction.tooltip = \u91CD\u65B0\u547D\u540D\u6216\u79FB\u52D5\u9078\u53D6\u7684\u8CC7\u6E90
@@ -197,9 +191,6 @@
SVNWorkspaceParticipant = SVN
-SaveSVNPropertyAction.label = \u5132\u5B58\u5C6C\u6027\u503C
-SaveSVNPropertyAction.tooltip = \u5C07\u9078\u53D6\u7684\u5C6C\u6027\u503C\u5132\u5B58\u81F3\u6A94\u6848
-
SetSvnProperty.label = \u8A2D\u5B9A\u5C6C\u6027...
SetSvnProperty.tooltip = \u8A2D\u5B9A\u65B0\u7684 SVN \u5C6C\u6027\u5230\u9078\u53D6\u7684\u6A94\u6848
@@ -219,8 +210,6 @@
ShowSvnPropertiesAction.label = \u986F\u793A\u5C6C\u6027
ShowSvnPropertiesAction.tooltip = \u986F\u793A\u9078\u53D6\u8CC7\u6E90\u7684 SVN \u5C6C\u6027
-SvnPropertiesView.name = SVN \u5C6C\u6027
-
SwitchAction.label = \u5207\u63DB (&S)
SwitchAction.tooltip = \u5207\u63DB
@@ -248,9 +237,6 @@
conflictMarker = SVN \u885D\u7A81
-deletesvnpropertyaction.label = \u522A\u9664\u5C6C\u6027
-deletesvnpropertyaction.tooltip = \u522A\u9664\u9078\u53D6\u7684 SVN \u5C6C\u6027
-
extmethodpreferencepage.name = Ext \u9023\u63A5\u65B9\u5F0F
generatediff.label = \u5EFA\u7ACB\u88DC\u7DB4\u6A94 (&P)
Index: src/org/tigris/subversion/subclipse/ui/actions/ShowSvnPropertiesAction.java
===================================================================
--- src/org/tigris/subversion/subclipse/ui/actions/ShowSvnPropertiesAction.java (revision 2850)
+++ src/org/tigris/subversion/subclipse/ui/actions/ShowSvnPropertiesAction.java (working copy)
@@ -14,9 +14,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.IAction;
-import org.tigris.subversion.subclipse.core.ISVNLocalResource;
-import org.tigris.subversion.subclipse.core.SVNException;
-import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot;
+import org.eclipse.ui.internal.dialogs.PropertyDialog;
import org.tigris.subversion.subclipse.ui.ISVNUIConstants;
import org.tigris.subversion.subclipse.ui.svnproperties.SvnPropertiesView;
@@ -31,15 +29,7 @@
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
IResource resource = (IResource)getSelectedResources()[0];
- final ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
- try {
- SvnPropertiesView view = (SvnPropertiesView)showView(SvnPropertiesView.VIEW_ID);
- if (view != null)
- view.showSvnProperties(svnResource);
- } catch (SVNException e) {
- throw new InvocationTargetException(e);
- }
-
+ PropertyDialog.createDialogOn(getShell(), SvnPropertiesView.PAGE_ID, resource).open();
}
protected boolean isEnabledForAddedResources() {
Index: src/org/tigris/subversion/subclipse/ui/messages.properties
===================================================================
--- src/org/tigris/subversion/subclipse/ui/messages.properties (revision 2850)
+++ src/org/tigris/subversion/subclipse/ui/messages.properties (working copy)
@@ -1028,12 +1028,18 @@
SvnPropertiesView.errorAddMessage=Can't add the new property
SvnPropertiesView.errorAddTitle=Add property
SvnPropertiesView.modifyPropertyLabel=Modify the property
+SvnPropertiesView.modifyPropertyTooltip=Modify the svn property
+SvnPropertiesView.errorModifyTitle=Modify property
+SvnPropertiesView.errorModifyMessage=Can't modify property
SvnPropertiesView.propertyName=name
SvnPropertiesView.propertyValue=value
SvnPropertiesView.refresh=Refresh View
SvnPropertiesView.refreshLabel=&Refresh View
SvnPropertiesView.titleWithArgument=Svn properties for {0}
SvnPropertiesView.deletePropertyLabel=Delete the property
+SvnPropertiesView.deletePropertyTooltip=Delete the selected SVN properties
+SvnPropertiesView.errorDeleteTitle=Delete property
+SvnPropertiesView.errorDeleteMessage=Can't delete property
SvnPropertiesView.resourceNotManaged=Resource is not managed
SvnPropertiesView.somePropertiesModified=Some properties have been modified since last commit
SvnPropertiesView.noPropertiesModified=No properties have been modified since last commit
@@ -1043,6 +1049,10 @@
SvnPropertiesView.addKeywordsTooltip=Set keywords
SvnPropertiesView.errorAddKeywordsTitle=Set keywords
SvnPropertiesView.errorAddKeywordsMessage=Can't set keywords
+SvnPropertiesView.savePropertyLabel=Save property value
+SvnPropertiesView.savePropertyTooltip=Save the value of the selected property to a file
+SvnPropertiesView.errorSaveTitle=Save property value
+SvnPropertiesView.errorSaveMessage=Can't save property value
SyncAction.override.confirm=This action will remove your local changes. Are you sure that you want to revert your local changes and replace them with the file from the repository?
SyncAction.override.title=Override and Update
SyncAction.commit=&Commit...
Index: src/org/tigris/subversion/subclipse/ui/properties/SVNPropertyPage.java
===================================================================
--- src/org/tigris/subversion/subclipse/ui/properties/SVNPropertyPage.java (revision 2850)
+++ src/org/tigris/subversion/subclipse/ui/properties/SVNPropertyPage.java (working copy)
@@ -62,6 +62,7 @@
public SVNPropertyPage() {
super();
+ super.noDefaultAndApplyButton();
}
private void addFirstSection(Composite parent) {
Index: src/org/tigris/subversion/subclipse/ui/subscriber/ShowPropertiesSynchronizeOperation.java
===================================================================
--- src/org/tigris/subversion/subclipse/ui/subscriber/ShowPropertiesSynchronizeOperation.java (revision 2850)
+++ src/org/tigris/subversion/subclipse/ui/subscriber/ShowPropertiesSynchronizeOperation.java (working copy)
@@ -25,10 +25,8 @@
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.PartInitException;
-import org.tigris.subversion.subclipse.core.ISVNLocalResource;
-import org.tigris.subversion.subclipse.core.SVNException;
+import org.eclipse.ui.internal.dialogs.PropertyDialog;
import org.tigris.subversion.subclipse.core.SVNTeamProvider;
-import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot;
import org.tigris.subversion.subclipse.ui.SVNUIPlugin;
import org.tigris.subversion.subclipse.ui.svnproperties.SvnPropertiesView;
@@ -53,15 +51,7 @@
public void run(IProgressMonitor monitor) {
getShell().getDisplay().syncExec(new Runnable() {
public void run() {
- try {
- SvnPropertiesView view = (SvnPropertiesView)showView(SvnPropertiesView.VIEW_ID);
- if (view != null) {
- ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
- view.showSvnProperties(svnResource);
- }
- } catch (SVNException e) {
- e.printStackTrace();
- }
+ PropertyDialog.createDialogOn(getShell(), SvnPropertiesView.PAGE_ID, resource).open();
}
});
}
Index: src/org/tigris/subversion/subclipse/ui/svnproperties/SvnPropertiesView.java
===================================================================
--- src/org/tigris/subversion/subclipse/ui/svnproperties/SvnPropertiesView.java (revision 2850)
+++ src/org/tigris/subversion/subclipse/ui/svnproperties/SvnPropertiesView.java (working copy)
@@ -10,15 +10,20 @@
******************************************************************************/
package org.tigris.subversion.subclipse.ui.svnproperties;
-import org.eclipse.core.resources.IProject;
+import java.io.ByteArrayInputStream;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.TextViewer;
import org.eclipse.jface.viewers.ArrayContentProvider;
@@ -41,29 +46,23 @@
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.part.ViewPart;
-import org.tigris.subversion.subclipse.core.IResourceStateChangeListener;
+import org.eclipse.ui.dialogs.PropertyPage;
+import org.eclipse.ui.dialogs.SaveAsDialog;
import org.tigris.subversion.subclipse.core.ISVNLocalResource;
import org.tigris.subversion.subclipse.core.SVNException;
-import org.tigris.subversion.subclipse.core.SVNProviderPlugin;
import org.tigris.subversion.subclipse.core.resources.LocalResourceStatus;
import org.tigris.subversion.subclipse.ui.IHelpContextIds;
import org.tigris.subversion.subclipse.ui.ISVNUIConstants;
import org.tigris.subversion.subclipse.ui.Policy;
import org.tigris.subversion.subclipse.ui.SVNUIPlugin;
-import org.tigris.subversion.subclipse.ui.actions.SVNPropertyDeleteAction;
-import org.tigris.subversion.subclipse.ui.actions.SVNPropertyModifyAction;
import org.tigris.subversion.svnclientadapter.ISVNProperty;
import org.tigris.subversion.svnclientadapter.SVNStatusKind;
@@ -72,9 +71,9 @@
* The SvnPropertiesView
shows the svn properties for a svn local resource
*
*/
-public class SvnPropertiesView extends ViewPart {
+public class SvnPropertiesView extends PropertyPage {
- public static final String VIEW_ID = "org.tigris.subversion.subclipse.ui.svnproperties.SvnPropertiesView"; //$NON-NLS-1$
+ public static final String PAGE_ID = "org.tigris.subversion.subclipse.ui.properties.SVNPropertyPropertiesPage"; //$NON-NLS-1$
private TableViewer tableViewer;
private TextViewer textViewer;
@@ -83,44 +82,14 @@
private Action addPropertyAction;
private Action modifyPropertyAction;
private Action deletePropertyAction;
+ private Action savePropertyAction;
private Label statusLabel;
- private ISelectionListener pageSelectionListener;
- private IResourceStateChangeListener resourceStateChangeListener;
- class ResourceStateChangeListener implements IResourceStateChangeListener {
- /**
- * the svn status of some resources changed. Refresh if we are concerned
- */
- public void resourceSyncInfoChanged(IResource[] changedResources) {
- for (int i = 0; i < changedResources.length;i++) {
- if (resource != null && changedResources[i].equals(resource.getIResource())) {
- refresh();
- }
- }
- }
-
- public void resourceModified(IResource[] changedResources) {}
-
- public void projectConfigured(IProject project) {}
-
- public void projectDeconfigured(IProject project) {}
- }
-
-
public SvnPropertiesView() {
+ super();
+ super.noDefaultAndApplyButton();
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- SVNProviderPlugin.removeResourceStateChangeListener(resourceStateChangeListener);
- resourceStateChangeListener = null;
- getSite().getPage().removePostSelectionListener(pageSelectionListener);
- super.dispose();
- }
-
class PropertiesLabelProvider implements ITableLabelProvider {
public PropertiesLabelProvider() {
@@ -210,66 +179,38 @@
return result;
}
- /**
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- public void createPartControl(Composite parent) {
+ /**
+ * @see PreferencePage#createContents(Composite)
+ */
+ public Control createContents(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 1;
- parent.setLayout(layout);
- statusLabel = new Label(parent,SWT.LEFT);
+ composite.setLayout(layout);
+ statusLabel = new Label(composite,SWT.LEFT);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.grabExcessHorizontalSpace = true;
statusLabel.setLayoutData(gridData);
- SashForm sashForm = new SashForm(parent, SWT.VERTICAL);
+ SashForm sashForm = new SashForm(composite, SWT.VERTICAL);
sashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
tableViewer = createTable(sashForm);
textViewer = createText(sashForm);
sashForm.setWeights(new int[] { 70, 30 });
- contributeActions();
-
- pageSelectionListener = new ISelectionListener() {
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- handlePartSelectionChanged(part,selection);
- }
- };
-
- getSite().getPage().addPostSelectionListener(pageSelectionListener);
-
- resourceStateChangeListener = new ResourceStateChangeListener();
- SVNProviderPlugin.addResourceStateChangeListener(resourceStateChangeListener);
- }
+ contributeActions();
- /**
- * called when the selection changed on another part
- */
- private void handlePartSelectionChanged(IWorkbenchPart part, ISelection selection) {
- if (!(selection instanceof IStructuredSelection))
- return;
-
- try {
- Object first = ((IStructuredSelection)selection).getFirstElement();
+ // If the resource isn't open or doesn't exist it won't have properties
+ IResource selectedResource = (IResource)getElement();
+ if (!selectedResource.isAccessible()) {
+ resource = null;
+ } else {
+ resource = (ISVNLocalResource)selectedResource.getAdapter(ISVNLocalResource.class);
+ }
- if (first instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) first;
- Object adapter = a.getAdapter(IResource.class);
- if (adapter instanceof IResource) {
- IResource resource = (IResource)adapter;
-
- // If the resource isn't open or doesn't exist it won't have properties
- if (!resource.isAccessible()) {
- showSvnProperties(null);
- } else {
- ISVNLocalResource svnResource = (ISVNLocalResource)resource.getAdapter(ISVNLocalResource.class);
- showSvnProperties(svnResource);
- }
- }
- }
- } catch (SVNException e) {
- }
+ refresh();
+ return composite;
}
private Action getRefreshAction() {
@@ -292,7 +233,7 @@
SVNUIPlugin plugin = SVNUIPlugin.getPlugin();
addPropertyAction = new Action(Policy.bind("SvnPropertiesView.addPropertyLabel"), plugin.getImageDescriptor(ISVNUIConstants.IMG_MENU_PROPSET)) { //$NON-NLS-1$
public void run() {
- SetSvnPropertyDialog dialog = new SetSvnPropertyDialog(getSite().getShell(),resource);
+ SetSvnPropertyDialog dialog = new SetSvnPropertyDialog(getShell(),resource);
if (dialog.open() != SetSvnPropertyDialog.OK) return;
try {
@@ -303,12 +244,12 @@
}
} catch (SVNException e) {
SVNUIPlugin.openError(
- getSite().getShell(),
+ getShell(),
Policy.bind("SvnPropertiesView.errorAddTitle"), //$NON-NLS-1$
Policy.bind("SvnPropertiesView.errorAddMessage"),//$NON-NLS-1$
e);
}
-
+ refresh();
}
};
addPropertyAction.setToolTipText(Policy.bind("SvnPropertiesView.addPropertyTooltip")); //$NON-NLS-1$
@@ -320,30 +261,112 @@
if (modifyPropertyAction == null) {
modifyPropertyAction = new Action(Policy.bind("SvnPropertiesView.modifyPropertyLabel")) { //$NON-NLS-1$
public void run() {
- SVNPropertyModifyAction delegate = new SVNPropertyModifyAction();
- delegate.init(this);
- delegate.selectionChanged(this,tableViewer.getSelection());
- delegate.run(this);
+ IStructuredSelection selection = (IStructuredSelection)tableViewer.getSelection();
+ if (selection.isEmpty())
+ return;
+
+ ISVNProperty svnProperty = (ISVNProperty)selection.getFirstElement();
+ SetSvnPropertyDialog dialog = new SetSvnPropertyDialog(getShell(),resource,svnProperty);
+ if (dialog.open() != SetSvnPropertyDialog.OK) return;
+
+ try {
+ if (dialog.getPropertyValue() != null) {
+ resource.setSvnProperty(dialog.getPropertyName(), dialog.getPropertyValue(),dialog.getRecurse());
+ } else {
+ resource.setSvnProperty(dialog.getPropertyName(), dialog.getPropertyFile(),dialog.getRecurse());
+ }
+ } catch (SVNException e) {
+ SVNUIPlugin.openError(
+ getShell(),
+ Policy.bind("SvnPropertiesView.errorModifyTitle"), //$NON-NLS-1$
+ Policy.bind("SvnPropertiesView.errorModifyMessage"),//$NON-NLS-1$
+ e);
+ }
+ refresh();
}
};
+ modifyPropertyAction.setToolTipText(Policy.bind("SvnPropertiesView.modifyPropertyTooltip")); //$NON-NLS-1$
}
return modifyPropertyAction;
}
private Action getDeletePropertyAction() {
if (deletePropertyAction == null) {
- deletePropertyAction = new Action(Policy.bind("SvnPropertiesView.deletePropertyLabel")) { //$NON-NLS-1$
+ SVNUIPlugin plugin = SVNUIPlugin.getPlugin();
+ deletePropertyAction = new Action(Policy.bind("SvnPropertiesView.deletePropertyLabel"), plugin.getImageDescriptor(ISVNUIConstants.IMG_MENU_PROPDELETE)) { //$NON-NLS-1$
public void run() {
- SVNPropertyDeleteAction delegate = new SVNPropertyDeleteAction();
- delegate.init(this);
- delegate.selectionChanged(this,tableViewer.getSelection());
- delegate.run(this);
+ IStructuredSelection selection = (IStructuredSelection)tableViewer.getSelection();
+ if (selection.isEmpty())
+ return;
+
+ String message;
+ if (selection.size() == 1) {
+ message = Policy.bind("SVNPropertyDeleteAction.confirmSingle",((ISVNProperty)selection.getFirstElement()).getName()); //$NON-NLS-1$
+ } else {
+ message = Policy.bind("SVNPropertyDeleteAction.confirmMultiple",Integer.toString(selection.size())); //$NON-NLS-1$
+ }
+
+ if (!MessageDialog.openQuestion(getShell(), Policy.bind("SVNPropertyDeleteAction.title"), message)) { //$NON-NLS-1$
+ return;
+ }
+
+ for (Iterator it = selection.iterator(); it.hasNext();) {
+ ISVNProperty svnProperty = (ISVNProperty)it.next();
+ try {
+ resource.deleteSvnProperty(svnProperty.getName(),false);
+ } catch (SVNException e) {
+ SVNUIPlugin.openError(
+ getShell(),
+ Policy.bind("SvnPropertiesView.errorDeleteTitle"), //$NON-NLS-1$
+ Policy.bind("SvnPropertiesView.errorDeleteMessage"),//$NON-NLS-1$
+ e);
+ break;
+ }
+
+ }
+ refresh();
}
- };
+ };
+ deletePropertyAction.setToolTipText(Policy.bind("SvnPropertiesView.deletePropertyTooltip")); //$NON-NLS-1$
}
return deletePropertyAction;
}
+ private Action getSavePropertyAction() {
+ if (savePropertyAction == null) {
+ savePropertyAction = new Action(Policy.bind("SvnPropertiesView.savePropertyLabel")) { //$NON-NLS-1$
+ public void run() {
+ IStructuredSelection selection = (IStructuredSelection)tableViewer.getSelection();
+ if (selection.isEmpty())
+ return;
+
+ ISVNProperty svnProperty = (ISVNProperty)selection.getFirstElement();
+ SaveAsDialog dialog = new SaveAsDialog(getShell());
+
+ if (dialog.open() != SaveAsDialog.OK)
+ return;
+
+ IFile file =
+ ResourcesPlugin.getWorkspace().getRoot().getFile(
+ dialog.getResult());
+ try {
+ ByteArrayInputStream is =
+ new ByteArrayInputStream(svnProperty.getData());
+ file.create(is, true, null);
+ } catch (CoreException e) {
+ SVNUIPlugin.openError(
+ getShell(),
+ Policy.bind("SvnPropertiesView.errorSaveTitle"), //$NON-NLS-1$
+ Policy.bind("SvnPropertiesView.errorSaveMessage"),//$NON-NLS-1$
+ e);
+ }
+ refresh();
+ }
+ };
+ savePropertyAction.setToolTipText(Policy.bind("SvnPropertiesView.savePropertyTooltip")); //$NON-NLS-1$
+ }
+ return savePropertyAction;
+ }
/**
* Adds the action contributions for this view.
@@ -359,15 +382,7 @@
});
menuMgr.setRemoveAllWhenShown(true);
tableViewer.getTable().setMenu(menu);
- getSite().registerContextMenu(menuMgr, tableViewer);
- // Create the local tool bar
- IActionBars actionBars = getViewSite().getActionBars();
- actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(),getDeletePropertyAction());
- IToolBarManager tbm = actionBars.getToolBarManager();
- tbm.add(getRefreshAction());
- tbm.update(false);
-
// set F1 help
PlatformUI.getWorkbench().getHelpSystem().setHelp(tableViewer.getControl(), IHelpContextIds.PROPERTIES_VIEW);
@@ -403,7 +418,6 @@
}
}
});
-
}
/**
@@ -424,6 +438,21 @@
manager.add(action);
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+
+ IStructuredSelection selection = (IStructuredSelection)tableViewer.getSelection();
+ if (!selection.isEmpty()) {
+ action = getSavePropertyAction();
+ if (selection.size() != 1)
+ action.setEnabled(false);
+ manager.add(action);
+
+ manager.add(getDeletePropertyAction());
+
+ action = getModifyPropertyAction();
+ if (selection.size() != 1)
+ action.setEnabled(false);
+ manager.add(action);
+ }
}
/**
@@ -503,19 +532,6 @@
}
}
- /**
- * Shows the properties for the given resource
- */
- public void showSvnProperties(ISVNLocalResource resource) throws SVNException {
- this.resource = resource;
- if (resource != null) {
- setContentDescription(Policy.bind("SvnPropertiesView.titleWithArgument", resource.getName())); //$NON-NLS-1$
- } else {
- setContentDescription(""); //$NON-NLS-1$
- }
- refresh();
- }
-
private ISVNProperty[] getSvnProperties() throws SVNException {
if(resource == null) {
@@ -529,5 +545,4 @@
}
}
}
-
}