Search in sources :

Example 1 with NetworkMapTextBox

use of org.netxms.client.maps.elements.NetworkMapTextBox in project netxms by netxms.

the class PredefinedMap method fillElementContextMenu.

/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.netxms.ui.eclipse.networkmaps.views.NetworkMap#fillElementContextMenu
	 * (org.eclipse.jface.action.IMenuManager)
	 */
protected void fillElementContextMenu(IMenuManager manager) {
    if (!readOnly) {
        manager.add(actionRemove);
        Object o = ((IStructuredSelection) viewer.getSelection()).getFirstElement();
        if (o instanceof NetworkMapDCIContainer)
            manager.add(actionDCIContainerProperties);
        if (o instanceof NetworkMapDCIImage)
            manager.add(actionDCIImageProperties);
        if (o instanceof NetworkMapTextBox)
            manager.add(actionTextBoxProperties);
        if (o instanceof NetworkMapDecoration)
            manager.add(actionGroupBoxEdit);
        manager.add(new Separator());
    }
    super.fillElementContextMenu(manager);
}
Also used : NetworkMapTextBox(org.netxms.client.maps.elements.NetworkMapTextBox) NetworkMapDCIImage(org.netxms.client.maps.elements.NetworkMapDCIImage) NetworkMapDecoration(org.netxms.client.maps.elements.NetworkMapDecoration) AbstractObject(org.netxms.client.objects.AbstractObject) NetworkMapObject(org.netxms.client.maps.elements.NetworkMapObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) NetworkMapDCIContainer(org.netxms.client.maps.elements.NetworkMapDCIContainer) Separator(org.eclipse.jface.action.Separator)

Example 2 with NetworkMapTextBox

use of org.netxms.client.maps.elements.NetworkMapTextBox in project netxms by netxms.

the class PredefinedMap method addTextBoxToMap.

/**
 * Add text box element
 */
private void addTextBoxToMap() {
    NetworkMapTextBox textBox = new NetworkMapTextBox(mapPage.createElementId());
    PropertyDialog dlg = PropertyDialog.createDialogOn(getSite().getShell(), null, textBox);
    if (dlg.open() != Window.OK)
        return;
    mapPage.addElement(textBox);
    saveMap();
}
Also used : NetworkMapTextBox(org.netxms.client.maps.elements.NetworkMapTextBox) PropertyDialog(org.eclipse.ui.internal.dialogs.PropertyDialog)

Example 3 with NetworkMapTextBox

use of org.netxms.client.maps.elements.NetworkMapTextBox in project netxms by netxms.

the class PredefinedMap method showTextBoxProperties.

/**
 * Show text box properties
 */
private void showTextBoxProperties() {
    updateObjectPositions();
    IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
    if ((selection.size() != 1) || !(selection.getFirstElement() instanceof NetworkMapTextBox))
        return;
    PropertyDialog dlg = PropertyDialog.createDialogOn(getSite().getShell(), null, (NetworkMapTextBox) selection.getFirstElement());
    if (dlg.open() != Window.OK)
        return;
    saveMap();
}
Also used : NetworkMapTextBox(org.netxms.client.maps.elements.NetworkMapTextBox) PropertyDialog(org.eclipse.ui.internal.dialogs.PropertyDialog) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 4 with NetworkMapTextBox

use of org.netxms.client.maps.elements.NetworkMapTextBox in project netxms by netxms.

the class AbstractNetworkMapView method openDrillDownObject.

/**
 * Open drill-down object for currently selected object
 */
private void openDrillDownObject() {
    if (currentSelection == null)
        return;
    long objectId = 0;
    Object object = currentSelection.getFirstElement();
    if (object instanceof AbstractObject)
        objectId = (object instanceof NetworkMap) ? ((AbstractObject) object).getObjectId() : ((AbstractObject) object).getDrillDownObjectId();
    else if (object instanceof NetworkMapTextBox)
        objectId = ((NetworkMapTextBox) object).getDrillDownObjectId();
    if (objectId != 0) {
        Object test = session.findObjectById(objectId);
        if (test instanceof NetworkMap) {
            try {
                getSite().getPage().showView(PredefinedMap.ID, Long.toString(objectId), IWorkbenchPage.VIEW_ACTIVATE);
            } catch (PartInitException e) {
                MessageDialogHelper.openError(getSite().getShell(), Messages.get().AbstractNetworkMapView_Error, String.format("Cannot open drill-down object view: %s", e.getMessage()));
            }
        }
        if (test instanceof Dashboard) {
            try {
                getSite().getPage().showView("org.netxms.ui.eclipse.dashboard.views.DashboardView", Long.toString(objectId), IWorkbenchPage.VIEW_ACTIVATE);
            } catch (PartInitException e) {
                MessageDialogHelper.openError(getSite().getShell(), Messages.get().AbstractNetworkMapView_Error, String.format("Cannot open drill-down object view: %s", e.getMessage()));
            }
        }
    }
}
Also used : NetworkMapTextBox(org.netxms.client.maps.elements.NetworkMapTextBox) AbstractObject(org.netxms.client.objects.AbstractObject) Dashboard(org.netxms.client.objects.Dashboard) NetworkMapObject(org.netxms.client.maps.elements.NetworkMapObject) AbstractObject(org.netxms.client.objects.AbstractObject) PartInitException(org.eclipse.ui.PartInitException) NetworkMap(org.netxms.client.objects.NetworkMap)

Aggregations

NetworkMapTextBox (org.netxms.client.maps.elements.NetworkMapTextBox)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 PropertyDialog (org.eclipse.ui.internal.dialogs.PropertyDialog)2 NetworkMapObject (org.netxms.client.maps.elements.NetworkMapObject)2 AbstractObject (org.netxms.client.objects.AbstractObject)2 Separator (org.eclipse.jface.action.Separator)1 PartInitException (org.eclipse.ui.PartInitException)1 NetworkMapDCIContainer (org.netxms.client.maps.elements.NetworkMapDCIContainer)1 NetworkMapDCIImage (org.netxms.client.maps.elements.NetworkMapDCIImage)1 NetworkMapDecoration (org.netxms.client.maps.elements.NetworkMapDecoration)1 Dashboard (org.netxms.client.objects.Dashboard)1 NetworkMap (org.netxms.client.objects.NetworkMap)1