Commit 695eb8bb authored by Adrien's avatar Adrien Committed by Romain Bioteau
Browse files

feat(project explorer) create apps from repository (#1354)

closes [BS-18885](https://bonitasoft.atlassian.net/browse/BS-18885)
parent b1a5c7d0
......@@ -415,7 +415,7 @@
</handler>
<handler
class="org.bonitasoft.studio.actors.ui.handler.ManageOrganizationHandler"
commandId="org.bonitasoft.studio.application.new">
commandId="org.bonitasoft.studio.application.newWithWizard">
<activeWhen>
<and>
<count
......
......@@ -415,6 +415,14 @@
visible="true">
</separator>
</menu>
<command
commandId="org.bonitasoft.studio.application.newWithWizard"
mnemonic="w"
style="push">
<visibleWhen
checkEnabled="true">
</visibleWhen>
</command>
<command
commandId="org.bonitasoft.studio.application.new"
mnemonic="w"
......@@ -667,6 +675,10 @@
</command>
<command
id="org.bonitasoft.studio.application.new"
name="%new">
</command>
<command
id="org.bonitasoft.studio.application.newWithWizard"
name="%newWithWizard">
</command>
</extension>
......
......@@ -186,6 +186,22 @@
</and>
</activeWhen>
</handler>
<handler
class="org.bonitasoft.studio.la.application.handler.NewApplicationHandler"
commandId="org.bonitasoft.studio.application.new">
<activeWhen>
<and>
<count
value="1">
</count>
<iterate>
<test
property="org.bonitasoft.studio.la.isApplicationFolder">
</test>
</iterate>
</and>
</activeWhen>
</handler>
</extension>
<extension
point="org.eclipse.core.expressions.propertyTesters">
......
......@@ -38,7 +38,8 @@ Require-Bundle: org.eclipse.jface;bundle-version="3.10.1",
org.eclipse.wst.sse.ui,
org.eclipse.e4.core.commands,
org.eclipse.e4.ui.bindings,
org.bonitasoft.studio.common.repository
org.bonitasoft.studio.common.repository,
org.eclipse.e4.ui.services
Export-Package: org.bonitasoft.studio.ui,
org.bonitasoft.studio.ui.contribution,
org.bonitasoft.studio.ui.converter,
......
......@@ -20,6 +20,8 @@ import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.inject.Named;
import org.bonitasoft.studio.common.repository.RepositoryAccessor;
import org.bonitasoft.studio.common.repository.model.IRepositoryFileStore;
import org.bonitasoft.studio.common.repository.model.IRepositoryStore;
......@@ -27,13 +29,14 @@ import org.bonitasoft.studio.ui.i18n.Messages;
import org.bonitasoft.studio.ui.page.SelectionPage;
import org.bonitasoft.studio.ui.wizard.WizardBuilder;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;
public abstract class DeleteFileHandler {
@Execute
public void deleteFile(Shell activeShell, RepositoryAccessor repositoryAccessor) {
public void deleteFile(@Named(IServiceConstants.ACTIVE_SHELL) Shell activeShell, RepositoryAccessor repositoryAccessor) {
createWizard(newWizard(), repositoryAccessor, activeShell)
.open(activeShell, Messages.delete)
.ifPresent(selection -> {
......
......@@ -17,17 +17,24 @@ package org.bonitasoft.studio.ui.handler;
import java.util.List;
import java.util.stream.Collectors;
import javax.inject.Named;
import org.bonitasoft.studio.common.repository.RepositoryAccessor;
import org.bonitasoft.studio.common.repository.model.IRepositoryFileStore;
import org.bonitasoft.studio.common.repository.model.IRepositoryStore;
import org.bonitasoft.studio.ui.util.StringIncrementer;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public abstract class NewFileHandler {
public abstract class NewFileHandler extends AbstractHandler {
@Execute
public void execute(Shell activeShell, RepositoryAccessor repositoryAccessor) {
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell activeShell, RepositoryAccessor repositoryAccessor) {
openHelpDialog(activeShell);
List<String> existingFileNameList = getRepositoryStore(repositoryAccessor).getChildren().stream()
.map(IRepositoryFileStore::getDisplayName).collect(Collectors.toList());
......@@ -43,4 +50,12 @@ public abstract class NewFileHandler {
RepositoryAccessor repositoryAccessor);
protected abstract String getDefaultFileName();
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
RepositoryAccessor repositoryAccessor = new RepositoryAccessor();
repositoryAccessor.init();
execute(Display.getDefault().getActiveShell(), repositoryAccessor);
return null;
}
}
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