Skip to content

Commit

Permalink
Actions to compile and run
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Pozhidaev committed Apr 24, 2018
1 parent c68c313 commit d076dd3
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 14 deletions.
34 changes: 22 additions & 12 deletions src/main/java/org/luwrain/app/studio/ActionLists.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,48 @@
package org.luwrain.app.studio;

import java.util.*;
import org.apache.commons.vfs2.*;

import org.luwrain.core.*;
import org.luwrain.core.events.*;

class ActionLists
{private final Strings strings;
{
private final Strings strings;
private final Base base;

ActionLists(Strings strings)
ActionLists(Strings strings, Base base)
{
NullCheck.notNull(strings, "strings");
NullCheck.notNull(base, "base");
this.strings = strings;
this.base = base;
}

private List<Action> commonActions()
{
final List<Action> res = new LinkedList();
res.add(new Action("open-project", strings.actionOpenProject()));
if (base.getProject() != null && base.getProject().getBuildFlavors().length > 0)
res.add(new Action("build", strings.actionBuild()));
res.add(new Action("run", strings.actionRun()));
return res;
}

Action[] getTreeActions()
{
return new Action[]{
new Action("open-project", strings.actionOpenProject()),
};
final List<Action> res = commonActions();
return res.toArray(new Action[res.size()]);
}

Action[] getEditActions()
{
return new Action[]{
new Action("open-project", strings.actionOpenProject()),
};
final List<Action> res = commonActions();
return res.toArray(new Action[res.size()]);
}

Action[] getOutputActions()
{
return new Action[]{
new Action("open-project", strings.actionOpenProject()),
};
final List<Action> res = commonActions();
return res.toArray(new Action[res.size()]);
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/luwrain/app/studio/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class App implements Application
strings = (Strings)o;
this.luwrain = luwrain;
this.base = new Base(luwrain, strings);
this.actionLists = new ActionLists(strings);
this.actionLists = new ActionLists(strings, base);
this.actions = new Actions(luwrain, base, strings);
createAreas();
layout = new AreaLayoutHelper(()->{
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/luwrain/app/studio/Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ void activateProject(Project proj)
this.project = proj;
}

Project getProject()
{
return project;
}

void startEditing(SourceFile.Editing editing) throws IOException
{
NullCheck.notNull(editing, "editing");
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/luwrain/app/studio/Strings.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ public interface Strings
String appName();

String actionOpenProject();
String actionBuild();
String actionRun();
String editAreaName();
String openProjectPopupName();
String openProjectPopupPrefix();
String outputAreaName();
String treeAreaName();
String treeAreaName();
String treeRoot();
}

0 comments on commit d076dd3

Please sign in to comment.