use of org.eclipse.sapphire.Element in project liferay-ide by liferay.
the class BuildServicesActionHandler method run.
@Override
protected Object run(Presentation context) {
Element modelElement = context.part().getModelElement();
IFile file = modelElement.adapt(IFile.class);
if (FileUtil.exists(file)) {
if (ServiceUIUtil.shouldCreateServiceBuilderJob(file)) {
new BuildServiceJob(file.getProject()).schedule();
}
} else {
MessageDialog.openWarning(((SwtPresentation) context).shell(), Msgs.buildServices, Msgs.actionUnavailableImportProject);
}
return null;
}
use of org.eclipse.sapphire.Element in project liferay-ide by liferay.
the class AddFilesFromOSGiBundleAction method init.
@Override
public void init(SapphireAction action, ActionHandlerDef def) {
super.init(action, def);
final Element element = getModelElement();
final Listener listener = new FilteredListener<PropertyContentEvent>() {
@Override
protected void handleTypedEvent(PropertyContentEvent event) {
refreshEnablementState();
}
};
element.attach(listener, NewModuleFragmentOp.PROP_HOST_OSGI_BUNDLE.name());
attach(new Listener() {
@Override
public void handle(final Event event) {
if (event instanceof DisposeEvent) {
element.detach(listener, NewModuleFragmentOp.PROP_HOST_OSGI_BUNDLE.name());
}
}
});
}
use of org.eclipse.sapphire.Element 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 org.eclipse.sapphire.Element 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();
}
use of org.eclipse.sapphire.Element in project liferay-ide by liferay.
the class TaskScriptedAssignmentCondition method _task.
private Task _task() {
Task retval = null;
Element modelElement = getPart().getLocalModelElement();
retval = modelElement.nearest(Task.class);
return retval;
}
Aggregations