Search in sources :

Example 11 with ITreeContentProvider

use of org.eclipse.jface.viewers.ITreeContentProvider in project liferay-ide by liferay.

the class NewCustomJSPsHookWizardPage method handleFileBrowseButton.

protected void handleFileBrowseButton(Text text) {
    ISelectionStatusValidator validator = getContainerDialogSelectionValidator();
    ViewerFilter filter = getContainerDialogViewerFilter();
    ITreeContentProvider contentProvider = new WorkbenchContentProvider();
    IDecoratorManager decoratorManager = PlatformUI.getWorkbench().getDecoratorManager();
    ILabelProvider labelProvider = new DecoratingLabelProvider(new WorkbenchLabelProvider(), decoratorManager.getLabelDecorator());
    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), labelProvider, contentProvider);
    dialog.setValidator(validator);
    dialog.setTitle(J2EEUIMessages.CONTAINER_SELECTION_DIALOG_TITLE);
    dialog.setMessage(J2EEUIMessages.CONTAINER_SELECTION_DIALOG_DESC);
    dialog.addFilter(filter);
    dialog.setInput(CoreUtil.getWorkspaceRoot());
    if (dialog.open() == Window.OK) {
        Object element = dialog.getFirstResult();
        try {
            if (element instanceof IFolder) {
                IFolder folder = (IFolder) element;
                IProject project = CoreUtil.getProject(getDataModel().getStringProperty(PROJECT_NAME));
                IWebProject webproject = LiferayCore.create(IWebProject.class, project);
                if (webproject != null) {
                    IFolder defaultWebappRootFolder = webproject.getDefaultDocrootFolder();
                    if (folder.equals(defaultWebappRootFolder)) {
                        folder = folder.getFolder("custom_jsps");
                    }
                    String defaultWebappRootFolderFullPath = defaultWebappRootFolder.getFullPath().toPortableString();
                    String folderFullPath = folder.getFullPath().toPortableString();
                    int index = folderFullPath.indexOf(defaultWebappRootFolderFullPath);
                    if (index != -1) {
                        folderFullPath = folderFullPath.substring(index + defaultWebappRootFolderFullPath.length());
                    }
                    text.setText(folderFullPath);
                }
            }
        } catch (Exception ex) {
        // Do nothing
        }
    }
}
Also used : ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) WorkbenchLabelProvider(org.eclipse.ui.model.WorkbenchLabelProvider) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) IWebProject(com.liferay.ide.core.IWebProject) IDecoratorManager(org.eclipse.ui.IDecoratorManager) DecoratingLabelProvider(org.eclipse.jface.viewers.DecoratingLabelProvider) WorkbenchContentProvider(org.eclipse.ui.model.WorkbenchContentProvider) ILabelProvider(org.eclipse.jface.viewers.ILabelProvider) IProject(org.eclipse.core.resources.IProject) ElementTreeSelectionDialog(org.eclipse.ui.dialogs.ElementTreeSelectionDialog) ISelectionStatusValidator(org.eclipse.ui.dialogs.ISelectionStatusValidator) IFolder(org.eclipse.core.resources.IFolder)

Example 12 with ITreeContentProvider

use of org.eclipse.jface.viewers.ITreeContentProvider in project liferay-ide by liferay.

the class NewLanguagePropertiesHookWizardPage method handleFileBrowseButton.

protected void handleFileBrowseButton(Text text) {
    ISelectionStatusValidator validator = getContainerDialogSelectionValidator();
    ViewerFilter filter = getContainerDialogViewerFilter();
    ITreeContentProvider contentProvider = new WorkbenchContentProvider();
    IDecoratorManager decoratorManager = PlatformUI.getWorkbench().getDecoratorManager();
    ILabelProvider labelProvider = new DecoratingLabelProvider(new WorkbenchLabelProvider(), decoratorManager.getLabelDecorator());
    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), labelProvider, contentProvider);
    dialog.setValidator(validator);
    dialog.setTitle(J2EEUIMessages.CONTAINER_SELECTION_DIALOG_TITLE);
    dialog.setMessage(J2EEUIMessages.CONTAINER_SELECTION_DIALOG_DESC);
    dialog.addFilter(filter);
    dialog.setInput(CoreUtil.getWorkspaceRoot());
    if (dialog.open() == Window.OK) {
        Object element = dialog.getFirstResult();
        try {
            if (element instanceof IFolder) {
                IFolder folder = (IFolder) element;
                IProject project = CoreUtil.getProject(getDataModel().getStringProperty(PROJECT_NAME));
                List<IFolder> sources = CoreUtil.getSourceFolders(JavaCore.create(project));
                if (ListUtil.isNotEmpty(sources) && folder.equals(sources.get(0))) {
                    folder = folder.getFolder("content");
                }
                text.setText(folder.getFullPath().toPortableString());
            }
        } catch (Exception ex) {
        // Do nothing
        }
    }
}
Also used : ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) WorkbenchLabelProvider(org.eclipse.ui.model.WorkbenchLabelProvider) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) IDecoratorManager(org.eclipse.ui.IDecoratorManager) DecoratingLabelProvider(org.eclipse.jface.viewers.DecoratingLabelProvider) WorkbenchContentProvider(org.eclipse.ui.model.WorkbenchContentProvider) ILabelProvider(org.eclipse.jface.viewers.ILabelProvider) IProject(org.eclipse.core.resources.IProject) ElementTreeSelectionDialog(org.eclipse.ui.dialogs.ElementTreeSelectionDialog) ISelectionStatusValidator(org.eclipse.ui.dialogs.ISelectionStatusValidator) IFolder(org.eclipse.core.resources.IFolder)

Example 13 with ITreeContentProvider

use of org.eclipse.jface.viewers.ITreeContentProvider in project liferay-ide by liferay.

the class NewPortalPropertiesHookWizardPage method handleBrowseButton.

protected void handleBrowseButton(Text text) {
    ISelectionStatusValidator validator = getContainerDialogSelectionValidator();
    ViewerFilter filter = getContainerDialogViewerFilter();
    ITreeContentProvider contentProvider = new WorkbenchContentProvider();
    IDecoratorManager decoratorManager = PlatformUI.getWorkbench().getDecoratorManager();
    ILabelProvider labelProvider = new DecoratingLabelProvider(new WorkbenchLabelProvider(), decoratorManager.getLabelDecorator());
    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), labelProvider, contentProvider);
    dialog.setValidator(validator);
    dialog.setTitle(Msgs.portalPropertiesFile);
    dialog.setMessage(Msgs.portalPropertiesFile);
    dialog.addFilter(filter);
    dialog.setInput(CoreUtil.getWorkspaceRoot());
    if (dialog.open() == Window.OK) {
        Object element = dialog.getFirstResult();
        try {
            if (element instanceof IFile) {
                IFile file = (IFile) element;
                text.setText(file.getFullPath().toPortableString());
            } else if (element instanceof IFolder) {
                IFolder folder = (IFolder) element;
                IPath portalPropertiesPath = folder.getFullPath().append("portal.properties");
                text.setText(portalPropertiesPath.toPortableString());
            }
        } catch (Exception ex) {
        // Do nothing
        }
    }
}
Also used : ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) WorkbenchLabelProvider(org.eclipse.ui.model.WorkbenchLabelProvider) IFile(org.eclipse.core.resources.IFile) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) IPath(org.eclipse.core.runtime.IPath) IDecoratorManager(org.eclipse.ui.IDecoratorManager) DecoratingLabelProvider(org.eclipse.jface.viewers.DecoratingLabelProvider) WorkbenchContentProvider(org.eclipse.ui.model.WorkbenchContentProvider) ILabelProvider(org.eclipse.jface.viewers.ILabelProvider) ElementTreeSelectionDialog(org.eclipse.ui.dialogs.ElementTreeSelectionDialog) ISelectionStatusValidator(org.eclipse.ui.dialogs.ISelectionStatusValidator) IFolder(org.eclipse.core.resources.IFolder)

Example 14 with ITreeContentProvider

use of org.eclipse.jface.viewers.ITreeContentProvider in project archi by archimatetool.

the class ColoursPreferencePage method createContents.

@Override
protected Control createContents(Composite parent) {
    // Help
    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, HELPID);
    // Reset everything
    resetColorsCache(false);
    fImageRegistry = new ImageRegistry();
    Composite client = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout(2, false);
    layout.marginWidth = layout.marginHeight = 0;
    client.setLayout(layout);
    Label label = new Label(client, SWT.NULL);
    label.setText(Messages.ColoursPreferencePage_0);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    label.setLayoutData(gd);
    // Tree
    fTreeViewer = new TreeViewer(client);
    GridDataFactory.create(GridData.FILL_BOTH).hint(SWT.DEFAULT, 200).applyTo(fTreeViewer.getTree());
    // Mac Silicon Item height
    UIUtils.fixMacSiliconItemHeight(fTreeViewer.getTree());
    // Tree Double-click listener
    fTreeViewer.addDoubleClickListener(new IDoubleClickListener() {

        @Override
        public void doubleClick(DoubleClickEvent event) {
            Object[] selected = ((IStructuredSelection) fTreeViewer.getSelection()).toArray();
            if (isValidTreeSelection(selected)) {
                RGB newRGB = openColorDialog(selected[0]);
                if (newRGB != null) {
                    for (Object object : selected) {
                        setColor(object, newRGB);
                    }
                }
            }
        }
    });
    // Tree Selection Changed Listener
    fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            Object[] selected = ((IStructuredSelection) event.getSelection()).toArray();
            fEditFillColorButton.setEnabled(isValidTreeSelection(selected));
            fResetFillColorButton.setEnabled(isValidTreeSelection(selected));
        }
    });
    // Tree Content Provider
    fTreeViewer.setContentProvider(new ITreeContentProvider() {

        @Override
        public void dispose() {
        }

        @Override
        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
        }

        @Override
        public Object[] getElements(Object inputElement) {
            if (inputElement instanceof String) {
                return new Object[] { new TreeGrouping(Messages.ColoursPreferencePage_1, ArchimateModelUtils.getStrategyClasses()), new TreeGrouping(Messages.ColoursPreferencePage_2, ArchimateModelUtils.getBusinessClasses()), new TreeGrouping(Messages.ColoursPreferencePage_3, ArchimateModelUtils.getApplicationClasses()), new TreeGrouping(Messages.ColoursPreferencePage_4, ArchimateModelUtils.getTechnologyClasses()), new TreeGrouping(Messages.ColoursPreferencePage_5, ArchimateModelUtils.getPhysicalClasses()), new TreeGrouping(Messages.ColoursPreferencePage_6, ArchimateModelUtils.getMotivationClasses()), new TreeGrouping(Messages.ColoursPreferencePage_7, ArchimateModelUtils.getImplementationMigrationClasses()), new TreeGrouping(Messages.ColoursPreferencePage_8, ArchimateModelUtils.getOtherClasses()), new TreeGrouping(Messages.ColoursPreferencePage_9, new Object[] { IArchimatePackage.eINSTANCE.getDiagramModelNote(), IArchimatePackage.eINSTANCE.getDiagramModelGroup() }), new TreeGrouping(Messages.ColoursPreferencePage_10, new FolderType[] { FolderType.STRATEGY, FolderType.BUSINESS, FolderType.APPLICATION, FolderType.TECHNOLOGY, FolderType.MOTIVATION, FolderType.IMPLEMENTATION_MIGRATION, FolderType.OTHER, FolderType.RELATIONS, FolderType.DIAGRAMS }), DEFAULT_ELEMENT_LINE_COLOR, DEFAULT_CONNECTION_LINE_COLOR };
            }
            return null;
        }

        @Override
        public Object[] getChildren(Object parentElement) {
            if (parentElement instanceof TreeGrouping) {
                return ((TreeGrouping) parentElement).children;
            }
            return null;
        }

        @Override
        public Object getParent(Object element) {
            return null;
        }

        @Override
        public boolean hasChildren(Object element) {
            return element instanceof TreeGrouping;
        }
    });
    // Tree Label Provider
    fTreeViewer.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(Object element) {
            if (element instanceof EClass) {
                return ArchiLabelProvider.INSTANCE.getDefaultName((EClass) element);
            }
            if (element instanceof TreeGrouping) {
                return ((TreeGrouping) element).title;
            }
            if (element instanceof String) {
                String s = (String) element;
                if (s.equals(DEFAULT_ELEMENT_LINE_COLOR)) {
                    return Messages.ColoursPreferencePage_11;
                }
                if (s.equals(DEFAULT_CONNECTION_LINE_COLOR)) {
                    return Messages.ColoursPreferencePage_12;
                }
                return s;
            }
            if (element instanceof FolderType) {
                return ((FolderType) element).getLabel();
            }
            return null;
        }

        @Override
        public Image getImage(Object element) {
            if (element instanceof TreeGrouping) {
                return IArchiImages.ImageFactory.getImage(IArchiImages.ICON_FOLDER_DEFAULT);
            }
            return getColorSwatch(element);
        }

        // Create a coloured image based on colour and add to the image registry
        private Image getColorSwatch(Object object) {
            String key = getColorKey(object);
            Image image = fImageRegistry.get(key);
            if (image == null) {
                image = new Image(Display.getCurrent(), 16, 16);
                GC gc = new GC(image);
                gc.setBackground(fColorsCache.get(object));
                gc.fillRectangle(0, 0, 15, 15);
                gc.drawRectangle(0, 0, 15, 15);
                gc.dispose();
                image = ImageFactory.getAutoScaledImage(image);
                fImageRegistry.put(key, image);
            }
            return image;
        }
    });
    // fTreeViewer.setAutoExpandLevel(2);
    // Buttons
    Composite buttonClient = new Composite(client, SWT.NULL);
    gd = new GridData(SWT.TOP, SWT.TOP, false, false);
    buttonClient.setLayoutData(gd);
    buttonClient.setLayout(new GridLayout());
    // Edit...
    fEditFillColorButton = new Button(buttonClient, SWT.PUSH);
    fEditFillColorButton.setText(Messages.ColoursPreferencePage_13);
    fEditFillColorButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fEditFillColorButton.setEnabled(false);
    fEditFillColorButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            Object[] selected = ((IStructuredSelection) fTreeViewer.getSelection()).toArray();
            if (isValidTreeSelection(selected)) {
                RGB newRGB = openColorDialog(selected[0]);
                if (newRGB != null) {
                    for (Object object : selected) {
                        setColor(object, newRGB);
                    }
                }
            }
        }
    });
    // Reset
    fResetFillColorButton = new Button(buttonClient, SWT.PUSH);
    fResetFillColorButton.setText(Messages.ColoursPreferencePage_14);
    fResetFillColorButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fResetFillColorButton.setEnabled(false);
    fResetFillColorButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            Object[] selected = ((IStructuredSelection) fTreeViewer.getSelection()).toArray();
            if (isValidTreeSelection(selected)) {
                for (Object object : selected) {
                    resetColorToInbuiltDefault(object);
                }
            }
        }
    });
    // Import Scheme
    Button importButton = new Button(buttonClient, SWT.PUSH);
    importButton.setText(Messages.ColoursPreferencePage_15);
    importButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    importButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            try {
                importUserColors();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
    });
    // Export Scheme
    Button exportButton = new Button(buttonClient, SWT.PUSH);
    exportButton.setText(Messages.ColoursPreferencePage_16);
    exportButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    exportButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            try {
                exportUserColors();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
    });
    Group elementColorGroup = new Group(client, SWT.NULL);
    elementColorGroup.setLayout(new GridLayout(2, false));
    elementColorGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    elementColorGroup.setText(Messages.ColoursPreferencePage_17);
    // Derive element line colours
    fDeriveElementLineColorsButton = new Button(elementColorGroup, SWT.CHECK);
    fDeriveElementLineColorsButton.setText(Messages.ColoursPreferencePage_18);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    fDeriveElementLineColorsButton.setLayoutData(gd);
    fDeriveElementLineColorsButton.setSelection(getPreferenceStore().getBoolean(DERIVE_ELEMENT_LINE_COLOR));
    fDeriveElementLineColorsButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            fElementLineColorContrastSpinner.setEnabled(fDeriveElementLineColorsButton.getSelection());
            fContrastFactorLabel.setEnabled(fDeriveElementLineColorsButton.getSelection());
        }
    });
    fContrastFactorLabel = new Label(elementColorGroup, SWT.NULL);
    fContrastFactorLabel.setText(Messages.ColoursPreferencePage_19);
    fElementLineColorContrastSpinner = new Spinner(elementColorGroup, SWT.BORDER);
    fElementLineColorContrastSpinner.setMinimum(1);
    fElementLineColorContrastSpinner.setMaximum(10);
    fElementLineColorContrastSpinner.setSelection(getPreferenceStore().getInt(DERIVE_ELEMENT_LINE_COLOR_FACTOR));
    label = new Label(elementColorGroup, SWT.NULL);
    label.setText(Messages.ColoursPreferencePage_20);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    // Persist user default colours
    fPersistUserDefaultColors = new Button(client, SWT.CHECK);
    fPersistUserDefaultColors.setText(Messages.ColoursPreferencePage_21);
    fPersistUserDefaultColors.setLayoutData(gd);
    fPersistUserDefaultColors.setSelection(getPreferenceStore().getBoolean(SAVE_USER_DEFAULT_COLOR));
    // Set tree input
    // $NON-NLS-1$
    fTreeViewer.setInput("");
    return client;
}
Also used : ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) Group(org.eclipse.swt.widgets.Group) TreeViewer(org.eclipse.jface.viewers.TreeViewer) Spinner(org.eclipse.swt.widgets.Spinner) Label(org.eclipse.swt.widgets.Label) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) TreeViewer(org.eclipse.jface.viewers.TreeViewer) Viewer(org.eclipse.jface.viewers.Viewer) Image(org.eclipse.swt.graphics.Image) GridLayout(org.eclipse.swt.layout.GridLayout) EClass(org.eclipse.emf.ecore.EClass) Button(org.eclipse.swt.widgets.Button) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GC(org.eclipse.swt.graphics.GC) FolderType(com.archimatetool.model.FolderType) Composite(org.eclipse.swt.widgets.Composite) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) IOException(java.io.IOException) RGB(org.eclipse.swt.graphics.RGB) ImageRegistry(org.eclipse.jface.resource.ImageRegistry) GridData(org.eclipse.swt.layout.GridData) ArchiLabelProvider(com.archimatetool.editor.ui.ArchiLabelProvider) LabelProvider(org.eclipse.jface.viewers.LabelProvider)

Example 15 with ITreeContentProvider

use of org.eclipse.jface.viewers.ITreeContentProvider in project rap by entirej.

the class EJRWTTreeTableRecordBlockDefinition method addTreeTable.

private EJRWTTreeRendererDefinitionControl addTreeTable(EJDevBlockDisplayProperties blockDisplayProperties, Composite client, FormToolkit toolkit) {
    Map<String, Integer> columnPositions = new HashMap<String, Integer>();
    final ScrolledForm sc = toolkit.createScrolledForm(client);
    GridData scgd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    scgd.grabExcessHorizontalSpace = true;
    scgd.grabExcessVerticalSpace = true;
    sc.setLayoutData(scgd);
    GridLayout gl = new GridLayout();
    gl.marginHeight = gl.marginWidth = 0;
    sc.getBody().setLayout(gl);
    toolkit.adapt(sc);
    sc.getBody().setLayout(new FillLayout());
    Composite tablePanel = sc.getBody();
    EJDevItemGroupDisplayProperties displayProperties = null;
    if (blockDisplayProperties.getMainScreenItemGroupDisplayContainer().getAllItemGroupDisplayProperties().size() > 0) {
        displayProperties = blockDisplayProperties.getMainScreenItemGroupDisplayContainer().getAllItemGroupDisplayProperties().iterator().next();
        if (displayProperties.dispayGroupFrame()) {
            Group group = new Group(tablePanel, SWT.NONE);
            group.setLayout(new FillLayout());
            if (displayProperties.getFrameTitle() != null && displayProperties.getFrameTitle().length() > 0)
                group.setText(displayProperties.getFrameTitle());
            tablePanel = group;
        }
    }
    Tree table = new Tree(tablePanel, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    TableLayout tableLayout = new TableLayout();
    // There is only one item group for a flow layout
    TreeViewer _tableViewer = new TreeViewer(table);
    _tableViewer.setContentProvider(new ITreeContentProvider() {

        @Override
        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
        // TODO Auto-generated method stub
        }

        @Override
        public void dispose() {
        // TODO Auto-generated method stub
        }

        @Override
        public boolean hasChildren(Object element) {
            return true;
        }

        @Override
        public Object getParent(Object element) {
            return null;
        }

        @Override
        public Object[] getElements(Object inputElement) {
            return new Object[] { new Object(), new Object(), new Object() };
        }

        @Override
        public Object[] getChildren(Object parentElement) {
            return new Object[] { new Object(), new Object() };
        }
    });
    int itemCount = 0;
    if (displayProperties != null)
        for (final EJDevScreenItemDisplayProperties screenItem : displayProperties.getAllItemDisplayProperties()) {
            if (!screenItem.isSpacerItem()) {
                int width = ((EJDevMainScreenItemDisplayProperties) screenItem).getBlockRendererRequiredProperties().getIntProperty(EJRWTMultiRecordBlockDefinitionProperties.DISPLAY_WIDTH_PROPERTY, 0);
                TreeViewerColumn masterColumn = new TreeViewerColumn(_tableViewer, SWT.NONE);
                masterColumn.getColumn().setData("SCREEN_ITEM", screenItem);
                masterColumn.getColumn().setText(screenItem.getLabel());
                masterColumn.getColumn().setWidth(width);
                String alignment = ((EJDevMainScreenItemDisplayProperties) screenItem).getBlockRendererRequiredProperties().getStringProperty(EJRWTMultiRecordBlockDefinitionProperties.COLUMN_ALIGNMENT);
                if (EJRWTMultiRecordBlockDefinitionProperties.COLUMN_ALLIGN_RIGHT.equals(alignment)) {
                    masterColumn.getColumn().setAlignment(SWT.RIGHT);
                } else if (EJRWTMultiRecordBlockDefinitionProperties.COLUMN_ALLIGN_CENTER.equals(alignment)) {
                    masterColumn.getColumn().setAlignment(SWT.CENTER);
                }
                masterColumn.setLabelProvider(new ColumnLabelProvider() {

                    @Override
                    public String getText(Object element) {
                        return screenItem.getReferencedItemName();
                    }
                });
                ColumnWeightData colData = new ColumnWeightData(5, 50, true);
                tableLayout.addColumnData(colData);
                columnPositions.put(screenItem.getReferencedItemName(), itemCount);
                itemCount++;
            }
        }
    table.setLayout(tableLayout);
    _tableViewer.setInput(new Object());
    return new EJRWTTreeRendererDefinitionControl(blockDisplayProperties, table, columnPositions);
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) EJDevPropertyDefinitionGroup(org.entirej.framework.dev.properties.EJDevPropertyDefinitionGroup) EJPropertyDefinitionGroup(org.entirej.framework.core.properties.definitions.interfaces.EJPropertyDefinitionGroup) Group(org.eclipse.swt.widgets.Group) ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) EJDevScreenItemDisplayProperties(org.entirej.framework.dev.properties.interfaces.EJDevScreenItemDisplayProperties) HashMap(java.util.HashMap) TreeViewer(org.eclipse.jface.viewers.TreeViewer) Viewer(org.eclipse.jface.viewers.Viewer) TreeViewer(org.eclipse.jface.viewers.TreeViewer) EJDevMainScreenItemDisplayProperties(org.entirej.framework.dev.properties.interfaces.EJDevMainScreenItemDisplayProperties) ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) GridLayout(org.eclipse.swt.layout.GridLayout) Tree(org.eclipse.swt.widgets.Tree) TableLayout(org.eclipse.jface.viewers.TableLayout) EJDevItemGroupDisplayProperties(org.entirej.framework.dev.properties.interfaces.EJDevItemGroupDisplayProperties) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) FillLayout(org.eclipse.swt.layout.FillLayout) TreeViewerColumn(org.eclipse.jface.viewers.TreeViewerColumn) ScrolledForm(org.eclipse.ui.forms.widgets.ScrolledForm) GridData(org.eclipse.swt.layout.GridData)

Aggregations

ITreeContentProvider (org.eclipse.jface.viewers.ITreeContentProvider)68 Viewer (org.eclipse.jface.viewers.Viewer)32 LabelProvider (org.eclipse.jface.viewers.LabelProvider)19 GridData (org.eclipse.swt.layout.GridData)19 Composite (org.eclipse.swt.widgets.Composite)17 TreeViewer (org.eclipse.jface.viewers.TreeViewer)16 GridLayout (org.eclipse.swt.layout.GridLayout)15 Label (org.eclipse.swt.widgets.Label)13 ILabelProvider (org.eclipse.jface.viewers.ILabelProvider)12 ViewerComparator (org.eclipse.jface.viewers.ViewerComparator)12 CheckStateChangedEvent (org.eclipse.jface.viewers.CheckStateChangedEvent)11 ICheckStateListener (org.eclipse.jface.viewers.ICheckStateListener)11 ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)11 WorkbenchContentProvider (org.eclipse.ui.model.WorkbenchContentProvider)11 WorkbenchLabelProvider (org.eclipse.ui.model.WorkbenchLabelProvider)11 ArrayList (java.util.ArrayList)10 CheckboxTreeViewer (org.eclipse.jface.viewers.CheckboxTreeViewer)9 ElementTreeSelectionDialog (org.eclipse.ui.dialogs.ElementTreeSelectionDialog)9 StructuredViewer (org.eclipse.jface.viewers.StructuredViewer)8 SourceViewer (org.eclipse.jface.text.source.SourceViewer)7