import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.preference.IPreferenceStore;
private final Logger logger = LoggerFactory.getLogger(RtBuilder.class);
public RtBuilder() {
+ forgetLastBuiltState();
}
@Override
switch (kind) {
case FULL_BUILD:
BuildCommand buildCommand = new BuildCommand();
- result = buildCommand.execute(project, consoleManager, monitor);
+ if (buildCommand.isEnable(project)) {
+ result = buildCommand.execute(project, consoleManager, monitor);
+ } else {
+ consoleManager.println(Messages.CommandMessage_KconfigError);
+ result = 1;
+ }
break;
}
if (useDistClean) {
cleanCommand.setProperty("distclean", "true");
}
-
+
cleanCommand.execute(project, consoleManager, monitor);
}
-
+
public static void addBuilderToProject(IProject fProject) throws CoreException {
IProjectDescription desc = fProject.getDescription();
ICommand[] commands = desc.getBuildSpec();
import java.util.Properties;
+import org.eclipse.core.resources.IProject;
+
/**
* @author Gyeongmin Ju{@literal <gyeongmin.ju>} (S-Core)
*/
protected Properties properties;
@Override
- public boolean isEnable() {
+ public boolean isEnable(IProject project) {
return true;
}
}
protected String getSettingFileName() {
- return FILENAME_BUILD_SETTING; // $NON-NLS-1$
+ return FILENAME_BUILD_SETTING;
}
+ @Override
+ public boolean isEnable(IProject project) {
+ String activeProjectPath = project.getLocation().toString();
+ String osDir = activeProjectPath + File.separator + "os"; //$NON-NLS-1$
+
+ return new File(osDir, FILENAME_CONFIG).exists();
+ }
+
private static int doBuilding(String projectPath, String scriptFileName, String settingFileName,
ConsoleManager consoleManager, Logger logger) {
String osDir = projectPath + File.separator + "os"; //$NON-NLS-1$
@Override
public int execute(IProject project, ConsoleManager consoleManager, IProgressMonitor monitor) {
- String activeProjectPath = project.getLocation().toString();
- String osDir = project.getLocation().toString() + File.separator + "os"; //$NON-NLS-1$
-
- if (!new File(osDir, FILENAME_CONFIG).exists()) { // $NON-NLS-1$
+ if (!isEnable(project)) {
MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", Messages.CommandMessage_KconfigError); //$NON-NLS-1$
return 1;
}
+ String activeProjectPath = project.getLocation().toString();
BuildCommand.doBuilding(activeProjectPath, getScriptFileName(), getSettingFileName(), consoleManager, logger);
return 0;
*/
public interface Command {
- public boolean isEnable();
-
public void setProperty(String key, String value);
public String getProperty(String key);
+ public boolean isEnable(IProject project);
+
public int execute(IProject project, ConsoleManager consoleManager, IProgressMonitor monitor);
}