Commit 5bb1e063 authored by Adrien's avatar Adrien Committed by Romain Bioteau

feat(explorer) remove set as active orga popup menu (#1536)

* It can only be done from the deploy popup menu, to ensure consistency
parent efb089e6
......@@ -6,12 +6,10 @@
</elements>
<elements xsi:type="commands:Command" xmi:id="_tLmfcJbPEeew-Jqtlwxc8Q" elementId="org.bonitasoft.studio.organization.manage" commandName="%manageOrganization_Label"/>
<elements xsi:type="commands:Command" xmi:id="_bOsOIJb0Eeew-Jqtlwxc8Q" elementId="org.bonitasoft.studio.actors.import" commandName="%import_Label"/>
<elements xsi:type="commands:Command" xmi:id="_f5ZhgPxdEeicTeF1RHOGZw" elementId="org.bonitasoft.studio.organization.setAsActive" commandName="%setAsActiveOrganization"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_9OWy0JPZEeefAocV7_rPmw" featurename="handlers" parentElementId="org.eclipse.e4.legacy.ide.application">
<elements xsi:type="commands:Handler" xmi:id="_AM0IAJPaEeefAocV7_rPmw" elementId="org.bonitasoft.studio.organization.publish.handler" contributionURI="bundleclass://org.bonitasoft.studio.actors/org.bonitasoft.studio.actors.ui.handler.DeployOrganizationHandler" command="_3qAZcJPZEeefAocV7_rPmw"/>
<elements xsi:type="commands:Handler" xmi:id="_uqPnsJbPEeew-Jqtlwxc8Q" elementId="org.bonitasoft.studio.organization.manage.handler" contributionURI="bundleclass://org.bonitasoft.studio.actors/org.bonitasoft.studio.actors.ui.handler.ManageOrganizationHandler" command="_tLmfcJbPEeew-Jqtlwxc8Q"/>
<elements xsi:type="commands:Handler" xmi:id="_cpyTIJb0Eeew-Jqtlwxc8Q" elementId="org.bonitasoft.studio.actors.import.handler" contributionURI="bundleclass://org.bonitasoft.studio.actors/org.bonitasoft.studio.actors.ui.handler.ImportOrganizationHandler" command="_bOsOIJb0Eeew-Jqtlwxc8Q"/>
<elements xsi:type="commands:Handler" xmi:id="_nl-LoPxdEeicTeF1RHOGZw" elementId="org.bonitasoft.studio.organization.setAsActive.handler" contributionURI="bundleclass://org.bonitasoft.studio.actors/org.bonitasoft.studio.actors.ui.handler.SetAsActiveOrganizationHandler" command="_f5ZhgPxdEeicTeF1RHOGZw"/>
</fragments>
</fragment:ModelFragments>
......@@ -188,22 +188,6 @@
</visibleWhen>
</command>
</menuContribution>
<menuContribution
allPopups="false"
locationURI="popup:org.bonitasoft.studio.application.project.explorer?after=additions">
<command
commandId="org.bonitasoft.studio.organization.setAsActive"
mnemonic="A"
style="push">
<visibleWhen
checkEnabled="true">
</visibleWhen>
</command>
<separator
name="org.bonitasoft.studio.actors.separator1"
visible="true">
</separator>
</menuContribution>
</extension>
<extension
point="org.eclipse.ui.commands">
......
......@@ -35,6 +35,7 @@ import org.bonitasoft.studio.actors.validator.OrganizationValidator;
import org.bonitasoft.studio.common.log.BonitaStudioLog;
import org.bonitasoft.studio.common.repository.RepositoryAccessor;
import org.bonitasoft.studio.common.repository.core.ActiveOrganizationProvider;
import org.bonitasoft.studio.common.repository.filestore.AbstractFileStore;
import org.bonitasoft.studio.ui.dialog.ExceptionDialogHandler;
import org.bonitasoft.studio.ui.dialog.MultiStatusDialog;
import org.bonitasoft.studio.ui.wizard.WizardBuilder;
......@@ -138,6 +139,7 @@ public class DeployOrganizationHandler {
final Parameterization p = new Parameterization(cmd.getParameter("artifact"), fileStore.getName());
handlerService.executeCommand(new ParameterizedCommand(cmd, new Parameterization[] { p }), null);
activeOrganizationProvider.saveActiveOrganization(fileStore.getDisplayName());
AbstractFileStore.refreshExplorerView();
} catch (final Exception e) {
throw new InvocationTargetException(e);
}
......
/*******************************************************************************
* Copyright (C) 2018 BonitaSoft S.A.
* BonitaSoft is a trademark of BonitaSoft SA.
* This software file is BONITASOFT CONFIDENTIAL. Not For Distribution.
* For commercial licensing information, contact:
* BonitaSoft, 32 rue Gustave Eiffel – 38000 Grenoble
* or BonitaSoft US, 51 Federal Street, Suite 305, San Francisco, CA 94107
*******************************************************************************/
package org.bonitasoft.studio.actors.ui.handler;
import org.bonitasoft.studio.actors.repository.OrganizationFileStore;
import org.bonitasoft.studio.common.repository.RepositoryAccessor;
import org.bonitasoft.studio.common.repository.core.ActiveOrganizationProvider;
import org.bonitasoft.studio.common.repository.filestore.AbstractFileStore;
import org.bonitasoft.studio.common.repository.filestore.FileStoreFinder;
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
public class SetAsActiveOrganizationHandler {
private FileStoreFinder fileStoreFinder;
private ActiveOrganizationProvider activeOrganizationProvider;
public SetAsActiveOrganizationHandler() {
fileStoreFinder = new FileStoreFinder();
activeOrganizationProvider = new ActiveOrganizationProvider();
}
@Execute
public void execute(RepositoryAccessor repositoryAccessor) {
fileStoreFinder.findSelectedFileStore(repositoryAccessor.getCurrentRepository())
.filter(OrganizationFileStore.class::isInstance)
.map(OrganizationFileStore.class::cast)
.ifPresent(orga -> {
activeOrganizationProvider.saveActiveOrganization(orga.getContent().getName());
AbstractFileStore.refreshExplorerView();
});
}
@CanExecute
public boolean canExecute(RepositoryAccessor repositoryAccessor) {
return fileStoreFinder.findSelectedFileStore(repositoryAccessor.getCurrentRepository())
.filter(OrganizationFileStore.class::isInstance)
.isPresent();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment