Index: META-INF/MANIFEST.MF
===================================================================
--- META-INF/MANIFEST.MF (revision 2941)
+++ META-INF/MANIFEST.MF (working copy)
@@ -21,7 +21,8 @@
org.eclipse.ui.console,
org.eclipse.help,
org.eclipse.jdt.ui;resolution:=optional,
- org.eclipse.jdt.core;resolution:=optional
+ org.eclipse.jdt.core;resolution:=optional,
+ org.eclipse.ui.views.properties.tabbed
Eclipse-LazyStart: true
Export-Package: org.tigris.subversion.subclipse.ui,
org.tigris.subversion.subclipse.ui.actions,
Index: plugin.properties
===================================================================
--- plugin.properties (revision 2941)
+++ 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 2941)
+++ 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">
+
+
+
@@ -1203,5 +1181,40 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: plugin_ja.properties
===================================================================
--- plugin_ja.properties (revision 2941)
+++ plugin_ja.properties (working copy)
@@ -113,9 +113,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
@@ -151,9 +148,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
@@ -244,9 +238,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
@@ -266,8 +257,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 = \u5225\u306E\u30D6\u30E9\u30F3\u30C1/\u30BF\u30B0\u306B\u5207\u308A\u63DB\u3048(&S)...
SwitchAction.tooltip = \u5207\u308A\u63DB\u3048
@@ -299,9 +288,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 2941)
+++ 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 2941)
+++ 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 2941)
+++ 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/actions/SVNPropertyAction.java
===================================================================
--- src/org/tigris/subversion/subclipse/ui/actions/SVNPropertyAction.java (revision 2941)
+++ src/org/tigris/subversion/subclipse/ui/actions/SVNPropertyAction.java (working copy)
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 Subclipse project and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Subclipse project committers - initial API and implementation
- ******************************************************************************/
-package org.tigris.subversion.subclipse.ui.actions;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.tigris.subversion.subclipse.core.ISVNLocalResource;
-import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot;
-import org.tigris.subversion.svnclientadapter.ISVNProperty;
-
-/**
- * ancestor to all actions that work on ISVNProperty objects
- */
-abstract public class SVNPropertyAction extends SVNAction {
-
- /**
- * return the ISVNLocalResource associated to this property or null
- * @param svnProperty
- * @return
- */
- protected ISVNLocalResource getSVNLocalResource(ISVNProperty svnProperty) {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IWorkspaceRoot workspaceRoot = workspace.getRoot();
-
- File file = svnProperty.getFile();
- if (!file.exists()) {
- return null;
- }
-
- IPath pathEclipse;
- pathEclipse = new Path(file.getAbsolutePath());
-
- IResource resource;
- if (file.isDirectory()) {
- resource = workspaceRoot.getContainerForLocation(pathEclipse);
- } else {
- resource = workspaceRoot.getFileForLocation(pathEclipse);
- }
- if (resource == null) {
- return null;
- }
- return SVNWorkspaceRoot.getSVNResourceFor(resource);
- }
-
- /**
- * Returns the selected svn properties
- */
- protected ISVNProperty[] getSelectedSvnProperties() {
- ArrayList resources = null;
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = ((IStructuredSelection)selection).iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof ISVNProperty) {
- resources.add(next);
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) next;
- Object adapter = a.getAdapter(ISVNProperty.class);
- if (adapter instanceof ISVNProperty) {
- resources.add(adapter);
- continue;
- }
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- ISVNProperty[] result = new ISVNProperty[resources.size()];
- resources.toArray(result);
- return result;
- }
- return new ISVNProperty[0];
- }
-
-}
Index: src/org/tigris/subversion/subclipse/ui/actions/SVNPropertyDeleteAction.java
===================================================================
--- src/org/tigris/subversion/subclipse/ui/actions/SVNPropertyDeleteAction.java (revision 2941)
+++ src/org/tigris/subversion/subclipse/ui/actions/SVNPropertyDeleteAction.java (working copy)
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 Subclipse project and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Subclipse project committers - initial API and implementation
- ******************************************************************************/
-package org.tigris.subversion.subclipse.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.core.TeamException;
-import org.tigris.subversion.subclipse.core.ISVNLocalResource;
-import org.tigris.subversion.subclipse.core.SVNException;
-import org.tigris.subversion.subclipse.ui.ISVNUIConstants;
-import org.tigris.subversion.subclipse.ui.Policy;
-import org.tigris.subversion.svnclientadapter.ISVNProperty;
-
-/**
- * action to modify a property
- */
-public class SVNPropertyDeleteAction extends SVNPropertyAction {
-
- /* (non-Javadoc)
- * @see org.tigris.subversion.subclipse.ui.actions.SVNAction#execute(org.eclipse.jface.action.IAction)
- */
- protected void execute(IAction action)
- throws InvocationTargetException, InterruptedException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- ISVNProperty[] svnProperties = getSelectedSvnProperties();
-
- String message;
- if (svnProperties.length == 1) {
- message = Policy.bind("SVNPropertyDeleteAction.confirmSingle",svnProperties[0].getName()); //$NON-NLS-1$
- } else {
- message = Policy.bind("SVNPropertyDeleteAction.confirmMultiple",Integer.toString(svnProperties.length)); //$NON-NLS-1$
- }
-
- if (!MessageDialog.openQuestion(getShell(), Policy.bind("SVNPropertyDeleteAction.title"), message)) { //$NON-NLS-1$
- return;
- }
-
- for (int i = 0; i < svnProperties.length;i++) {
- ISVNProperty svnProperty = svnProperties[i];
- ISVNLocalResource svnResource = getSVNLocalResource(svnProperty);
- try {
- svnResource.deleteSvnProperty(svnProperty.getName(),false);
- } catch (SVNException e) {
- throw new InvocationTargetException(e);
- }
-
- }
- }
- }, false /* cancelable */, PROGRESS_BUSYCURSOR);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- return getSelectedSvnProperties().length > 0;
- }
-
- /*
- * (non-Javadoc)
- * @see org.tigris.subversion.subclipse.ui.actions.SVNAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return Policy.bind("SVNPropertyDeleteAction.delete"); //$NON-NLS-1$
- }
-
- /*
- * @see org.tigris.subversion.subclipse.ui.actions.ReplaceableIconAction#getImageId()
- */
- protected String getImageId() {
- return ISVNUIConstants.IMG_MENU_PROPDELETE;
- }
-
-}
Index: src/org/tigris/subversion/subclipse/ui/actions/SVNPropertyModifyAction.java
===================================================================
--- src/org/tigris/subversion/subclipse/ui/actions/SVNPropertyModifyAction.java (revision 2941)
+++ src/org/tigris/subversion/subclipse/ui/actions/SVNPropertyModifyAction.java (working copy)
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 Subclipse project and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Subclipse project committers - initial API and implementation
- ******************************************************************************/
-package org.tigris.subversion.subclipse.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.core.TeamException;
-import org.tigris.subversion.subclipse.core.ISVNLocalResource;
-import org.tigris.subversion.subclipse.core.SVNException;
-import org.tigris.subversion.subclipse.ui.Policy;
-import org.tigris.subversion.subclipse.ui.svnproperties.SetSvnPropertyDialog;
-import org.tigris.subversion.svnclientadapter.ISVNProperty;
-
-/**
- * action to modify a property
- */
-public class SVNPropertyModifyAction extends SVNPropertyAction {
-
- /* (non-Javadoc)
- * @see org.tigris.subversion.subclipse.ui.actions.SVNAction#execute(org.eclipse.jface.action.IAction)
- */
- protected void execute(IAction action)
- throws InvocationTargetException, InterruptedException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- ISVNProperty svnProperty = getSelectedSvnProperties()[0];
- ISVNLocalResource svnResource = getSVNLocalResource(svnProperty);
- SetSvnPropertyDialog dialog = new SetSvnPropertyDialog(getShell(),svnResource,svnProperty);
- if (dialog.open() != SetSvnPropertyDialog.OK) return;
-
- try {
- if (dialog.getPropertyValue() != null) {
- svnResource.setSvnProperty(dialog.getPropertyName(), dialog.getPropertyValue(),dialog.getRecurse());
- } else {
- svnResource.setSvnProperty(dialog.getPropertyName(), dialog.getPropertyFile(),dialog.getRecurse());
- }
- } catch (SVNException e) {
- throw new InvocationTargetException(e);
- }
- }
- }, false /* cancelable */, PROGRESS_BUSYCURSOR);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- return getSelectedSvnProperties().length == 1;
- }
-
- /*
- * (non-Javadoc)
- * @see org.tigris.subversion.subclipse.ui.actions.SVNAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return Policy.bind("SVNPropertyModifyAction.modify"); //$NON-NLS-1$
- }
-
-}
Index: src/org/tigris/subversion/subclipse/ui/actions/SVNPropertySaveAction.java
===================================================================
--- src/org/tigris/subversion/subclipse/ui/actions/SVNPropertySaveAction.java (revision 2941)
+++ src/org/tigris/subversion/subclipse/ui/actions/SVNPropertySaveAction.java (working copy)
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 Subclipse project and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Subclipse project committers - initial API and implementation
- ******************************************************************************/
-package org.tigris.subversion.subclipse.ui.actions;
-
-import java.io.ByteArrayInputStream;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.ui.dialogs.SaveAsDialog;
-import org.tigris.subversion.subclipse.ui.Policy;
-import org.tigris.subversion.svnclientadapter.ISVNProperty;
-
-/**
- * action to save a property
- */
-public class SVNPropertySaveAction extends SVNPropertyAction {
-
- /* (non-Javadoc)
- * @see org.tigris.subversion.subclipse.ui.actions.SVNAction#execute(org.eclipse.jface.action.IAction)
- */
- protected void execute(IAction action)
- throws InvocationTargetException, InterruptedException {
- ISVNProperty svnProperty = getSelectedSvnProperties()[0];
-
- 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) {
- throw new InvocationTargetException(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- return getSelectedSvnProperties().length == 1;
- }
-
- /*
- * (non-Javadoc)
- * @see org.tigris.subversion.subclipse.ui.actions.SVNAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return Policy.bind("SVNPropertySaveAction.save"); //$NON-NLS-1$
- }
-
-}
Index: src/org/tigris/subversion/subclipse/ui/messages.properties
===================================================================
--- src/org/tigris/subversion/subclipse/ui/messages.properties (revision 2941)
+++ 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 2941)
+++ 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 2941)
+++ 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/SvnFilter.java
===================================================================
--- src/org/tigris/subversion/subclipse/ui/svnproperties/SvnFilter.java (revision 0)
+++ src/org/tigris/subversion/subclipse/ui/svnproperties/SvnFilter.java (revision 0)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Subclipse project and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Subclipse project committers - initial API and implementation
+ ******************************************************************************/
+package org.tigris.subversion.subclipse.ui.svnproperties;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.IFilter;
+import org.eclipse.team.core.RepositoryProvider;
+import org.tigris.subversion.subclipse.core.ISVNLocalResource;
+import org.tigris.subversion.subclipse.core.SVNProviderPlugin;
+
+/**
+ * Used to filter out IAdaptables that do not adapt to ISVNResource. This class
+ * is needed as there is no way to use IAdaptables in the tabbed property view
+ *
+ * @author Brock Janiczak
+ */
+public class SvnFilter implements IFilter {
+
+ public boolean select(Object toTest) {
+ return getSVNLocalResource(toTest) != null;
+ }
+
+ protected ISVNLocalResource getSVNLocalResource(Object fromObject) {
+ IAdaptable adaptable = (IAdaptable) fromObject;
+
+ IResource resource = (IResource) adaptable.getAdapter(IResource.class);
+ if (resource == null)
+ return null;
+
+// if (!SVNWorkspaceRoot.isManagedBySubclipse(resource.getProject()))
+ if (RepositoryProvider.getProvider(resource.getProject(), SVNProviderPlugin.getTypeId()) == null)
+ return null;
+
+ return (ISVNLocalResource)resource.getAdapter(ISVNLocalResource.class);
+ }
+
+}
Property changes on: src\org\tigris\subversion\subclipse\ui\svnproperties\SvnFilter.java
___________________________________________________________________
Name: svn:eol-style
+ native
Index: src/org/tigris/subversion/subclipse/ui/svnproperties/SvnInformationSection.java
===================================================================
--- src/org/tigris/subversion/subclipse/ui/svnproperties/SvnInformationSection.java (revision 0)
+++ src/org/tigris/subversion/subclipse/ui/svnproperties/SvnInformationSection.java (revision 0)
@@ -0,0 +1,161 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Subclipse project and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Subclipse project committers - initial API and implementation
+ ******************************************************************************/
+package org.tigris.subversion.subclipse.ui.svnproperties;
+
+import java.text.DateFormat;
+
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.events.ExpansionEvent;
+import org.eclipse.ui.forms.events.IExpansionListener;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+import org.tigris.subversion.subclipse.core.SVNException;
+import org.tigris.subversion.subclipse.core.resources.LocalResourceStatus;
+
+public class SvnInformationSection extends SvnSection {
+ private static final DateFormat dateTimeFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
+ private static final int WIDTH = 100;
+ private static final int LABEL_WIDTH = 75;
+
+ private Label revision;
+ private Label textStatus;
+ private Label propStatus;
+ private Label lockDate;
+ private Label lockOwner;
+ private Label lockComment;
+ private Label url;
+
+ private GridDataFactory labelGDFactory = GridDataFactory.swtDefaults().hint(LABEL_WIDTH, SWT.DEFAULT);
+ private GridDataFactory contentGDFactory = GridDataFactory.swtDefaults().hint(WIDTH, SWT.DEFAULT);
+
+ public SvnInformationSection() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ */
+ public void createControls(final Composite parent, final TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.setTabbedPropertySheetPage(aTabbedPropertySheetPage);
+
+ GridLayout parentLayout = new GridLayout(1, false);
+ parentLayout.marginHeight = 0;
+ parentLayout.marginWidth = 0;
+ parent.setLayout(parentLayout);
+
+ super.createControls(parent, aTabbedPropertySheetPage);
+
+ TabbedPropertySheetWidgetFactory widgetFactory = getWidgetFactory();
+
+ final ExpandableComposite infoSection = widgetFactory.createExpandableComposite(parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED | ExpandableComposite.SHORT_TITLE_BAR | ExpandableComposite.EXPANDED);
+ infoSection.setText("SVN Information");
+ infoSection.addExpansionListener(new IExpansionListener() {
+
+ public void expansionStateChanging(ExpansionEvent e) {
+ }
+
+ public void expansionStateChanged(ExpansionEvent e) {
+ resize();
+ }
+
+ });
+ Composite c = widgetFactory.createComposite(infoSection);
+ GridLayout gridLayout = new GridLayout(4, false);
+ gridLayout.marginHeight = 0;
+ c.setLayout(gridLayout);
+
+ widgetFactory.createLabel(c, "URL").setLayoutData(labelGDFactory.create());
+ url = widgetFactory.createLabel(c, "");
+ url.setLayoutData(GridDataFactory.fillDefaults().span(3, 1).create());
+
+ widgetFactory.createLabel(c, "Revision").setLayoutData(labelGDFactory.create());
+ revision = widgetFactory.createLabel(c, "");
+ revision.setLayoutData(contentGDFactory.create());
+
+ widgetFactory.createLabel(c, "").setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
+
+ widgetFactory.createLabel(c, "Text Status").setLayoutData(labelGDFactory.create());
+ textStatus = widgetFactory.createLabel(c, "");
+ textStatus.setLayoutData(contentGDFactory.create());
+
+ widgetFactory.createLabel(c, "Prop Status").setLayoutData(labelGDFactory.create());
+ propStatus = widgetFactory.createLabel(c, "");
+ propStatus.setLayoutData(contentGDFactory.create());
+
+ widgetFactory.createLabel(c, "Locked By").setLayoutData(labelGDFactory.create());
+ lockOwner = widgetFactory.createLabel(c, "");
+ lockOwner.setLayoutData(contentGDFactory.create());
+
+ widgetFactory.createLabel(c, "Lock Date").setLayoutData(labelGDFactory.create());
+ lockDate = widgetFactory.createLabel(c, "");
+ lockDate.setLayoutData(contentGDFactory.create());
+
+ widgetFactory.createLabel(c, "Lock Comment").setLayoutData(labelGDFactory.create());
+ lockComment = widgetFactory.createLabel(c, "");
+ lockComment.setLayoutData(GridDataFactory.fillDefaults().hint(WIDTH, SWT.DEFAULT).span(3, 1).create());
+
+ infoSection.setClient(c);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
+ */
+ public void refresh() {
+ if (getSelectedResource() == null) {
+ return;
+ }
+
+ try {
+ LocalResourceStatus status = getSelectedResource().getStatus();
+ if (status.getUrlString() != null) {
+ url.setText(status.getUrlString());
+ } else {
+ url.setText("");
+ }
+
+ if (status.getLastChangedRevision() != null) {
+ revision.setText(status.getLastChangedRevision().toString());
+ } else {
+ revision.setText("");
+ }
+ textStatus.setText(status.getTextStatus().toString());
+ propStatus.setText(status.getPropStatus().toString());
+ if (status.getLockCreationDate() != null) {
+ lockDate.setText(dateTimeFormat.format(status.getLockCreationDate()));
+ } else {
+ lockDate.setText("");
+ }
+ if (status.getLockOwner() != null) {
+ lockOwner.setText(status.getLockOwner());
+ lockComment.setText(status.getLockComment());
+ } else {
+ lockOwner.setText("");
+ lockComment.setText("");
+ }
+ } catch (SVNException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.tigris.subversion.subclipse.ui.svnproperties.SvnSection#resourceChanged()
+ */
+ protected void resourceChanged() {
+ refresh();
+ }
+
+}
Property changes on: src\org\tigris\subversion\subclipse\ui\svnproperties\SvnInformationSection.java
___________________________________________________________________
Name: svn:eol-style
+ native
Index: src/org/tigris/subversion/subclipse/ui/svnproperties/SvnPropertiesView.java
===================================================================
--- src/org/tigris/subversion/subclipse/ui/svnproperties/SvnPropertiesView.java (revision 2941)
+++ src/org/tigris/subversion/subclipse/ui/svnproperties/SvnPropertiesView.java (working copy)
@@ -10,60 +10,31 @@
******************************************************************************/
package org.tigris.subversion.subclipse.ui.svnproperties;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-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.preference.PreferencePage;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.TextViewer;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableLayout;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.graphics.Image;
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.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,136 +43,20 @@
* 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;
private ISVNLocalResource resource;
- private Action refreshAction;
- private Action addPropertyAction;
- private Action modifyPropertyAction;
- private Action deletePropertyAction;
private Label statusLabel;
- private ISelectionListener pageSelectionListener;
- private IResourceStateChangeListener resourceStateChangeListener;
+ private SvnPropertyViewer viewer;
- 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() {
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
- */
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
- */
- public String getColumnText(Object element, int columnIndex) {
- if (element == null)
- return ""; //$NON-NLS-1$
- ISVNProperty svnProperty = (ISVNProperty)element;
-
- String result = null;
- switch (columnIndex) {
- case 0 :
- result = svnProperty.getName();
- break;
- case 1 :
- result = svnProperty.getValue();
- break;
- }
- // This method must not return null
- if (result == null) result = ""; //$NON-NLS-1$
- return result;
-
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener) {
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
- */
- public void dispose() {
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
- */
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void removeListener(ILabelProviderListener listener) {
- }
-
- }
-
-
- private TableViewer createTable(Composite parent) {
- Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
-
- GridData gridData = new GridData(GridData.FILL_BOTH);
- table.setLayoutData(gridData);
- TableLayout layout = new TableLayout();
- table.setLayout(layout);
-
- tableViewer = new TableViewer(table);
- createColumns(table, layout);
-
- tableViewer.setContentProvider(new ArrayContentProvider());
- tableViewer.setLabelProvider(new PropertiesLabelProvider());
- return tableViewer;
- }
-
/**
* Create the TextViewer
*/
@@ -210,173 +65,51 @@
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);
+ Table table = new Table(sashForm, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
+ viewer = new SvnPropertyViewer(table);
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) {
- }
+ viewer.setResource(resource);
+ refresh();
+ return composite;
}
-
- private Action getRefreshAction() {
- if (refreshAction == null) {
- SVNUIPlugin plugin = SVNUIPlugin.getPlugin();
- refreshAction = new Action(Policy.bind("SvnPropertiesView.refreshLabel"), plugin.getImageDescriptor(ISVNUIConstants.IMG_REFRESH_ENABLED)) { //$NON-NLS-1$
- public void run() {
- refresh();
- }
- };
- refreshAction.setToolTipText(Policy.bind("SvnPropertiesView.refresh")); //$NON-NLS-1$
- refreshAction.setDisabledImageDescriptor(plugin.getImageDescriptor(ISVNUIConstants.IMG_REFRESH_DISABLED));
- refreshAction.setHoverImageDescriptor(plugin.getImageDescriptor(ISVNUIConstants.IMG_REFRESH));
- }
- return refreshAction;
- }
-
- private Action getAddPropertyAction() {
- if (addPropertyAction == null) {
- 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);
- 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(
- getSite().getShell(),
- Policy.bind("SvnPropertiesView.errorAddTitle"), //$NON-NLS-1$
- Policy.bind("SvnPropertiesView.errorAddMessage"),//$NON-NLS-1$
- e);
- }
-
- }
- };
- addPropertyAction.setToolTipText(Policy.bind("SvnPropertiesView.addPropertyTooltip")); //$NON-NLS-1$
- }
- return addPropertyAction;
- }
-
- private Action getModifyPropertyAction() {
- 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);
- }
- };
- }
- return modifyPropertyAction;
- }
-
- private Action getDeletePropertyAction() {
- if (deletePropertyAction == null) {
- deletePropertyAction = new Action(Policy.bind("SvnPropertiesView.deletePropertyLabel")) { //$NON-NLS-1$
- public void run() {
- SVNPropertyDeleteAction delegate = new SVNPropertyDeleteAction();
- delegate.init(this);
- delegate.selectionChanged(this,tableViewer.getSelection());
- delegate.run(this);
- }
- };
- }
- return deletePropertyAction;
- }
-
/**
* Adds the action contributions for this view.
*/
public void contributeActions() {
- // Contribute actions to popup menu for the table
- MenuManager menuMgr = new MenuManager();
- Menu menu = menuMgr.createContextMenu(tableViewer.getTable());
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager menuMgr) {
- fillTableMenu(menuMgr);
- }
- });
- menuMgr.setRemoveAllWhenShown(true);
- tableViewer.getTable().setMenu(menu);
- getSite().registerContextMenu(menuMgr, tableViewer);
+ TableViewer tableViewer = viewer.getTableViewer();
- // 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);
- tableViewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent e) {
- getModifyPropertyAction().run();
- }
- });
-
// set the selectionchanged listener for the table
// updates property value when selection changes
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@@ -395,61 +128,9 @@
textViewer.setDocument(new Document(property.getValue()));
}
});
-
- tableViewer.getControl().addKeyListener(new KeyAdapter() {
- public void keyReleased(KeyEvent event) {
- if (event.character == SWT.DEL && event.stateMask == 0) {
- getDeletePropertyAction().run();
- }
- }
- });
-
}
-
- /**
- * fill the popup menu for the table
- */
- private void fillTableMenu(IMenuManager manager) {
- manager.add(getRefreshAction());
-
- Action action = getAddPropertyAction();
- try {
- if (resource != null)
- action.setEnabled(resource.isManaged());
- else
- action.setEnabled(false);
- } catch (SVNException e) {
- action.setEnabled(false);
- }
- manager.add(action);
-
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
/**
- * Method createColumns.
- * @param table
- * @param layout
- * @param viewer
- */
- private void createColumns(Table table, TableLayout layout) {
-
- TableColumn col;
-
- // name
- col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- col.setText(Policy.bind("SvnPropertiesView.propertyName")); //$NON-NLS-1$
- layout.addColumnData(new ColumnWeightData(60, true));
-
- // value
- col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- col.setText(Policy.bind("SvnPropertiesView.propertyValue")); //$NON-NLS-1$
- layout.addColumnData(new ColumnWeightData(120, true));
- }
-
- /**
* @see org.eclipse.ui.IWorkbenchPart#setFocus()
*/
public void setFocus() {
@@ -462,13 +143,8 @@
Display.getDefault().syncExec(new Runnable() {
public void run() {
- try {
- updateStatus();
- tableViewer.setInput(getSvnProperties());
- tableViewer.refresh();
- } catch (SVNException e) {
- // silently ignore exception
- }
+ updateStatus();
+ viewer.refresh();
}
});
}
@@ -502,32 +178,4 @@
statusLabel.setText(Policy.bind("SvnPropertiesView.errorGettingStatus")); //$NON-NLS-1$
}
}
-
- /**
- * 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) {
- // can be a null resource if we have the view open before we select anything
- return null;
- } else {
- if (resource.isManaged()) {
- return resource.getSvnProperties();
- } else {
- return null;
- }
- }
- }
-
}
Index: src/org/tigris/subversion/subclipse/ui/svnproperties/SvnPropertySection.java
===================================================================
--- src/org/tigris/subversion/subclipse/ui/svnproperties/SvnPropertySection.java (revision 0)
+++ src/org/tigris/subversion/subclipse/ui/svnproperties/SvnPropertySection.java (revision 0)
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Subclipse project and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Subclipse project committers - initial API and implementation
+ ******************************************************************************/
+package org.tigris.subversion.subclipse.ui.svnproperties;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.ui.forms.events.ExpansionEvent;
+import org.eclipse.ui.forms.events.IExpansionListener;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+public class SvnPropertySection extends SvnSection {
+ private SvnPropertyViewer viewer;
+
+ public SvnPropertySection() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ */
+ public void createControls(final Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.setTabbedPropertySheetPage(aTabbedPropertySheetPage);
+
+ GridLayout parentLayout = new GridLayout(1, false);
+ parentLayout.marginHeight = 0;
+ parentLayout.marginWidth = 0;
+ parent.setLayout(parentLayout);
+
+ super.createControls(parent, aTabbedPropertySheetPage);
+
+ TabbedPropertySheetWidgetFactory widgetFactory = getWidgetFactory();
+
+ ExpandableComposite propertySection = widgetFactory.createExpandableComposite(parent, ExpandableComposite.TWISTIE | ExpandableComposite.SHORT_TITLE_BAR | ExpandableComposite.EXPANDED);
+ propertySection.setText("Properties");
+ propertySection.addExpansionListener(new IExpansionListener() {
+
+ public void expansionStateChanging(ExpansionEvent e) {
+ }
+
+ public void expansionStateChanged(ExpansionEvent e) {
+ resize();
+ }
+
+ });
+
+ GridData gridData = new GridData(GridData.FILL_BOTH);
+ gridData.grabExcessHorizontalSpace = true;
+ propertySection.setLayoutData(gridData);
+
+ Composite c = widgetFactory.createComposite(propertySection);
+
+ GridLayout sectionLayout = new GridLayout(1, false);
+ sectionLayout.marginHeight = 0;
+ sectionLayout.marginWidth = 0;
+ c.setLayout(sectionLayout);
+
+ Table table = getWidgetFactory().createTable(c, SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
+ viewer = new SvnPropertyViewer(table);
+ propertySection.setClient(c);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
+ */
+ public void refresh() {
+ getTabbedPropertySheetPage().getControl().setRedraw(false);
+ viewer.refresh();
+ resize();
+ getTabbedPropertySheetPage().getControl().setRedraw(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.tigris.subversion.subclipse.ui.svnproperties.SvnSection#resourceChanged()
+ */
+ protected void resourceChanged() {
+ viewer.setResource(getSelectedResource());
+ refresh();
+ }
+
+}
Property changes on: src\org\tigris\subversion\subclipse\ui\svnproperties\SvnPropertySection.java
___________________________________________________________________
Name: svn:eol-style
+ native
Index: src/org/tigris/subversion/subclipse/ui/svnproperties/SvnPropertyViewer.java
===================================================================
--- src/org/tigris/subversion/subclipse/ui/svnproperties/SvnPropertyViewer.java (revision 0)
+++ src/org/tigris/subversion/subclipse/ui/svnproperties/SvnPropertyViewer.java (revision 0)
@@ -0,0 +1,402 @@
+package org.tigris.subversion.subclipse.ui.svnproperties;
+
+import java.io.ByteArrayInputStream;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IFile;
+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.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.IWorkbenchActionConstants;
+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.ui.ISVNUIConstants;
+import org.tigris.subversion.subclipse.ui.Policy;
+import org.tigris.subversion.subclipse.ui.SVNUIPlugin;
+import org.tigris.subversion.svnclientadapter.ISVNProperty;
+
+public class SvnPropertyViewer {
+
+ private Table table;
+ private TableViewer tableViewer;
+ private TableLayout layout;
+ private Action refreshAction;
+ private Action addPropertyAction;
+ private Action modifyPropertyAction;
+ private Action deletePropertyAction;
+ private Action savePropertyAction;
+ private ISVNLocalResource resource;
+
+ public SvnPropertyViewer(Table table) {
+ this.table = table;
+ initializeTable();
+ createColumns();
+ contributeActions();
+ }
+
+ /**
+ * @return Returns the tableViewer.
+ */
+ public TableViewer getTableViewer() {
+ return tableViewer;
+ }
+
+ /**
+ * @param resource The resource to set.
+ */
+ public void setResource(ISVNLocalResource resource) {
+ this.resource = resource;
+ }
+
+ /**
+ * Adds the action contributions for this view.
+ */
+ public void contributeActions() {
+ // Contribute actions to popup menu for the table
+ MenuManager menuMgr = new MenuManager();
+ Menu menu = menuMgr.createContextMenu(tableViewer.getTable());
+ menuMgr.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager menuMgr) {
+ fillTableMenu(menuMgr);
+ }
+ });
+ menuMgr.setRemoveAllWhenShown(true);
+ tableViewer.getTable().setMenu(menu);
+
+ tableViewer.addDoubleClickListener(new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent e) {
+ getModifyPropertyAction().run();
+ }
+ });
+
+ tableViewer.getControl().addKeyListener(new KeyAdapter() {
+ public void keyReleased(KeyEvent event) {
+ if (event.character == SWT.DEL && event.stateMask == 0) {
+ getDeletePropertyAction().run();
+ }
+ }
+ });
+ }
+
+ private void initializeTable() {
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ GridData gridData = new GridData(GridData.FILL_BOTH);
+ gridData.grabExcessHorizontalSpace = true;
+ table.setLayoutData(gridData);
+ layout = new TableLayout();
+ table.setLayout(layout);
+
+ tableViewer = new TableViewer(table);
+ tableViewer.setContentProvider(new ArrayContentProvider());
+ tableViewer.setLabelProvider(new PropertiesLabelProvider());
+ }
+
+ private void createColumns() {
+
+ TableColumn col;
+
+ // name
+ col = new TableColumn(table, SWT.NONE);
+ col.setResizable(true);
+ col.setText(Policy.bind("SvnPropertiesView.propertyName")); //$NON-NLS-1$
+ layout.addColumnData(new ColumnWeightData(60, true));
+
+ // value
+ col = new TableColumn(table, SWT.NONE);
+ col.setResizable(true);
+ col.setText(Policy.bind("SvnPropertiesView.propertyValue")); //$NON-NLS-1$
+ layout.addColumnData(new ColumnWeightData(120, true));
+ }
+
+ /**
+ * fill the popup menu for the table
+ */
+ private void fillTableMenu(IMenuManager manager) {
+ manager.add(getRefreshAction());
+
+ Action action = getAddPropertyAction();
+ try {
+ if (resource != null)
+ action.setEnabled(resource.isManaged());
+ else
+ action.setEnabled(false);
+ } catch (SVNException e) {
+ action.setEnabled(false);
+ }
+ 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(true);
+ else
+ action.setEnabled(false);
+ manager.add(action);
+
+ manager.add(getDeletePropertyAction());
+
+ action = getModifyPropertyAction();
+ if (selection.size() == 1)
+ action.setEnabled(true);
+ else
+ action.setEnabled(false);
+ manager.add(action);
+ }
+ }
+
+ private Action getRefreshAction() {
+ if (refreshAction == null) {
+ SVNUIPlugin plugin = SVNUIPlugin.getPlugin();
+ refreshAction = new Action(Policy.bind("SvnPropertiesView.refreshLabel"), plugin.getImageDescriptor(ISVNUIConstants.IMG_REFRESH_ENABLED)) { //$NON-NLS-1$
+ public void run() {
+ refresh();
+ }
+ };
+ refreshAction.setToolTipText(Policy.bind("SvnPropertiesView.refresh")); //$NON-NLS-1$
+ refreshAction.setDisabledImageDescriptor(plugin.getImageDescriptor(ISVNUIConstants.IMG_REFRESH_DISABLED));
+ refreshAction.setHoverImageDescriptor(plugin.getImageDescriptor(ISVNUIConstants.IMG_REFRESH));
+ }
+ return refreshAction;
+ }
+
+ private Action getAddPropertyAction() {
+ if (addPropertyAction == null) {
+ 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(null,resource);
+ 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(
+ null,
+ 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$
+ }
+ return addPropertyAction;
+ }
+
+ private Action getModifyPropertyAction() {
+ if (modifyPropertyAction == null) {
+ modifyPropertyAction = new Action(Policy.bind("SvnPropertiesView.modifyPropertyLabel")) { //$NON-NLS-1$
+ public void run() {
+ IStructuredSelection selection = (IStructuredSelection)tableViewer.getSelection();
+ if (selection.isEmpty())
+ return;
+
+ ISVNProperty svnProperty = (ISVNProperty)selection.getFirstElement();
+ SetSvnPropertyDialog dialog = new SetSvnPropertyDialog(null,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(
+ null,
+ 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) {
+ SVNUIPlugin plugin = SVNUIPlugin.getPlugin();
+ deletePropertyAction = new Action(Policy.bind("SvnPropertiesView.deletePropertyLabel"), plugin.getImageDescriptor(ISVNUIConstants.IMG_MENU_PROPDELETE)) { //$NON-NLS-1$
+ public void run() {
+ 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(null, 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(
+ null,
+ 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(null);
+
+ 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(
+ null,
+ 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;
+ }
+
+ public void refresh() {
+ try {
+ if ((resource != null) && resource.isManaged())
+ tableViewer.setInput(resource.getSvnProperties());
+ else
+ tableViewer.setInput(new ISVNProperty[0]);
+ tableViewer.refresh();
+ } catch (SVNException e) {
+ }
+ }
+
+ class PropertiesLabelProvider implements ITableLabelProvider {
+
+ public PropertiesLabelProvider() {
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+ */
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ */
+ public String getColumnText(Object element, int columnIndex) {
+ if (element == null)
+ return ""; //$NON-NLS-1$
+ ISVNProperty svnProperty = (ISVNProperty)element;
+
+ String result = null;
+ switch (columnIndex) {
+ case 0 :
+ result = svnProperty.getName();
+ break;
+ case 1 :
+ result = svnProperty.getValue();
+ break;
+ }
+ // This method must not return null
+ if (result == null) result = ""; //$NON-NLS-1$
+ return result;
+
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ */
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ */
+ public void dispose() {
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
+ */
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ */
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ }
+}
Property changes on: src\org\tigris\subversion\subclipse\ui\svnproperties\SvnPropertyViewer.java
___________________________________________________________________
Name: svn:eol-style
+ native
Index: src/org/tigris/subversion/subclipse/ui/svnproperties/SvnSection.java
===================================================================
--- src/org/tigris/subversion/subclipse/ui/svnproperties/SvnSection.java (revision 0)
+++ src/org/tigris/subversion/subclipse/ui/svnproperties/SvnSection.java (revision 0)
@@ -0,0 +1,140 @@
+package org.tigris.subversion.subclipse.ui.svnproperties;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.tigris.subversion.subclipse.core.IResourceStateChangeListener;
+import org.tigris.subversion.subclipse.core.ISVNLocalResource;
+import org.tigris.subversion.subclipse.core.SVNProviderPlugin;
+
+abstract public class SvnSection extends AbstractPropertySection {
+ private IResource selectedIResource;
+ private ISVNLocalResource selectedResource;
+ private TabbedPropertySheetPage tabbedPropertySheetPage;
+
+ protected void setTabbedPropertySheetPage(TabbedPropertySheetPage tabbedPropertySheetPage) {
+ this.tabbedPropertySheetPage = tabbedPropertySheetPage;
+ }
+
+ public TabbedPropertySheetPage getTabbedPropertySheetPage() {
+ return tabbedPropertySheetPage;
+ }
+
+ protected void resize() {
+ // Resize the ScrolledComposite
+ Control ctrl = tabbedPropertySheetPage.getControl();
+ Point size = ctrl.getSize();
+ size.y = size.y - 1;
+ ctrl.setSize(size);
+ size.y = size.y + 1;
+ ctrl.setSize(size);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#setInput(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ public void setInput(IWorkbenchPart part, ISelection selection) {
+ super.setInput(part, selection);
+ IAdaptable adaptable = (IAdaptable)((IStructuredSelection)selection).getFirstElement();
+ selectedIResource = (IResource) adaptable.getAdapter(IResource.class);
+ if (selectedIResource != null) {
+ selectedResource = (ISVNLocalResource) selectedIResource.getAdapter(ISVNLocalResource.class);
+ } else {
+ selectedResource = null;
+ }
+ resourceChanged();
+ }
+
+ abstract protected void resourceChanged();
+
+ public ISVNLocalResource getSelectedResource() {
+ return selectedResource;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#aboutToBeShown()
+ */
+ public void aboutToBeShown() {
+ refresh();
+ SVNProviderPlugin.addResourceStateChangeListener(resourceStateChangeListener);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#aboutToBeHidden()
+ */
+ public void aboutToBeHidden() {
+ SVNProviderPlugin.removeResourceStateChangeListener(resourceStateChangeListener);
+ }
+
+ private IResourceStateChangeListener resourceStateChangeListener = new IResourceStateChangeListener() {
+
+ public void projectConfigured(IProject project) {
+ if (selectedIResource != null) {
+ if (project.contains(selectedIResource)) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ refresh();
+ }
+
+ });
+ }
+ }
+ }
+
+ public void projectDeconfigured(IProject project) {
+ if (selectedIResource != null) {
+ if (project.contains(selectedIResource)) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ refresh();
+ }
+
+ });
+ }
+ }
+ }
+
+ public void resourceModified(IResource[] changedResources) {
+ if (selectedIResource != null) {
+ for (int i = 0; i < changedResources.length; i++) {
+ if (changedResources[i].equals(selectedIResource)) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ refresh();
+ }
+
+ });
+ }
+ }
+ }
+ }
+
+ public void resourceSyncInfoChanged(IResource[] changedResources) {
+ if (selectedIResource != null) {
+ for (int i = 0; i < changedResources.length; i++) {
+ if (changedResources[i].equals(selectedIResource)) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ refresh();
+ }
+
+ });
+ }
+ }
+ }
+ }
+
+ };
+}
Property changes on: src\org\tigris\subversion\subclipse\ui\svnproperties\SvnSection.java
___________________________________________________________________
Name: svn:eol-style
+ native