Example usage for org.eclipse.jface.resource ImageDescriptor createFromURL

List of usage examples for org.eclipse.jface.resource ImageDescriptor createFromURL

Introduction

In this page you can find the example usage for org.eclipse.jface.resource ImageDescriptor createFromURL.

Prototype

public static ImageDescriptor createFromURL(URL url) 

Source Link

Document

Creates and returns a new image descriptor from a URL.

Usage

From source file:com.mercatis.lighthouse3.security.ui.providers.UserLabelProvider.java

License:Apache License

public Image getImage(Object element) {
    if (image == null) {
        image = ImageDescriptor.createFromURL(getClass().getResource("/icons/user.png")).createImage();
    }/*from   ww  w  .  j  a  v  a  2  s  . c o m*/
    return image;
}

From source file:com.mercatis.lighthouse3.ui.environment.model.adapters.DeploymentWorkbenchAdapter.java

License:Apache License

public ImageDescriptor getImageDescriptor(Object adaptee) {
    return ImageDescriptor.createFromURL(getClass().getResource("/icons/deployment.png"));
}

From source file:com.mercatis.lighthouse3.ui.environment.model.adapters.EnvironmentWorkbenchAdapter.java

License:Apache License

public ImageDescriptor getImageDescriptor(Object adaptee) {
    return ImageDescriptor.createFromURL(getClass().getResource("/icons/environment.png"));
}

From source file:com.mercatis.lighthouse3.ui.environment.model.adapters.LighthouseDomainWorkbenchAdapter.java

License:Apache License

public ImageDescriptor getImageDescriptor(Object adaptee) {
    if (adaptee instanceof LighthouseDomain) {
        if (((LighthouseDomain) adaptee).getProject().isOpen()) {
            return ImageDescriptor.createFromURL(this.getClass().getResource("/icons/prj_obj.gif"));
        } else {/*ww  w.ja  v a  2 s.c  om*/
            return ImageDescriptor.createFromURL(this.getClass().getResource("/icons/cprj_obj.gif"));
        }
    }
    return null;
}

From source file:com.mercatis.lighthouse3.ui.environment.model.adapters.LocationWorkbenchAdapter.java

License:Apache License

public ImageDescriptor getImageDescriptor(Object adaptee) {
    return ImageDescriptor.createFromURL(getClass().getResource("/icons/location.png"));
}

From source file:com.mercatis.lighthouse3.ui.environment.model.adapters.ProcessTaskWorkbenchAdapter.java

License:Apache License

public ImageDescriptor getImageDescriptor(Object adaptee) {
    return ImageDescriptor.createFromURL(getClass().getResource("/icons/chart_organisation.png"));
}

From source file:com.mercatis.lighthouse3.ui.environment.model.adapters.SoftwareComponentWorkbenchAdapter.java

License:Apache License

public ImageDescriptor getImageDescriptor(Object adaptee) {
    return ImageDescriptor.createFromURL(getClass().getResource("/icons/softwarecomponent.png"));
}

From source file:com.mercatis.lighthouse3.ui.operations.ui.menu.DynamicMenu.java

License:Apache License

public void fill(Menu menu, int index) {
    ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService()
            .getSelection();//from ww  w .  j a v a  2s . co  m
    if (selection != null && !selection.isEmpty() && selection instanceof StructuredSelection) {
        if (((StructuredSelection) selection).getFirstElement() instanceof Deployment) {
            Deployment selectedDeployment = (Deployment) ((StructuredSelection) selection).getFirstElement();
            List<OperationInstallation> availableOps = OperationBase.getOperationInstallationService()
                    .findAtDeployment(selectedDeployment);

            // remove all operation installations that the current user must not execute
            for (Iterator<OperationInstallation> it = availableOps.iterator(); it.hasNext();) {
                OperationInstallation installation = it.next();
                if (!CodeGuard.hasRole(Role.OPERATION_EXECUTE, installation))
                    it.remove();
            }

            MenuItem subMenuItem = new MenuItem(menu, SWT.CASCADE, index);
            subMenuItem.setText("Execute");
            subMenuItem.setImage(ImageDescriptor
                    .createFromURL(getClass().getResource("/icons/operationcall.png")).createImage());

            Menu submenu = new Menu(menu);
            subMenuItem.setMenu(submenu);

            if (!availableOps.isEmpty()) {
                for (OperationInstallation operationInstallation : availableOps) {
                    final OperationInstallationWrapper loader = new OperationInstallationWrapper(
                            operationInstallation);

                    MenuItem item = new MenuItem(submenu, SWT.PUSH);
                    item.setEnabled(loader.getOperation() != null);
                    item.setText(LabelConverter.getLabel(loader));
                    item.addListener(SWT.Selection, new Listener() {
                        public void handleEvent(org.eclipse.swt.widgets.Event event) {
                            OperationCallWizard wizard = new OperationCallWizard(loader);
                            WizardDialog dialog = new WizardDialog(
                                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
                            dialog.open();
                        }
                    });
                }
            }
            subMenuItem.setEnabled(!availableOps.isEmpty());
        }
    }
}

From source file:com.mercatis.lighthouse3.ui.operations.ui.providers.JobTableLabelProvider.java

License:Apache License

public Image getImage(Object element) {
    return ImageDescriptor.createFromURL(getClass().getResource("/icons/job.png")).createImage();
}

From source file:com.mercatis.lighthouse3.ui.operations.ui.providers.OperationsTreeLabelProvider.java

License:Apache License

public Image getImage(Object element) {
    if (element instanceof Operation || element instanceof OperationInstallation) {
        return ImageDescriptor.createFromURL(getClass().getResource("/icons/operation.png")).createImage();
    } else if (element instanceof OperationInstallationWrapper) {
        if (((OperationInstallationWrapper) element).getOperation() == null) {
            return ImageDescriptor.createFromURL(getClass().getResource("/icons/operation_broken.png"))
                    .createImage();//from   w  w w.j a  v  a2  s  .  c o m
        } else {
            return ImageDescriptor.createFromURL(getClass().getResource("/icons/operation.png")).createImage();
        }
    }
    return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER)
            .createImage();
}