Skip to content

Commit

Permalink
Release v0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
twasyl committed Oct 18, 2013
1 parent 9bb21b9 commit 8d078af
Show file tree
Hide file tree
Showing 33 changed files with 876 additions and 240 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ a repository you will get it in the help window of the maven options.
## Workspaces

A workspace allows you to have multiple repositories available in ***CompilerFX***, grouped
by versions, folders, or whatever makes sense for you. Bulk operations like removall and global
by versions, folders, or whatever makes sense for you. Bulk operations like removal and global
compilation are always done in the current displayed workspace.

If you want to delete a workspace, right click on the tab and choose delete. If the workspace
is empty, it will directly be deleted otherwhise a window will ask you if you want to trash the
is empty, it will directly be deleted otherwise a window will ask you if you want to trash the
repositories present in it or move them to another one.

To rename a workspace, right click on the tab and choose rename. To validate the change press enter and to cancel
press escape.

## Adding a repository

By clicking on the *Add repository* button, you will be able to add a repository to **CompilerFX**.
If you don't enter a name but click on the *Browse* button, the name of the chosen directory will be
By clicking on the **Add repository** button, you will be able to add a repository to **CompilerFX**.
If you don't enter a name but click on the **Browse** button, the name of the chosen directory will be
added as name for the repository. Of course you can change it.
**Warning:** you can not add a repository that doesn't contain a **pom.xml** file.

Expand Down
42 changes: 30 additions & 12 deletions src/main/java/com/twasyl/compilerfx/app/CompilerFXApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,27 @@
import com.twasyl.compilerfx.beans.Configuration;
import com.twasyl.compilerfx.beans.MavenRepository;
import com.twasyl.compilerfx.control.Dialog;
import com.twasyl.compilerfx.controllers.CompilerFXController;
import com.twasyl.compilerfx.enums.Status;
import com.twasyl.compilerfx.exceptions.MissingConfigurationFileException;
import com.twasyl.compilerfx.utils.ConfigurationWorker;
import com.twasyl.compilerfx.utils.FXMLLoader;
import com.twasyl.compilerfx.utils.UIUtils;
import javafx.application.Application;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.ReadOnlyObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;

import java.io.IOException;
import java.util.Iterator;

public class CompilerFXApp extends Application {

public static String version = "0.3.1";
public static String version = "0.4.0";
private static final ReadOnlyObjectProperty<CompilerFXApp> current = new SimpleObjectProperty<>();
private final ReadOnlyObjectProperty<Stage> currentStage = new SimpleObjectProperty<>();

Expand All @@ -31,22 +32,19 @@ public void start(final Stage stage) throws Exception {
((SimpleObjectProperty<CompilerFXApp>) CompilerFXApp.current).set(this);
((SimpleObjectProperty<Stage>) currentStage).set(stage);

Parent root = FXMLLoader.load(getClass().getResource("/com/twasyl/compilerfx/fxml/CompilerFX.fxml"));

final Scene scene = UIUtils.createScene(root);
final Scene scene = loadFullUI((Parent) FXMLLoader.load(getClass().getResource("/com/twasyl/compilerfx/fxml/MavenRepositories.fxml")));
stage.setTitle("CompilerFX");
stage.setScene(scene);
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent windowEvent) {
// Only directly close the app if there are no current processes, otherwise ask what to do
if (!Configuration.getInstance().getCurrentBuilds().isEmpty()) {
final String message = String.format("%1$s currently active. Abort %2$s?",
Configuration.getInstance().getCurrentBuilds().size() > 1 ? "Processes are" : "A process is",
Configuration.getInstance().getCurrentBuilds().size() > 1 ? "them" : "it"
);
final String message = Configuration.getInstance().getCurrentBuilds().size() > 1 ?
FXMLLoader.getResourceBundle().getString("application.message.info.activeProcesses") :
FXMLLoader.getResourceBundle().getString("application.message.info.activeProcess");

if (Dialog.showConfirmDialog(stage, "Quit?", message) == Dialog.Response.YES) {
if (Dialog.showConfirmDialog(stage, FXMLLoader.getResourceBundle().getString("dialog.title.quit"), message) == Dialog.Response.YES) {
final Iterator<MavenRepository> processIterator = Configuration.getInstance().getCurrentBuilds().iterator();
MavenRepository repository;

Expand Down Expand Up @@ -87,9 +85,29 @@ public void closeApplication() {
currentStage.get().fireEvent(event);
}

private static final ReadOnlyObjectProperty<CompilerFXApp> currentProperty() { return current; }
public Scene loadFullUI(Parent screenContent) {
final FXMLLoader loader = new FXMLLoader(getClass().getResource("/com/twasyl/compilerfx/fxml/CompilerFX.fxml"));

try {
Parent root = (Parent) loader.load();
CompilerFXController controller = loader.getController();

controller.switchScreen(screenContent);

return UIUtils.createScene(root);
} catch (IOException e) {
e.printStackTrace();
}

return null;
}

public static final ReadOnlyObjectProperty<CompilerFXApp> currentProperty() { return current; }
public static final CompilerFXApp getCurrent() { return currentProperty().get(); }

public ReadOnlyObjectProperty<Stage> currentStageProperty() { return this.currentStage; }
public Stage getCurrentStage() { return this.currentStageProperty().get(); }

public static void main(String[] args) {
Application.launch(CompilerFXApp.class, args);
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/twasyl/compilerfx/beans/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import java.util.ArrayList;
import java.util.Comparator;
import java.util.Locale;
import java.util.TreeSet;

public class Configuration {
Expand All @@ -17,6 +18,7 @@ public class Configuration {
private final SetProperty<Workspace> workspaces = new SimpleSetProperty<>();
private final SetProperty<MavenRepository.MavenOption> customMavenOptions = new SimpleSetProperty<>();
private final ListProperty<MavenRepository> currentBuilds = new SimpleListProperty<>(FXCollections.observableArrayList(new ArrayList<MavenRepository>()));
private final ObjectProperty<Locale> uiLocale = new SimpleObjectProperty<>();

private Configuration() {
TreeSet<MavenRepository> repositoryTreeSet = new TreeSet<>(new Comparator<MavenRepository>() {
Expand Down Expand Up @@ -68,5 +70,9 @@ public int compare(MavenRepository.MavenOption o1, MavenRepository.MavenOption o
public ObservableSet<MavenRepository.MavenOption> getCustomMavenOptions() { return this.customMavenOptionsProperty().get(); }
public void setCustomMavenOptions(ObservableSet<MavenRepository.MavenOption> customMavenOptions) { this.customMavenOptionsProperty().set(customMavenOptions); }

public ObjectProperty<Locale> uiLocaleProperty() { return this.uiLocale; }
public Locale getUiLocale() { return uiLocaleProperty().get(); }
public void setUiLocale(Locale uiLocale) { this.uiLocale.set(uiLocale); }

public ObservableList<Workspace> getWorkspacesAsList() { return FXCollections.observableArrayList(getWorkspaces()); }
}
9 changes: 5 additions & 4 deletions src/main/java/com/twasyl/compilerfx/control/Dialog.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.twasyl.compilerfx.control;

import com.twasyl.compilerfx.utils.FXMLLoader;
import com.twasyl.compilerfx.utils.UIUtils;
import javafx.application.Platform;
import javafx.event.ActionEvent;
Expand Down Expand Up @@ -71,7 +72,7 @@ private void setUserResponse(Response userResponse) {
}

public static Response showDialog(Stage owner, String title, Node content) {
final Button okButton = new Button("OK");
final Button okButton = new Button(FXMLLoader.getResourceBundle().getString("button.ok"));

final Dialog dialog = buildDialog(owner, title, content, okButton);

Expand All @@ -83,9 +84,9 @@ public static Response showDialog(Stage owner, String title, Node content) {
}

public static Response showConfirmDialog(Stage owner, String title, String message) {
final Button yesButton = new Button("Yes");
final Button yesButton = new Button(FXMLLoader.getResourceBundle().getString("button.yes"));
yesButton.requestFocus();
final Button noButton = new Button("No");
final Button noButton = new Button(FXMLLoader.getResourceBundle().getString("button.no"));

final Text messageText = new Text(message);
messageText.setWrappingWidth(300);
Expand All @@ -102,7 +103,7 @@ public static Response showConfirmDialog(Stage owner, String title, String messa
}

public static Response showErrorDialog(Stage owner, String title, String message) {
final Button okButton = new Button("OK");
final Button okButton = new Button(FXMLLoader.getResourceBundle().getString("button.ok"));

final Text textMessage = new Text(message);
textMessage.setStyle("-fx-fill: white; -fx-font-size: 15pt;");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.twasyl.compilerfx.controllers.EditRepositoryController;
import com.twasyl.compilerfx.enums.Status;
import com.twasyl.compilerfx.utils.ConfigurationWorker;
import com.twasyl.compilerfx.utils.FXMLLoader;
import com.twasyl.compilerfx.utils.MavenExecutor;
import com.twasyl.compilerfx.utils.WorkspaceStringConverter;
import javafx.beans.property.BooleanProperty;
Expand All @@ -18,7 +19,6 @@
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.control.*;
import javafx.scene.input.MouseButton;
Expand All @@ -38,7 +38,7 @@ public TableRow<MavenRepository> call(TableView<MavenRepository> mavenRepository

final CustomMenuItem moveTo = new CustomMenuItem();

final Label moveToLabel = new Label("Move to");
final Label moveToLabel = new Label(FXMLLoader.getResourceBundle().getString("control.mavenrepositorytablerowfactory.contextmenu.item.moveTo"));

final ChoiceBox<Workspace> moveToChoiceBox = new ChoiceBox<>();
moveToChoiceBox.setConverter(new WorkspaceStringConverter());
Expand Down Expand Up @@ -66,7 +66,7 @@ public void changed(ObservableValue<? extends Workspace> observableValue, Worksp

final CustomMenuItem copyIn = new CustomMenuItem();

final Label copyInLabel = new Label("Copy in");
final Label copyInLabel = new Label(FXMLLoader.getResourceBundle().getString("control.mavenrepositorytablerowfactory.contextmenu.item.copyIn"));

final ChoiceBox<Workspace> copyInChoiceBox = new ChoiceBox<>();
copyInChoiceBox.setConverter(new WorkspaceStringConverter());
Expand Down Expand Up @@ -103,7 +103,7 @@ public void changed(ObservableValue<? extends Workspace> observableValue, Worksp

copyIn.setContent(copyInBox);

final MenuItem edit = new MenuItem("Edit");
final MenuItem edit = new MenuItem(FXMLLoader.getResourceBundle().getString("control.mavenrepositorytablerowfactory.contextmenu.item.edit"));
edit.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
Expand All @@ -123,14 +123,16 @@ public void handle(ActionEvent actionEvent) {
}
});

final MenuItem delete = new MenuItem("Delete");
final MenuItem delete = new MenuItem(FXMLLoader.getResourceBundle().getString("control.mavenrepositorytablerowfactory.contextmenu.item.delete"));
delete.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
if(row.getItem() != null) {
Dialog.Response response = Dialog.showConfirmDialog(null,
"Delete repository?",
String.format("Are you sure you want to delete the repository '%1$s'?", row.getItem().getRepositoryName()));
FXMLLoader.getResourceBundle().getString("control.mavenrepositorytablerowfactory.dialog.title.deleteRepository"),
String.format(
FXMLLoader.getResourceBundle().getString("control.mavenrepositorytablerowfactory.message.info.confirmDeletion"),
row.getItem().getRepositoryName()));

if(response == Dialog.Response.YES) {
final MavenRepository repository = row.getItem();
Expand All @@ -142,7 +144,7 @@ public void handle(ActionEvent actionEvent) {
}
});

final MenuItem compile = new MenuItem("Compile");
final MenuItem compile = new MenuItem(FXMLLoader.getResourceBundle().getString("control.mavenrepositorytablerowfactory.contextmenu.item.compile"));
compile.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
Expand All @@ -153,7 +155,7 @@ public void handle(ActionEvent actionEvent) {
}
});

final MenuItem compileWithPostBuildCommands = new MenuItem("Compile & execute post build commands");
final MenuItem compileWithPostBuildCommands = new MenuItem(FXMLLoader.getResourceBundle().getString("control.mavenrepositorytablerowfactory.contextmenu.item.compileAndPostBuild"));
compileWithPostBuildCommands.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
Expand All @@ -164,7 +166,7 @@ public void handle(ActionEvent actionEvent) {
}
});

final MenuItem abort = new MenuItem("Abort");
final MenuItem abort = new MenuItem(FXMLLoader.getResourceBundle().getString("control.mavenrepositorytablerowfactory.contextmenu.item.abort"));
abort.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
Expand All @@ -179,7 +181,7 @@ public void handle(ActionEvent actionEvent) {
}
});

final MenuItem executePostBuildCommands = new MenuItem("Execute post build commands");
final MenuItem executePostBuildCommands = new MenuItem(FXMLLoader.getResourceBundle().getString("control.mavenrepositorytablerowfactory.contextmenu.item.executePostBuildCommands"));
executePostBuildCommands.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
Expand All @@ -190,7 +192,7 @@ public void handle(ActionEvent actionEvent) {
}
});

final MenuItem clearExecutionStack = new MenuItem("Clear execution result");
final MenuItem clearExecutionStack = new MenuItem(FXMLLoader.getResourceBundle().getString("control.mavenrepositorytablerowfactory.contextmenu.item.clearExecutionResult"));
clearExecutionStack.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
Expand Down
26 changes: 15 additions & 11 deletions src/main/java/com/twasyl/compilerfx/control/WorkspaceTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
import com.twasyl.compilerfx.controllers.DeleteWorkspaceController;
import com.twasyl.compilerfx.controllers.WorkspaceController;
import com.twasyl.compilerfx.utils.ConfigurationWorker;
import com.twasyl.compilerfx.utils.FXMLLoader;
import com.twasyl.compilerfx.utils.UIUtils;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.ContextMenu;
Expand All @@ -32,15 +30,17 @@ public WorkspaceTab() {

final ContextMenu menu = new ContextMenu();

final MenuItem delete = new MenuItem("Delete");
final MenuItem delete = new MenuItem(FXMLLoader.getResourceBundle().getString("control.workspacetab.contextmenu.item.delete"));
delete.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {

if (getWorkspace() != null && getWorkspace().getRepositories().isEmpty()) {
Dialog.Response response = Dialog.showConfirmDialog(null,
"Delete workspace",
String.format("Do you really want to delete the workspace '%1$s'?", getWorkspace().getName()));
FXMLLoader.getResourceBundle().getString("control.workspacetab.dialog.title.deleteWorkspace"),
String.format(
FXMLLoader.getResourceBundle().getString("control.workspacetab.message.info.confirmDeletion"),
getWorkspace().getName()));

if(response == Dialog.Response.YES) {
Configuration.getInstance().getWorkspaces().remove(getWorkspace());
Expand All @@ -56,7 +56,7 @@ public void handle(ActionEvent actionEvent) {

final Scene scene = UIUtils.createScene(root);
final Stage stage = new Stage();
stage.setTitle("Delete workspace");
stage.setTitle(FXMLLoader.getResourceBundle().getString("control.workspacetab.dialog.title.deleteWorkspace"));
stage.setScene(scene);
stage.show();
controller.setStage(stage);
Expand All @@ -68,7 +68,7 @@ public void handle(ActionEvent actionEvent) {
}
});

final MenuItem rename = new MenuItem("Rename");
final MenuItem rename = new MenuItem(FXMLLoader.getResourceBundle().getString("control.workspacetab.contextmenu.item.rename"));
rename.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
Expand All @@ -82,8 +82,10 @@ public void handle(KeyEvent keyEvent) {
WorkspaceTab.this.setText(getWorkspace().getName());
} else if(keyEvent.getCode().equals(KeyCode.ENTER)) {
if(!field.getText().isEmpty()) {
Dialog.Response response = Dialog.showConfirmDialog(null, "Rename workspace",
String.format("Do you really want to rename the workspace '%1$s' to '%2$s'?",
Dialog.Response response = Dialog.showConfirmDialog(null,
FXMLLoader.getResourceBundle().getString("control.workspacetab.dialog.title.renameWorkspace"),
String.format(
FXMLLoader.getResourceBundle().getString("control.workspacetab.message.info.confirmRenaming"),
getWorkspace().getName(), field.getText()));

if(response == Dialog.Response.YES) {
Expand All @@ -93,7 +95,9 @@ public void handle(KeyEvent keyEvent) {
WorkspaceTab.this.setText(getWorkspace().getName());
}
} else {
Dialog.showErrorDialog(null, "Rename workspace", "The name of the workspace can not be empty");
Dialog.showErrorDialog(null,
FXMLLoader.getResourceBundle().getString("control.workspacetab.dialog.title.renameWorkspace"),
FXMLLoader.getResourceBundle().getString("control.workspacetab.message.error.emptyWorkspaceName"));
}
}
}
Expand Down
Loading

0 comments on commit 8d078af

Please sign in to comment.