Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target platform icon for "Load TP" job #1034

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,11 @@ private void resetPlatform(IProgressMonitor monitor) {
PDECore.getDefault().getFeatureModelManager().targetReloaded();
}

/**
* @since 3.17
*/
public static Object getFamily() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding this new API I would prefer to move JOB_FAMILITY_ID as public constant to an internal class, e.g. ICoreConstants, and references it that here and int PDEPlugin.

return JOB_FAMILY_ID;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.pde.core.target.LoadTargetDefinitionJob;
import org.eclipse.pde.internal.core.PDEPreferencesManager;
import org.eclipse.pde.internal.ui.launcher.PDELogFileProvider;
import org.eclipse.pde.internal.ui.shared.target.RepositoryBundleContainerAdapterFactory;
Expand All @@ -42,6 +43,7 @@
import org.eclipse.ui.internal.views.log.ILogFileProvider;
import org.eclipse.ui.internal.views.log.LogFilesManager;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.progress.IProgressService;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why there is org.eclipse.ui.progress.IProgressService and org.eclipse.e4.ui.progress.IProgressService which looks very similar.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One is the "old" eclipse.ui and the other the "new" rcp E4 ... but I think the E4 one is not really completed and would need a declarative way (e4xmi) to add icons for job groups.

import org.eclipse.ui.texteditor.IDocumentProvider;
import org.osgi.framework.BundleContext;

Expand Down Expand Up @@ -214,6 +216,18 @@ public void start(BundleContext context) throws Exception {
LogFilesManager.addLogFileProvider(fLogFileProvider);

TargetStatus.initializeTargetStatus();
registerProgressIcon();
}

protected void registerProgressIcon() {
if (!PlatformUI.isWorkbenchRunning()) {
return;
}
IProgressService service = PlatformUI.getWorkbench().getProgressService();
if (service == null) {
return;
}
service.registerIconForFamily(PDEPluginImages.DESC_TARGET_DEFINITION, LoadTargetDefinitionJob.getFamily());
Comment on lines +222 to +230
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this be simply done in a static initializer in LoadTargetDefinitionJob?
This would also solve the problem where to place the job-family constant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The job lives in pde.core. The registration for the icon happens with the workbench progress service, which looks like a UI dependent class to me. I'm not sure if that service can be retrieved in the plain pde.core bundle without disturbing the workbench lifecycle. In egit we therefore even put that code into a service reacting to the application has started lifecycle.
Do you know better?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think given the current structure, this is fine, an alternative might be to use an addon in the e4xmi but that really seems a bit overhead here...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know better?

You are right and no, I don't know better in this case.

}

@Override
Expand Down
Loading