org.eclipse.ui.navigator.ICommonViewerSite Java Examples

The following examples show how to use org.eclipse.ui.navigator.ICommonViewerSite. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CommonActionProvider.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void init ( final ICommonActionExtensionSite aSite )
{
    super.init ( aSite );
    final ICommonViewerSite viewSite = aSite.getViewSite ();
    if ( viewSite instanceof ICommonViewerWorkbenchSite )
    {
        final ICommonViewerWorkbenchSite workbenchSite = (ICommonViewerWorkbenchSite)viewSite;
        this.openAction = new Action ( "Open", IAction.AS_PUSH_BUTTON ) {
            @Override
            public void run ()
            {
                EditorHelper.handleOpen ( workbenchSite.getPage (), workbenchSite.getSelectionProvider () );
            }
        };
    }
}
 
Example #2
Source File: CommonActionProvider.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void init ( final ICommonActionExtensionSite aSite )
{
    super.init ( aSite );
    final ICommonViewerSite viewSite = aSite.getViewSite ();
    if ( viewSite instanceof ICommonViewerWorkbenchSite )
    {
        final ICommonViewerWorkbenchSite workbenchSite = (ICommonViewerWorkbenchSite)viewSite;
        this.openAction = new Action ( "Open", IAction.AS_PUSH_BUTTON ) {
            @Override
            public void run ()
            {
                handleOpen ( workbenchSite );
            }
        };
    }
}
 
Example #3
Source File: CodewindApplicationActionProvider.java    From codewind-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
private void addLogFileSubMenu(IMenuManager menu) {
	final ICommonViewerSite viewSite = getActionSite().getViewSite();
	ISelection selection = viewSite.getSelectionProvider().getSelection();
	if (!(selection instanceof IStructuredSelection)) {
		return;
	}

	IStructuredSelection sel = (IStructuredSelection) selection;
	if (sel.size() == 1) {
		Object obj = sel.getFirstElement();
		if (obj instanceof CodewindEclipseApplication) {
			final CodewindEclipseApplication app = (CodewindEclipseApplication) obj;
			if (app.isAvailable() && app.getLogInfos() != null && !app.getLogInfos().isEmpty()) {
				MenuManager menuMgr = new MenuManager(Messages.ShowLogFilesMenu, "ShowLogFiles");
				showAllLogsAction.setApp(app);
				menuMgr.add(showAllLogsAction);
				hideAllLogsAction.setApp(app);
				menuMgr.add(hideAllLogsAction);
				menuMgr.add(new Separator());
				for (ProjectLogInfo logInfo : app.getLogInfos()) {
					menuMgr.add(new LogFileAction(app, logInfo, viewSite));
				}
				menu.add(menuMgr);
			}
		}
	}
}
 
Example #4
Source File: TmfActionProvider.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void init(ICommonActionExtensionSite aSite) {
    ICommonViewerSite viewSite = aSite.getViewSite();
    if (viewSite instanceof ICommonViewerWorkbenchSite) {
        ICommonViewerWorkbenchSite workbenchSite = (ICommonViewerWorkbenchSite) viewSite;
        page = workbenchSite.getPage();
        openAction = new OpenAction(page, workbenchSite.getSelectionProvider());
    }
}
 
Example #5
Source File: PythonActionProvider.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void init(ICommonActionExtensionSite aSite) {
    ICommonViewerSite viewSite = aSite.getViewSite();
    if (viewSite instanceof ICommonViewerWorkbenchSite) {
        ICommonViewerWorkbenchSite site = (ICommonViewerWorkbenchSite) viewSite;
        Shell shell = site.getShell();

        ISharedImages images = PlatformUI.getWorkbench().getSharedImages();
        clipboard = new Clipboard(shell.getDisplay());
        selectionProvider = site.getSelectionProvider();
        openPythonAction = new PyOpenPythonFileAction(site.getPage(), selectionProvider);
        openResourceAction = new PyOpenResourceAction(site.getPage(), selectionProvider);
        openExternalAction = new PyOpenExternalAction(site.getPage(), selectionProvider);

        deleteResourceAction = new PyDeleteResourceAction(shell, selectionProvider);
        copyResourceAction = new PyCopyResourceAction(shell, selectionProvider, clipboard);
        pasteAction = new PyPasteAction(shell, selectionProvider, clipboard);
        moveResourceAction = new PyMoveResourceAction(shell, selectionProvider);

        copyResourceAction.setDisabledImageDescriptor(images
                .getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED));
        copyResourceAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));

        pasteAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED));
        pasteAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));

        deleteResourceAction.setDisabledImageDescriptor(images
                .getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
        deleteResourceAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));

    }
}
 
Example #6
Source File: PythonRefactorActionProvider.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void init(ICommonActionExtensionSite aSite) {
    ICommonViewerSite viewSite = aSite.getViewSite();
    if (viewSite instanceof ICommonViewerWorkbenchSite) {
        ICommonViewerWorkbenchSite site = (ICommonViewerWorkbenchSite) viewSite;
        Shell shell = site.getShell();
        renameResourceAction = new PyRenameResourceAction(shell, site.getSelectionProvider());
    }
}
 
Example #7
Source File: GoNavigatorActionProvider.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void init(ICommonActionExtensionSite aSite) {
	super.init(aSite);
	
	ICommonViewerSite viewSite = aSite.getViewSite();
	if(viewSite instanceof ICommonViewerWorkbenchSite) {
		ICommonViewerWorkbenchSite cvws = (ICommonViewerWorkbenchSite) viewSite;
		navigatorOpenAction = new NavigatorOpenAction(cvws.getPage(), cvws.getSelectionProvider());
	}
}
 
Example #8
Source File: LogFileAction.java    From codewind-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public LogFileAction(CodewindEclipseApplication app, ProjectLogInfo logInfo, ICommonViewerSite viewSite) {
super(logInfo.logName, IAction.AS_CHECK_BOX);
  	this.logInfo = logInfo;
  	this.app = app;
  	setChecked(app.getConsole(logInfo) != null);
  }