Search in sources :

Example 26 with Element

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;
}
Also used : BuildServiceJob(com.liferay.ide.service.core.job.BuildServiceJob) IFile(org.eclipse.core.resources.IFile) Element(org.eclipse.sapphire.Element)

Example 27 with Element

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());
            }
        }
    });
}
Also used : FilteredListener(org.eclipse.sapphire.FilteredListener) PropertyContentEvent(org.eclipse.sapphire.PropertyContentEvent) FilteredListener(org.eclipse.sapphire.FilteredListener) Listener(org.eclipse.sapphire.Listener) Element(org.eclipse.sapphire.Element) PropertyContentEvent(org.eclipse.sapphire.PropertyContentEvent) Event(org.eclipse.sapphire.Event) DisposeEvent(org.eclipse.sapphire.DisposeEvent) DisposeEvent(org.eclipse.sapphire.DisposeEvent)

Example 28 with Element

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();
}
Also used : OverrideFilePath(com.liferay.ide.project.core.modules.fragment.OverrideFilePath) IPath(org.eclipse.core.runtime.IPath) Element(org.eclipse.sapphire.Element) NewModuleFragmentOp(com.liferay.ide.project.core.modules.fragment.NewModuleFragmentOp) File(java.io.File) IRuntime(org.eclipse.wst.server.core.IRuntime)

Example 29 with Element

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();
}
Also used : Element(org.eclipse.sapphire.Element) NewModuleFragmentOp(com.liferay.ide.project.core.modules.fragment.NewModuleFragmentOp)

Example 30 with Element

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;
}
Also used : Task(com.liferay.ide.kaleo.core.model.Task) Element(org.eclipse.sapphire.Element)

Aggregations

Element (org.eclipse.sapphire.Element)58 IProject (org.eclipse.core.resources.IProject)13 IFile (org.eclipse.core.resources.IFile)12 Property (org.eclipse.sapphire.Property)8 ValueProperty (org.eclipse.sapphire.ValueProperty)8 IPath (org.eclipse.core.runtime.IPath)7 Event (org.eclipse.sapphire.Event)6 PropertyEvent (org.eclipse.sapphire.PropertyEvent)6 FilteredListener (org.eclipse.sapphire.FilteredListener)5 Listener (org.eclipse.sapphire.Listener)5 Path (org.eclipse.sapphire.modeling.Path)5 IType (org.eclipse.jdt.core.IType)4 JavaModelException (org.eclipse.jdt.core.JavaModelException)4 DisposeEvent (org.eclipse.sapphire.DisposeEvent)4 SapphirePart (org.eclipse.sapphire.ui.SapphirePart)4 Task (com.liferay.ide.kaleo.core.model.Task)3 DynamicElement (com.liferay.ide.portal.core.structures.model.DynamicElement)3 ArrayList (java.util.ArrayList)3 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)3 IClasspathEntry (org.eclipse.jdt.core.IClasspathEntry)3