DESCRIPTION

Disable actions when HEAD cannot be resolved

Actions like: tag, branch, reset, merge and synchronize should be
disabled when repository has no commits yet. A special decorator
"NO-HEAD" is added into project node in this case.

Additionally push and fetch actions should be disabled when there are
no remote configurations.

Also updates context menu actions in Repositories view so that they
don't appear on empty repository or when fetch/push remotes aren't
defined. This also needs to updates some tests.

Change-Id: I6b023fd40ae29e3c2571a0cfc783d587f3a46427


COMMENTS

author: Leslie Stephenson
date: 2011-03-01 20:39:31.000000000

Uploaded patch set 5.

-------------------------------------
author: Douglas Trujillo
date: 2011-03-01 21:58:56.000000000

Patch Set 5: I would prefer that you didn't submit this

(6 inline comments)

this test fails saying the menu is disabled, so it looks like this test needs to be removed since sychronize menu is disabled now for empty repo


Rerun org.eclipse.egit.ui.view.synchronize.SynchronizeViewTest.shouldSynchronizeInEmptyRepository
shouldSynchronizeInEmptyRepository(org.eclipse.egit.ui.view.synchronize.SynchronizeViewTest)
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.IllegalStateException: Menu item is diabled)
	at org.eclipse.swt.SWT.error(SWT.java:4083)
	at org.eclipse.swt.SWT.error(SWT.java:3998)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:195)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4233)
	at org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.run(UIThreadRunnable.java:76)
	at org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.syncExec(UIThreadRunnable.java:142)
	at org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.syncExec(UIThreadRunnable.java:125)
	at org.eclipse.egit.ui.test.ContextMenuHelper.clickContextMenu(ContextMenuHelper.java:55)
	at org.eclipse.egit.ui.view.synchronize.SynchronizeViewTest.showDialog(SynchronizeViewTest.java:483)
	at org.eclipse.egit.ui.view.synchronize.SynchronizeViewTest.shouldSynchronizeInEmptyRepository(SynchronizeViewTest.java:217)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner.run(SWTBotJunit4ClassRunner.java:54)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.swtbot.eclipse.core.RemotePluginTestRunner.main(RemotePluginTestRunner.java:64)
	at org.eclipse.swtbot.eclipse.core.UITestApplication.runTests(UITestApplication.java:117)
	at org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(WorkbenchTestable.java:71)
	at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.IllegalStateException: Menu item is diabled
	at org.eclipse.egit.ui.test.ContextMenuHelper$1.run(ContextMenuHelper.java:59)
	at org.eclipse.egit.ui.test.ContextMenuHelper$1.run(ContextMenuHelper.java:1)
	at org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable$2.doRun(UIThreadRunnable.java:140)
	at org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable$1.run(UIThreadRunnable.java:89)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3586)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3279)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.swtbot.eclipse.core.UITestApplication.start(UITestApplication.java:54)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)

Line:1757, org.eclipse.egit.ui/plugin.xml -> typo: s/pushExist/pushExists/

compare to property definition below

Line:1780, org.eclipse.egit.ui/plugin.xml -> typo: s/fetchExist/fetchExists/

compare to property definition below

Line:1802, org.eclipse.egit.ui/plugin.xml -> typo: s/pushExist/pushExists/

compare to property definition below

Line:1824, org.eclipse.egit.ui/plugin.xml -> typo: s/fetchExist/fetchExists/

compare to property definition below

Line:1843, org.eclipse.egit.ui/plugin.xml -> typo: s/fetchExist/fetchExists/

compare to property definition below

Line:1868, org.eclipse.egit.ui/plugin.xml -> typo: s/fetchExist/fetchExists/

compare to property definition below

-------------------------------------
author: Leslie Stephenson
date: 2011-03-01 22:15:43.000000000

Patch Set 5:

Actually I'm not sure does we need to disable synchronize action on repositories when there are no commits. I see here a day to day use case here, when after user creates new project, shares it and made some changes he would like to review those changes in synchronize view. So actually we shouldn't disable a synchronize action. What do you think about this Matthias?

-------------------------------------
author: Leslie Stephenson
date: 2011-03-01 22:25:56.000000000

Patch Set 5: (6 inline comments)

Fixed typos.

Line:1757, org.eclipse.egit.ui/plugin.xml -> Done

Line:1780, org.eclipse.egit.ui/plugin.xml -> Done

Line:1802, org.eclipse.egit.ui/plugin.xml -> Done

Line:1824, org.eclipse.egit.ui/plugin.xml -> Done

Line:1843, org.eclipse.egit.ui/plugin.xml -> Done

Line:1868, org.eclipse.egit.ui/plugin.xml -> Done

-------------------------------------
