use of com.liferay.ide.project.core.modules.fragment.NewModuleFragmentOp in project liferay-ide by liferay.
the class MavenModuleFragmentProjectTests method testNewModuleFragmentProjectOpProjectName.
@Test
public void testNewModuleFragmentProjectOpProjectName() {
NewModuleFragmentOp op = NewModuleFragmentOp.TYPE.instantiate();
op.setProjectName("test-module-fragment");
Status projectNameOkValidationStatus1 = op.getProjectName().validation();
assertEquals("ok", projectNameOkValidationStatus1.message());
op.setProjectName("#test-module-fragment");
Status projectNameErrorValidationStatus = op.getProjectName().validation();
assertEquals("The project name is invalid.", projectNameErrorValidationStatus.message());
op.setProjectName("test_module_fragment");
Status projectNameOkValidationStatus2 = op.getProjectName().validation();
assertEquals("ok", projectNameOkValidationStatus2.message());
}
use of com.liferay.ide.project.core.modules.fragment.NewModuleFragmentOp in project liferay-ide by liferay.
the class NewModuleFragmentWizard method performPostFinish.
@Override
protected void performPostFinish() {
super.performPostFinish();
final NewModuleFragmentOp op = element().nearest(NewModuleFragmentOp.class);
final IProject project = CoreUtil.getProject(op.getProjectName().content());
try {
addToWorkingSets(project);
} catch (Exception ex) {
ProjectUI.logError("Unable to add project to working set", ex);
}
openLiferayPerspective(project);
}
use of com.liferay.ide.project.core.modules.fragment.NewModuleFragmentOp in project liferay-ide by liferay.
the class AddFilesFromOSGiBundleAction method computeEnablementState.
@Override
protected boolean computeEnablementState() {
boolean enabled = false;
NewModuleFragmentOp op = getModelElement().nearest(NewModuleFragmentOp.class);
String hostOsgiBundle = op.getHostOsgiBundle().content();
if (hostOsgiBundle != null) {
enabled = true;
}
return enabled;
}
use of com.liferay.ide.project.core.modules.fragment.NewModuleFragmentOp in project liferay-ide by liferay.
the class AddFilesFromOSGiBundleAction method run.
@Override
protected Object run(Presentation context) {
Element modelElement = context.part().getModelElement();
final NewModuleFragmentOp op = modelElement.nearest(NewModuleFragmentOp.class);
final ElementList<OverrideFilePath> currentFiles = op.getOverrideFiles();
final String projectName = op.getProjectName().content();
final OSGiBundleFileSelectionDialog dialog = new OSGiBundleFileSelectionDialog(null, currentFiles, projectName);
final String runtimeName = op.getLiferayRuntimeName().content();
final IRuntime runtime = ServerUtil.getRuntime(runtimeName);
final IPath tempLocation = ProjectCore.getDefault().getStateLocation();
dialog.setTitle("Add files from OSGi bundle to override");
String currentOSGiBundle = op.getHostOsgiBundle().content();
if (!currentOSGiBundle.endsWith("jar")) {
currentOSGiBundle = currentOSGiBundle + ".jar";
}
File module = tempLocation.append(currentOSGiBundle).toFile();
if (FileUtil.notExists(module)) {
module = ServerUtil.getModuleFileFrom70Server(runtime, currentOSGiBundle, tempLocation);
}
if (FileUtil.exists(module)) {
dialog.setInput(module);
}
if (dialog.open() == Window.OK) {
Object[] selected = dialog.getResult();
for (int i = 0; i < selected.length; i++) {
OverrideFilePath file = op.getOverrideFiles().insert();
file.setValue(selected[i].toString());
}
}
return Status.createOkStatus();
}
use of com.liferay.ide.project.core.modules.fragment.NewModuleFragmentOp in project liferay-ide by liferay.
the class ModuleNewLiferayRuntimeAction method run.
@Override
protected Object run(Presentation context) {
Element element = context.part().getModelElement();
NewModuleFragmentOp op = element.nearest(NewModuleFragmentOp.class);
boolean oK = ServerUIUtil.showNewRuntimeWizard(((SwtPresentation) context).shell(), "liferay.bundle", null, "com.liferay.");
if (oK) {
op.property(NewModuleFragmentOp.PROP_LIFERAY_RUNTIME_NAME).refresh();
}
return Status.createOkStatus();
}
Aggregations