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

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

Introduction

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

Prototype

public Image createImage() 

Source Link

Document

Creates and returns a new SWT image for this image descriptor.

Usage

From source file:com.astra.ses.spell.gui.dialogs.StringDialog.java

License:Open Source License

/***************************************************************************
 * Constructor//from w  w  w .  j  av  a  2 s  . c om
 **************************************************************************/
public StringDialog(Shell shell, String title, String msg, String longMsg, boolean hideType) {
    super(shell);
    // Obtain the image for the dialog icon
    ImageDescriptor descr = Activator.getImageDescriptor("icons/dlg_question.png");
    m_image = descr.createImage();
    m_message = msg;
    m_longMessage = longMsg;
    m_title = title;
    m_answer = null;
    m_text = null;
    m_hideType = hideType;
}

From source file:com.astra.ses.spell.gui.model.callstack.CallstackLabelProvider.java

License:Open Source License

/**************************************************************************
 * Constructor.//from w w w  .jav a  2s.  c  om
 *************************************************************************/
public CallstackLabelProvider() {
    ImageDescriptor descr = Activator.getImageDescriptor("icons/16x16/procedure.jpg");
    m_imgProc = descr.createImage();
    descr = Activator.getImageDescriptor("icons/16x16/liveExecutionNode.png");
    m_imgLiveNode = descr.createImage();
    descr = Activator.getImageDescriptor("icons/16x16/finishedExecutionNode.png");
    m_imgFinishedNode = descr.createImage();

    m_finishedColor = new Color(Display.getDefault(), 128, 128, 128);
}

From source file:com.astra.ses.spell.gui.model.dialogs.VariableDetailDialog.java

License:Open Source License

/***************************************************************************
 * Constructor/*w w w.j  a  v a  2 s.c  om*/
 **************************************************************************/
public VariableDetailDialog(Shell parentShell, VariableData var) {
    super(parentShell);
    m_variable = var;
    // Obtain the image for the dialog icon
    String baseLocation = "platform:/plugin/" + Fragment.FRAGMENT_ID;
    ImageDescriptor descr = Activator.getImageDescriptor(baseLocation + "/icons/48x48/glasses.png");
    m_image = descr.createImage();
    m_font = new Font(parentShell.getDisplay(), "Courier New", 10, SWT.NORMAL);
}

From source file:com.astra.ses.spell.gui.preferences.ui.pages.PresentationsPreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {

    GridLayout parentLayout = new GridLayout(3, true);
    GridData parentData = new GridData(GridData.FILL_BOTH);
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(parentLayout);/*from   w  w  w .j ava  2  s.c om*/
    container.setLayoutData(parentData);

    Label enabled = new Label(container, SWT.NONE);
    enabled.setText("Enabled presentations");

    Label empty = new Label(container, SWT.NONE);
    empty.setText("");

    Label disabled = new Label(container, SWT.NONE);
    disabled.setText("Disabled presentations");

    /*
     * Enabled presentations list widget
     */
    m_enabledList = new List(container, SWT.SINGLE | SWT.BORDER);
    GridData enabledData = new GridData(GridData.FILL_BOTH);
    enabledData.verticalSpan = 4;
    m_enabledList.setLayoutData(enabledData);

    /*
     * List control button
     */
    GridData expandButton = new GridData(GridData.FILL_HORIZONTAL);
    expandButton.verticalAlignment = SWT.TOP;

    ImageDescriptor imgDes = Activator.imageDescriptorFromPlugin(Fragment.FRAGMENT_UI, "icons/arrow_up.png");
    final Button up = new Button(container, SWT.PUSH);
    up.setText("UP");
    up.setImage(imgDes.createImage());
    up.setEnabled(false);
    up.setLayoutData(GridDataFactory.copyData(expandButton));

    /*
     * Disable presentations list
     */
    m_disabledList = new List(container, SWT.SINGLE | SWT.BORDER);
    m_disabledList.setLayoutData(GridDataFactory.copyData(enabledData));

    /*
     * Rest of the list control buttons
     */
    imgDes = Activator.imageDescriptorFromPlugin(Fragment.FRAGMENT_UI, "icons/arrow_down.png");
    final Button down = new Button(container, SWT.PUSH);
    down.setText("DOWN");
    down.setImage(imgDes.createImage());
    down.setEnabled(false);
    down.setLayoutData(GridDataFactory.copyData(expandButton));

    imgDes = Activator.imageDescriptorFromPlugin(Fragment.FRAGMENT_UI, "icons/arrow_right.png");
    final Button disable = new Button(container, SWT.PUSH);
    disable.setText("Disable");
    disable.setImage(imgDes.createImage());
    disable.setEnabled(false);
    disable.setLayoutData(GridDataFactory.copyData(expandButton));

    imgDes = Activator.imageDescriptorFromPlugin(Fragment.FRAGMENT_UI, "icons/arrow_left.png");
    final Button enable = new Button(container, SWT.PUSH);
    enable.setText("Enable");
    enable.setImage(imgDes.createImage());
    enable.setEnabled(false);
    enable.setLayoutData(GridDataFactory.copyData(expandButton));

    /*
     * Enabled list listeners
     */
    m_enabledList.addFocusListener(new FocusListener() {
        @Override
        public void focusLost(FocusEvent e) {
        }

        @Override
        public void focusGained(FocusEvent e) {
            enable.setEnabled(false);
            m_disabledList.deselectAll();
        }
    });

    m_enabledList.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            List list = (List) e.widget;
            boolean presentationSelected = list.getSelectionIndex() != -1;
            up.setEnabled(presentationSelected);
            down.setEnabled(presentationSelected);
            disable.setEnabled(presentationSelected);
            if (m_enabledList.getItemCount() == 1) {
                disable.setEnabled(false);
            }
        }
    });

    /*
     * Disabled list listener
     */
    m_disabledList.addFocusListener(new FocusListener() {
        @Override
        public void focusLost(FocusEvent e) {
        }

        @Override
        public void focusGained(FocusEvent e) {
            disable.setEnabled(false);
            up.setEnabled(false);
            down.setEnabled(false);
            m_enabledList.deselectAll();
        }
    });

    m_disabledList.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            List list = (List) e.widget;
            boolean presentationSelected = list.getSelectionIndex() != -1;
            enable.setEnabled(presentationSelected);
        }
    });

    /*
     * Up button selection listener
     */
    up.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            int selected = m_enabledList.getSelectionIndex();
            // If selected presentation is on top, then return
            if (selected <= 0) {
                return;
            }
            switchListElements(m_enabledList, selected, selected - 1);
        }
    });

    /*
     * Down selection listener
     */
    down.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            int selected = m_enabledList.getSelectionIndex();
            // If selected presentation is on top, then return
            if (selected == m_enabledList.getItems().length - 1) {
                return;
            }
            switchListElements(m_enabledList, selected, selected + 1);
        }
    });

    /*
     * Enable selection listener
     */
    enable.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            int selected = m_disabledList.getSelectionIndex();
            if (selected == -1) {
                return;
            }
            String presentation = m_disabledList.getItem(selected);
            m_enabledList.add(presentation);
            m_disabledList.remove(selected);
            m_disabledList.deselectAll();
        }
    });

    /*
     * Disable selection listener
     */
    disable.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            int selected = m_enabledList.getSelectionIndex();
            if (selected == -1) {
                return;
            }
            String presentation = m_enabledList.getItem(selected);
            m_disabledList.add(presentation);
            m_enabledList.remove(selected);
            m_enabledList.deselectAll();
        }
    });

    Label explanation = new Label(container, SWT.WRAP);
    explanation.setText("First presentation in enabled list will be shown by default when opening a procedure");
    GridData explData = new GridData(GridData.FILL_HORIZONTAL);
    explData.horizontalSpan = 3;
    explanation.setLayoutData(explData);

    /*
     * Fill the list with the preferences contents
     */
    refreshPage();

    return parent;
}

From source file:com.astra.ses.spell.gui.presentation.code.dialogs.ItemInfoDialog.java

License:Open Source License

/***************************************************************************
 * Constructor//from  w w  w.  j av  a2 s  . com
 * 
 * @param shell
 *            The parent shell
 **************************************************************************/
public ItemInfoDialog(Shell shell, String procId, ProcedureLine line, String csPosition) {
    super(shell);
    setShellStyle(SWT.CLOSE | SWT.RESIZE);
    // Obtain the image for the dialog icon
    ImageDescriptor descr = Activator.getImageDescriptor("icons/dlg_detail.png");
    m_image = descr.createImage();
    m_csPosition = csPosition;
    m_procId = procId;
    m_line = line;
}

From source file:com.astra.ses.spell.gui.presentation.code.dialogs.SearchDialog.java

License:Open Source License

/***************************************************************************
 * Constructor/*from   www  . ja  v a 2s  .  c om*/
 * 
 * @param shell
 *            The parent shell
 **************************************************************************/
public SearchDialog(Shell shell, CodeViewer viewer) {
    super(shell);
    setShellStyle(SWT.CLOSE);
    // Obtain the image for the dialog icon
    ImageDescriptor descr = Activator.getImageDescriptor("icons/dlg_detail.png");
    m_image = descr.createImage();
    m_viewer = viewer;
}

From source file:com.astra.ses.spell.gui.replay.dialogs.ExecutionSelectionDialog.java

License:Open Source License

/***************************************************************************
 * Constructor//from   w  w  w . j  a va 2 s. com
 * 
 * @param shell
 *            The parent shell
 **************************************************************************/
public ExecutionSelectionDialog(Shell shell) {
    super(shell);
    if (s_fmgr == null) {
        s_fmgr = (IFileManager) ServiceManager.get(IFileManager.class);
        s_asrunPath = s_fmgr.getServerFilePath(ServerFileType.ASRUN, new NullProgressMonitor());
    }
    m_procNames = new TreeMap<String, String>();
    // Obtain the image for the dialog icon
    ImageDescriptor descr = Activator.getImageDescriptor("icons/dlg_detail.png");
    m_image = descr.createImage();
    m_modelTime = new ExecutionSelectionModelTime(s_asrunPath);
    m_modelName = new ExecutionSelectionModelName(s_asrunPath);
}

From source file:com.astra.ses.spell.gui.watchvariables.dialogs.VariableDetailDialog.java

License:Open Source License

/***************************************************************************
 * Constructor/*from   w w  w .ja v  a  2 s.  com*/
 **************************************************************************/
public VariableDetailDialog(Shell parentShell, String varName, String varValue) {
    super(parentShell);
    m_name = varName;
    m_value = varValue;
    // Obtain the image for the dialog icon
    String baseLocation = "platform:/plugin/" + Activator.PLUGIN_ID;
    ImageDescriptor descr = Activator.getImageDescriptor(baseLocation + "/icons/48x48/glasses.png");
    m_image = descr.createImage();
    m_font = new Font(parentShell.getDisplay(), "Courier New", 10, SWT.NORMAL);
}

From source file:com.atlassian.connector.eclipse.internal.crucible.ui.AvatarImages.java

License:Open Source License

public static Image getImage(String url, ImageDescriptor imageDescriptor) {
    ImageRegistry registry = getImageRegistry();

    Image image = registry.get(url);
    if (image == null) {
        image = imageDescriptor.createImage();
        registry.put(url, image);/*from ww w . j a  va  2 s  . co  m*/
    }
    return image;
}

From source file:com.atlassian.connector.eclipse.internal.crucible.ui.CrucibleImages.java

License:Open Source License

public static Image getImage(ImageDescriptor imageDescriptor) {
    ImageRegistry registry = getImageRegistry();

    Image image = registry.get("" + imageDescriptor.hashCode());
    if (image == null) {
        image = imageDescriptor.createImage();
        registry.put("" + imageDescriptor.hashCode(), image);
    }//from w w w  . ja  v a2 s  .co m
    return image;
}