Search in sources :

Example 6 with PropertyDialogAction

use of org.eclipse.ui.dialogs.PropertyDialogAction in project erlide_eclipse by erlang.

the class ErlangBreakpointPropertiesRulerAction method run.

/**
 * @see Action#run()
 */
@Override
public void run() {
    if (getBreakpoint() != null) {
        final PropertyDialogAction action = new PropertyDialogAction(getEditor().getEditorSite(), new ISelectionProvider() {

            @Override
            public void addSelectionChangedListener(final ISelectionChangedListener listener) {
            }

            @Override
            @SuppressWarnings("synthetic-access")
            public ISelection getSelection() {
                return new StructuredSelection(getBreakpoint());
            }

            @Override
            public void removeSelectionChangedListener(final ISelectionChangedListener listener) {
            }

            @Override
            public void setSelection(final ISelection selection) {
            }
        });
        action.run();
    }
}
Also used : ISelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) ISelection(org.eclipse.jface.viewers.ISelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) PropertyDialogAction(org.eclipse.ui.dialogs.PropertyDialogAction)

Example 7 with PropertyDialogAction

use of org.eclipse.ui.dialogs.PropertyDialogAction in project webtools.sourceediting by eclipse.

the class EditBreakpointAction method run.

public void run() {
    PropertyDialogAction action = new PropertyDialogAction(getTextEditor().getEditorSite(), new ISelectionProvider() {

        public void addSelectionChangedListener(ISelectionChangedListener listener) {
        // do nothing
        }

        public ISelection getSelection() {
            return new StructuredSelection(breakpoints);
        }

        public void removeSelectionChangedListener(ISelectionChangedListener listener) {
        // do nothing
        }

        public void setSelection(ISelection selection) {
        // do nothing
        }
    });
    action.run();
}
Also used : ISelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) ISelection(org.eclipse.jface.viewers.ISelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) PropertyDialogAction(org.eclipse.ui.dialogs.PropertyDialogAction)

Example 8 with PropertyDialogAction

use of org.eclipse.ui.dialogs.PropertyDialogAction in project netxms by netxms.

the class UserManagementView method makeActions.

/**
 * Create actions
 */
private void makeActions() {
    actionRefresh = new RefreshAction(this) {

        @Override
        public void run() {
            viewer.setInput(session.getUserDatabaseObjects());
        }
    };
    actionAddUser = new // $NON-NLS-1$
    Action(// $NON-NLS-1$
    Messages.get().UserManagementView_CreateNewUser, // $NON-NLS-1$
    Activator.getImageDescriptor("icons/user_add.png")) {

        @Override
        public void run() {
            addUser();
        }
    };
    actionAddGroup = new // $NON-NLS-1$
    Action(// $NON-NLS-1$
    Messages.get().UserManagementView_CreateNewGroup, // $NON-NLS-1$
    Activator.getImageDescriptor("icons/group_add.png")) {

        @Override
        public void run() {
            addGroup();
        }
    };
    actionEditUser = new PropertyDialogAction(getSite(), viewer);
    actionEditUser.setText(Messages.get().UserManagementView_Properties);
    actionEditUser.setImageDescriptor(SharedIcons.EDIT);
    actionEditUser.setEnabled(false);
    actionDeleteUser = new Action(Messages.get().UserManagementView_Delete, SharedIcons.DELETE_OBJECT) {

        @Override
        public void run() {
            deleteUser();
        }
    };
    actionDeleteUser.setEnabled(false);
    actionChangePassword = new // $NON-NLS-1$
    Action(// $NON-NLS-1$
    Messages.get().UserManagementView_ChangePassword, // $NON-NLS-1$
    Activator.getImageDescriptor("icons/change_password.png")) {

        @Override
        public void run() {
            changePassword();
        }
    };
    actionChangePassword.setEnabled(false);
    actionEnable = new Action(Messages.get().UserManagementView_Enable) {

        @Override
        public void run() {
            enableUser();
        }
    };
    actionDisable = new Action(Messages.get().UserManagementView_Disable) {

        @Override
        public void run() {
            disableUser();
        }
    };
    actionDetachUserFromLDAP = new Action(Messages.get().UserManagementView_DetachFromLDAP) {

        @Override
        public void run() {
            detachLDAPUser();
        }
    };
}
Also used : Action(org.eclipse.jface.action.Action) PropertyDialogAction(org.eclipse.ui.dialogs.PropertyDialogAction) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) PropertyDialogAction(org.eclipse.ui.dialogs.PropertyDialogAction)

Example 9 with PropertyDialogAction

use of org.eclipse.ui.dialogs.PropertyDialogAction in project netxms by netxms.

the class ObjectToolsEditor method createActions.

/**
 * Create actions
 */
private void createActions() {
    final IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
    actionShowFilter = new Action("Show filter", Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            enableFilter(!initShowFilter);
            actionShowFilter.setChecked(initShowFilter);
        }
    };
    actionShowFilter.setChecked(initShowFilter);
    // $NON-NLS-1$
    actionShowFilter.setActionDefinitionId("org.netxms.ui.eclipse.objecttools.commands.showFilter");
    handlerService.activateHandler(actionShowFilter.getActionDefinitionId(), new ActionHandler(actionShowFilter));
    actionRefresh = new RefreshAction() {

        @Override
        public void run() {
            refreshToolList();
        }
    };
    actionNew = new Action(Messages.get().ObjectToolsEditor_New) {

        @Override
        public void run() {
            createTool();
        }
    };
    actionNew.setImageDescriptor(SharedIcons.ADD_OBJECT);
    actionEdit = new PropertyDialogAction(getSite(), viewer) {

        @Override
        public void run() {
            IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
            if (selection.size() != 1)
                return;
            final long toolId = ((ObjectTool) selection.getFirstElement()).getId();
            // If there will be error, adapter factory will show error message to user
            if (Platform.getAdapterManager().getAdapter(selection.getFirstElement(), ObjectToolDetails.class) == null)
                return;
            super.run();
            ObjectToolDetails details = ObjectToolsAdapterFactory.getDetailsFromCache(toolId);
            if ((details != null) && details.isModified()) {
                saveObjectTool(details);
            }
        }
    };
    actionEdit.setImageDescriptor(SharedIcons.EDIT);
    actionDelete = new Action(Messages.get().ObjectToolsEditor_Delete) {

        @Override
        public void run() {
            deleteTools();
        }
    };
    actionDelete.setImageDescriptor(SharedIcons.DELETE_OBJECT);
    actionDisable = new Action(Messages.get().ObjectToolsEditor_Disable) {

        @Override
        public void run() {
            setSelectedDisabled();
        }
    };
    actionEnable = new Action(Messages.get().ObjectToolsEditor_Enable) {

        @Override
        public void run() {
            setSelectedEnabled();
        }
    };
    actionClone = new Action(Messages.get().ObjectToolsEditor_Clone) {

        @Override
        public void run() {
            cloneTool();
        }
    };
}
Also used : PropertyDialogAction(org.eclipse.ui.dialogs.PropertyDialogAction) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) Action(org.eclipse.jface.action.Action) IHandlerService(org.eclipse.ui.handlers.IHandlerService) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ActionHandler(org.eclipse.jface.commands.ActionHandler) ObjectToolDetails(org.netxms.client.objecttools.ObjectToolDetails) PropertyDialogAction(org.eclipse.ui.dialogs.PropertyDialogAction)

Aggregations

PropertyDialogAction (org.eclipse.ui.dialogs.PropertyDialogAction)9 ISelectionProvider (org.eclipse.jface.viewers.ISelectionProvider)5 ISelection (org.eclipse.jface.viewers.ISelection)4 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)4 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 IShellProvider (org.eclipse.jface.window.IShellProvider)3 Action (org.eclipse.jface.action.Action)2 Shell (org.eclipse.swt.widgets.Shell)2 RefreshAction (org.netxms.ui.eclipse.actions.RefreshAction)2 GroupMarker (org.eclipse.jface.action.GroupMarker)1 Separator (org.eclipse.jface.action.Separator)1 ActionHandler (org.eclipse.jface.commands.ActionHandler)1 IPropertyChangeListener (org.eclipse.jface.util.IPropertyChangeListener)1 PropertyChangeEvent (org.eclipse.jface.util.PropertyChangeEvent)1 IWorkbench (org.eclipse.ui.IWorkbench)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1 IHandlerService (org.eclipse.ui.handlers.IHandlerService)1 ObjectToolDetails (org.netxms.client.objecttools.ObjectToolDetails)1