рефакторинг. избыточный код. зачем то был абстрактный метод
This commit is contained in:
@@ -3,12 +3,13 @@ import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.DBTable;
|
||||
import Common.Database.Database;
|
||||
import Common.Passes.Pass;
|
||||
import _VisualDVM.Global;
|
||||
public abstract class ObjectPass<D extends DBObject> extends Pass<D> {
|
||||
protected Class<D> d; //класс объектов.
|
||||
public ObjectPass(Class<D> d_in) {
|
||||
d = d_in;
|
||||
}
|
||||
protected abstract Database getDb(); //источник данных
|
||||
protected Database getDb(){ return Global.mainModule.getDb();}; //источник данных
|
||||
public DBTable getTable() {
|
||||
return getDb().tables.get(d);
|
||||
} //таблица в источнике данных
|
||||
|
||||
@@ -11,10 +11,6 @@ public class AddCompiler extends AddObjectPass<Compiler> {
|
||||
super(Compiler.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
@Override
|
||||
public Class<? extends DBObject> getOwner() {
|
||||
return Machine.class;
|
||||
}
|
||||
|
||||
@@ -14,8 +14,4 @@ public class AddDVMParameter extends AddObjectPass<DVMParameter> {
|
||||
public Class<? extends DBObject> getOwner() {
|
||||
return RunConfiguration.class;
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,4 @@ public class AddEnvironmentValue extends AddObjectPass<EnvironmentValue> {
|
||||
public AddEnvironmentValue() {
|
||||
super(EnvironmentValue.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,10 +14,6 @@ public class AddMachine extends AddObjectPass<Machine> {
|
||||
super(Machine.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (super.canStart(args)) {
|
||||
if (target.type.equals(MachineType.Local) && Global.mainModule.getDb().machines.LocalMachineExists()) {
|
||||
|
||||
@@ -23,8 +23,4 @@ public class AddMakefile extends AddObjectPass<Makefile> {
|
||||
getDb().Insert(new Module(LanguageName.c, target));
|
||||
getDb().Insert(new Module(LanguageName.cpp, target));
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,4 @@ public class AddRunConfiguration extends AddObjectPass<RunConfiguration> {
|
||||
public Class<? extends DBObject> getOwner() {
|
||||
return Machine.class;
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,10 +14,6 @@ public class AddUser extends AddObjectPass<User> {
|
||||
super(User.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
@Override
|
||||
public Class<? extends DBObject> getOwner() {
|
||||
return Machine.class;
|
||||
}
|
||||
|
||||
@@ -7,8 +7,4 @@ public class DeleteCompiler extends DeleteObjectPass<Compiler> {
|
||||
public DeleteCompiler() {
|
||||
super(Compiler.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,4 @@ public class DeleteDVMParameter extends DeleteObjectPass<DVMParameter> {
|
||||
public DeleteDVMParameter() {
|
||||
super(DVMParameter.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,4 @@ public class DeleteEnvironmentValue extends DeleteObjectPass<EnvironmentValue> {
|
||||
public DeleteEnvironmentValue() {
|
||||
super(EnvironmentValue.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,4 @@ public class DeleteMachine extends DeleteObjectPass<Machine> {
|
||||
public DeleteMachine() {
|
||||
super(Machine.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,4 @@ public class DeleteMakefile extends DeleteObjectPass<Makefile> {
|
||||
public DeleteMakefile() {
|
||||
super(Makefile.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,4 @@ public class DeleteProfile extends DeleteObjectPass<SapforProfile> {
|
||||
public DeleteProfile() {
|
||||
super(SapforProfile.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,4 @@ public class DeleteRunConfiguration extends DeleteObjectPass<RunConfiguration> {
|
||||
public DeleteRunConfiguration() {
|
||||
super(RunConfiguration.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,4 @@ public class DeleteUser extends DeleteObjectPass<User> {
|
||||
public DeleteUser() {
|
||||
super(User.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,4 @@ public class EditCompiler extends EditObjectPass<Compiler> {
|
||||
public EditCompiler() {
|
||||
super(Compiler.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,4 @@ public class EditDVMParameter extends EditObjectPass<DVMParameter> {
|
||||
public EditDVMParameter() {
|
||||
super(DVMParameter.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,4 @@ public class EditEnvironmentValue extends EditObjectPass<EnvironmentValue> {
|
||||
public EditEnvironmentValue() {
|
||||
super(EnvironmentValue.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,4 @@ public class EditMachine extends EditObjectPass<Machine> {
|
||||
public EditMachine() {
|
||||
super(Machine.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,4 @@ public class EditMakefile extends EditObjectPass<Makefile> {
|
||||
public EditMakefile() {
|
||||
super(Makefile.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,4 @@ public class EditModule extends EditObjectPass<Module> {
|
||||
public EditModule() {
|
||||
super(Module.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,4 @@ public class EditProfile extends EditObjectPass<SapforProfile> {
|
||||
public EditProfile() {
|
||||
super(SapforProfile.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,4 @@ public class EditRunConfiguration extends EditObjectPass<RunConfiguration> {
|
||||
public EditRunConfiguration() {
|
||||
super(RunConfiguration.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,4 @@ public class EditUser extends EditObjectPass<User> {
|
||||
public EditUser() {
|
||||
super(User.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,10 +16,6 @@ public class SaveProfile extends AddObjectPass<SapforProfile> {
|
||||
return "/icons/Save.png";
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.mainModule.getDb();
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
//1. проверить нет ли уже такой последовательности настроек.
|
||||
SapforProfile profile = Global.mainModule.getDb().checkProfileForCurrentSettings();
|
||||
|
||||
Reference in New Issue
Block a user