List of usage examples for org.eclipse.jface.resource JFaceResources getImage
public static Image getImage(String key)
null
if none. From source file:com.mindquarry.desktop.minutes.editor.MinutesEditor.java
License:Open Source License
/** * Creates the main window's contents/*from w w w.j a va 2 s. c o m*/ * * @param parent the main window * @return Control */ @Override protected Control createContents(Composite parent) { initRegistries(); SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL); sashForm.setLayoutData(new GridData(GridData.FILL_BOTH)); new PeopleWidget(sashForm, SWT.BORDER); new ConversationWidget(sashForm, SWT.BORDER); sashForm.setWeights(new int[] { 1, 3 }); // init window shell Window.setDefaultImage(JFaceResources.getImage(EDITOR_IMG_KEY)); getShell().setImage(JFaceResources.getImage(EDITOR_IMG_KEY)); getShell().setText(EDITOR_TITLE); getShell().setSize(600, 400); setStatus("Ready."); return parent; }
From source file:com.mindquarry.desktop.preferences.pages.ServerProfilesPage.java
License:Open Source License
private void createMindquarryServerSettings(Composite parent) { mqServerSettings = new Composite(parent, SWT.NORMAL); mqServerSettings.setLayoutData(new GridData(GridData.FILL_BOTH)); mqServerSettings.setLayout(new GridLayout(1, true)); // initialize server URL section CLabel quarryEndpointLabel = new CLabel(mqServerSettings, SWT.LEFT); quarryEndpointLabel.setText(I18N.get("URL of the Mindquarry Server:")); //$NON-NLS-1$ quarryEndpointLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite errorComp = createErrorBorderComposite(mqServerSettings, 1); url = new Text(errorComp, SWT.SINGLE | SWT.BORDER); registerErrorBorderComposite(errorComp, url); url.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); url.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String[] selection = profileList.getSelection(); if (selection.length > 0) { Profile profile = findByName(selection[0]); profile.setServerURL(url.getText()); performValidation();// ww w . ja v a 2 s.c o m } } }); url.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent e) { url.selectAll(); } }); // initialize login section CLabel loginLabel = new CLabel(mqServerSettings, SWT.LEFT); loginLabel.setText(I18N.get("Your Login ID:")); //$NON-NLS-1$ loginLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); errorComp = createErrorBorderComposite(mqServerSettings, 1); login = new Text(errorComp, SWT.SINGLE | SWT.BORDER); registerErrorBorderComposite(errorComp, login); login.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); login.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String[] selection = profileList.getSelection(); if (selection.length > 0) { Profile profile = findByName(selection[0]); profile.setLogin(login.getText()); performValidation(); } } }); login.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent e) { login.selectAll(); } }); // initialize password section CLabel pwdLabel = new CLabel(mqServerSettings, SWT.LEFT); pwdLabel.setText(I18N.get("Your Password:")); //$NON-NLS-1$ pwdLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); errorComp = createErrorBorderComposite(mqServerSettings, 1); pwd = new Text(errorComp, SWT.PASSWORD | SWT.BORDER); registerErrorBorderComposite(errorComp, pwd); pwd.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); pwd.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String[] selection = profileList.getSelection(); if (selection.length > 0) { Profile profile = findByName(selection[0]); profile.setPassword(pwd.getText()); performValidation(); } } }); pwd.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent e) { pwd.selectAll(); } }); // init verify server button Composite verifyArea = new Composite(mqServerSettings, SWT.NONE); verifyArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout layout = new GridLayout(2, false); layout.marginBottom = 0; layout.marginTop = 0; layout.marginLeft = 0; layout.marginRight = 0; layout.marginHeight = 0; layout.marginWidth = 0; verifyArea.setLayout(layout); Button verifyServerButton = new Button(verifyArea, SWT.LEFT | SWT.PUSH); verifyServerButton.setText(I18N.get("Verify server settings")); final CLabel verifiedLabel = new CLabel(verifyArea, SWT.WRAP); verifiedLabel.setLayoutData(new GridData(300, 20)); verifyServerButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { try { HttpUtilities.CheckResult result = HttpUtilities.checkServerExistence(login.getText(), pwd.getText(), url.getText()); if (HttpUtilities.CheckResult.AUTH_REFUSED == result) { String msg = I18N.get("Login ID or password is incorrect."); setInvalid(msg, login, pwd); verifiedLabel.setText(msg); verifiedLabel.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR)); } else if (HttpUtilities.CheckResult.NOT_AVAILABLE == result) { String msg = I18N.get("Server could not be found."); setInvalid(msg, url); verifiedLabel.setText(msg); verifiedLabel.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR)); } else { setValid(); String msg = I18N.get("Server settings are correct."); setMessage(msg, INFORMATION); verifiedLabel.setText(msg); verifiedLabel.setImage(OK_IMAGE); } } catch (MalformedURLException murle) { String msg = I18N.get("Server URL is not a valid URL ({0})", murle.getLocalizedMessage()); setInvalid(msg, url); verifiedLabel.setText(msg); verifiedLabel.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR)); } verifiedLabel.getParent().layout(); } }); // initialize workspace folder section CLabel locationLabel = new CLabel(mqServerSettings, SWT.LEFT); locationLabel.setText(I18N.get("Folder for Workspaces:")); //$NON-NLS-1$ locationLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite locationArea = new Composite(mqServerSettings, SWT.NONE); locationArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); layout = new GridLayout(2, false); layout.marginBottom = 0; layout.marginTop = 0; layout.marginLeft = 0; layout.marginRight = 0; layout.marginHeight = 0; layout.marginWidth = 0; locationArea.setLayout(layout); errorComp = createErrorBorderComposite(locationArea, 1); folder = new Text(errorComp, SWT.BORDER); registerErrorBorderComposite(errorComp, folder); folder.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); folder.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String[] selection = profileList.getSelection(); if (selection.length > 0) { Profile profile = findByName(selection[0]); profile.setWorkspaceFolder(folder.getText()); performValidation(); } } }); folder.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent e) { folder.selectAll(); } }); Button selectWSLocationButton = new Button(locationArea, SWT.PUSH); selectWSLocationButton.setText(I18N.get("Browse")); //$NON-NLS-1$ selectWSLocationButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { DirectoryDialog fd = new DirectoryDialog(getShell(), SWT.OPEN); fd.setText(I18N.get("Select folder for workspaces.")); //$NON-NLS-1$ String path = fd.open(); if (path != null) { folder.setText(path); } } }); }
From source file:com.mmkarton.mx7.reportgenerator.util.ProcedureFlagNode.java
License:Open Source License
public Image getImage() { return JFaceResources.getImage(PROCEDURE_FLAG_ICON); }
From source file:com.mmkarton.mx7.reportgenerator.util.TableColumnNode.java
License:Open Source License
public Image getImage() { return JFaceResources.getImage(COLUMN_ICON); }
From source file:com.mmkarton.mx7.reportgenerator.util.TableNode.java
License:Open Source License
public Image getImage() { return isView ? JFaceResources.getImage(VIEW_ICON) : JFaceResources.getImage(TABLE_ICON); }
From source file:com.nokia.carbide.remoteconnections.view.ConnectionsView.java
License:Open Source License
private void makeActions() { actions = new ArrayList<Action>(); connectionSelectedActions = new ArrayList<Action>(); serviceSelectedActions = new ArrayList<Action>(); Action action = new Action(Messages.getString("ConnectionsView.NewActionLabel"), CONNECTION_NEW_IMGDESC) { //$NON-NLS-1$ @Override/*from ww w.j a v a2s. c om*/ public void run() { SettingsWizard wizard = new SettingsWizard(); wizard.open(getViewSite().getShell()); } }; action.setId(NEW_ACTION); actions.add(action); action.setEnabled(!Registry.instance().getConnectionTypes().isEmpty()); String editLabel = Messages.getString("ConnectionsView.EditActionLabel"); //$NON-NLS-1$ action = new Action(editLabel, CONNECTION_EDIT_IMGDESC) { //$NON-NLS-1$ @Override public void run() { ISelection selection = viewer.getSelection(); if (selection.isEmpty()) return; TreeNode node = (TreeNode) ((IStructuredSelection) selection).getFirstElement(); Object value = node.getValue(); if (value instanceof IConnection) { SettingsWizard wizard = new SettingsWizard((IConnection) value); wizard.open(getViewSite().getShell()); } } }; action.setId(EDIT_ACTION); actions.add(action); connectionSelectedActions.add(action); action = new Action() { @Override public void run() { ISelection selection = viewer.getSelection(); if (selection.isEmpty()) return; TreeNode node = (TreeNode) ((IStructuredSelection) selection).getFirstElement(); Object value = node.getValue(); if (value instanceof IConnection) { viewer.editElement(node, 0); } } @Override public boolean isEnabled() { return selectionCanBeEdited(); } }; action.setId(RENAME_ACTION); action.setAccelerator(SWT.F2); action.setText(Messages.getString("ConnectionsView.RenameMenuLabel") + //$NON-NLS-1$ "\t" + //$NON-NLS-1$ LegacyActionTools.convertAccelerator(action.getAccelerator())); actions.add(action); connectionSelectedActions.add(action); action = new EnableConnectedServiceAction(); action.setId(ENABLE_SERVICE_ACTION); actions.add(action); serviceSelectedActions.add(action); action = new Action(Messages.getString("ConnectionsView.RefreshActionLabel"), CONNECTION_REFRESH_IMGDESC) { //$NON-NLS-1$ @Override public void run() { IConnectionsManager connectionsManager = Registry.instance(); for (IConnection connection : connectionsManager.getConnections()) { Collection<IConnectedService> connectedServices = connectionsManager .getConnectedServices(connection); for (IConnectedService connectedService : connectedServices) { connectedService.setEnabled(true); connectedService.testStatus(); } } ((EnableConnectedServiceAction) getAction(ENABLE_SERVICE_ACTION)).updateLabel(); } }; action.setAccelerator(SWT.F5); action.setId(REFRESH_ACTION); action.setEnabled(RemoteConnectionsActivator.getDefault().getShouldTestServices()); actions.add(action); action = new Action(Messages.getString("ConnectionsView.DeleteActionLabel"), //$NON-NLS-1$ PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)) { @Override public void run() { ISelection selection = viewer.getSelection(); if (selection.isEmpty() || !canBeEdited(selection)) return; TreeNode node = (TreeNode) ((IStructuredSelection) selection).getFirstElement(); Object value = node.getValue(); if (value instanceof IConnection) { Registry.instance().removeConnection((IConnection) value); Registry.instance().storeConnections(); } } @Override public boolean isEnabled() { return selectionCanBeEdited(); } }; action.setAccelerator(SWT.DEL); action.setId(DELETE_ACTION); actions.add(action); connectionSelectedActions.add(action); Image image = JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_HELP); ImageDescriptor desc = ImageDescriptor.createFromImage(image); action = new Action(Messages.getString("ConnectionsView.NoHelpActionLabel"), desc) { //$NON-NLS-1$ private String getHelpContextFromSelection() { IConnection connection = getSelectedConnection(); if (connection != null) { return connection.getConnectionType().getHelpContext(); } return null; } @Override public String getText() { if (isEnabled()) { IConnection connection = getSelectedConnection(); IConnectionType connectionType = connection.getConnectionType(); String displayName = connectionType.getDisplayName(); String pattern = Messages.getString("ConnectionsView.HelpActionLabel"); //$NON-NLS-1$ return MessageFormat.format(pattern, displayName); } return super.getText(); } @Override public boolean isEnabled() { return getHelpContextFromSelection() != null; } @Override public void run() { PlatformUI.getWorkbench().getHelpSystem().displayHelp(getHelpContextFromSelection()); } }; action.setId(HELP_ACTION); actions.add(action); connectionSelectedActions.add(action); desc = ConnectionUIUtils.CONNECTION_IMGDESC; action = new Action(Messages.getString("ConnectionsView.SetCurrentActionLabel"), desc) { //$NON-NLS-1$ @Override public boolean isEnabled() { return !ObjectUtils.equals(Registry.instance().getCurrentConnection(), getSelectedConnection()); } @Override public void run() { Registry.instance().setCurrentConnection(getSelectedConnection()); setEnabled(false); } }; action.setId(SET_CURRENT_ACTION); actions.add(action); connectionSelectedActions.add(action); action = new Action(Messages.getString("ConnectionsView.ToggleServicesLabel"), IAction.AS_CHECK_BOX) { //$NON-NLS-1$ public void setChecked(boolean checked) { if (isChecked() != checked) { super.setChecked(checked); RemoteConnectionsActivator.getDefault().setShouldTestServices(checked); setImageDescriptor(checked ? SERVICE_TEST_IMGDESC : SERVICE_TEST_DISABLED_IMGDESC); } }; }; action.setId(TOGGLE_SERVICES_ACTION); action.setChecked(RemoteConnectionsActivator.getDefault().getShouldTestServices()); action.setImageDescriptor(action.isChecked() ? SERVICE_TEST_IMGDESC : SERVICE_TEST_DISABLED_IMGDESC); actions.add(action); enableConnectionSelectedActions(false); enableServiceSelectedActions(false); makeToggleDiscoveryAgentActions(); toggleServicesTestingListener = new IToggleServicesTestingListener() { public void servicesTestingToggled(boolean enabled) { getAction(TOGGLE_SERVICES_ACTION).setChecked(enabled); getAction(REFRESH_ACTION).setEnabled(enabled); } }; RemoteConnectionsActivator.getDefault().addToggleServicesTestingListener(toggleServicesTestingListener); }
From source file:com.nokia.s60tools.analyzetool.global.Util.java
License:Open Source License
public static ToolBar createHelpControl(Composite parent) { ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); ((GridLayout) parent.getLayout()).numColumns++; toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); toolBar.setCursor(cursor);/*from ww w. j a va 2 s . c o m*/ toolBar.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { cursor.dispose(); } }); ToolItem item = new ToolItem(toolBar, SWT.NONE); item.setImage(JFaceResources.getImage(Dialog.DLG_IMG_HELP)); item.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ item.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { PlatformUI.getWorkbench().getHelpSystem() .displayHelp(AnalyzeToolHelpContextIDs.ANALYZE_TROUBLESHOOTING); } }); return toolBar; }
From source file:com.nokia.tools.s60ct.confml.widgets.ErrorToolTipWidget.java
License:Open Source License
private static void buildErrorImage(Shell errorToolTip) { Label imageLabel = new Label(errorToolTip, SWT.NONE); imageLabel.setForeground(errorToolTip.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND)); imageLabel.setBackground(errorToolTip.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); imageLabel.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR)); }
From source file:com.nokia.tools.screen.ui.dialogs.MessageDialogWithCheckBox.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { if (helpID != null) { Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); if (helpImage != null) { createHelpImageButton(parent, helpImage); ((GridLayout) parent.getLayout()).numColumns++; // Dummy label to fill space Label label = new Label(parent, SWT.NONE); GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING); label.setLayoutData(gd);//from w w w. j a v a2 s .c o m super.createButtonsForButtonBar(parent); ((GridLayout) parent.getLayout()).makeColumnsEqualWidth = false; ((GridData) parent.getLayoutData()).widthHint = 420; } } else super.createButtonsForButtonBar(parent); }
From source file:com.nokia.tools.theme.s60.ui.preferences.ComponentStorePrefPage.java
License:Open Source License
private Composite setWarningMessage(Composite parent) { if (warningMessage != null) { messageComposite = new Composite(parent, SWT.NONE); GridLayout messageLayout = new GridLayout(); messageLayout.numColumns = 2;//from w w w. ja v a 2 s . c om messageLayout.marginWidth = 0; messageLayout.marginHeight = 0; messageLayout.makeColumnsEqualWidth = false; messageComposite.setLayout(messageLayout); messageImageLabel = new Label(messageComposite, SWT.NONE); messageImageLabel.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING)); messageImageLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); messageText = new Text(messageComposite, SWT.WRAP); messageText.setEditable(false); GridData textData = new GridData( GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER); messageText.setLayoutData(textData); messageText.setText(warningMessage); } return messageComposite; }